From bd17bc716b3af623175737be5e8d238a816e1ada Mon Sep 17 00:00:00 2001 From: markiantorno Date: Mon, 20 Apr 2020 13:37:29 -0400 Subject: [PATCH 1/6] wip --- .../convertors/VersionConvertor_10_30.java | 6615 ++++++++--------- .../convertors/VersionConvertor_10_40.java | 80 +- .../convertors/VersionConvertor_10_50.java | 80 +- .../convertors/VersionConvertor_14_30.java | 108 +- .../convertors/VersionConvertor_30_40.java | 72 +- .../convertors/VersionConvertor_30_50.java | 88 +- .../convertors/VersionConvertor_40_50.java | 92 +- ...ersionConvertorPrimitiveType10_30Test.java | 76 + .../VersionConvertor_10_30Test.java | 20 +- .../org/hl7/fhir/dstu3/model/Element.java | 1 + org.hl7.fhir.validation/pom.xml | 1 - pom.xml | 16 +- 12 files changed, 3624 insertions(+), 3625 deletions(-) create mode 100644 org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType10_30Test.java 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 4cdd96124..616f64158 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 @@ -1,9 +1,23 @@ package org.hl7.fhir.convertors; +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.CodeSystem; +import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent; +import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent; +import org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent; +import org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent; +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.Collections; import java.util.List; import java.util.stream.Collectors; + /*- * #%L * org.hl7.fhir.convertors @@ -13,9 +27,9 @@ import java.util.stream.Collectors; * 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. @@ -23,91 +37,6 @@ import java.util.stream.Collectors; * limitations under the License. * #L% */ -import org.hl7.fhir.convertors.conv10_30.Account10_30; -import org.hl7.fhir.convertors.conv10_30.Appointment10_30; -import org.hl7.fhir.convertors.conv10_30.AppointmentResponse10_30; -import org.hl7.fhir.convertors.conv10_30.AuditEvent10_30; -import org.hl7.fhir.convertors.conv10_30.Basic10_30; -import org.hl7.fhir.convertors.conv10_30.Binary10_30; -import org.hl7.fhir.convertors.conv10_30.Bundle10_30; -import org.hl7.fhir.convertors.conv10_30.CarePlan10_30; -import org.hl7.fhir.convertors.conv10_30.ClinicalImpression10_30; -import org.hl7.fhir.convertors.conv10_30.Communication10_30; -import org.hl7.fhir.convertors.conv10_30.CommunicationRequest10_30; -import org.hl7.fhir.convertors.conv10_30.Composition10_30; -import org.hl7.fhir.convertors.conv10_30.ConceptMap10_30; -import org.hl7.fhir.convertors.conv10_30.Condition10_30; -import org.hl7.fhir.convertors.conv10_30.Conformance10_30; -import org.hl7.fhir.convertors.conv10_30.Contract10_30; -import org.hl7.fhir.convertors.conv10_30.DataElement10_30; -import org.hl7.fhir.convertors.conv10_30.DetectedIssue10_30; -import org.hl7.fhir.convertors.conv10_30.Device10_30; -import org.hl7.fhir.convertors.conv10_30.DeviceComponent10_30; -import org.hl7.fhir.convertors.conv10_30.DeviceMetric10_30; -import org.hl7.fhir.convertors.conv10_30.DeviceUseStatement10_30; -import org.hl7.fhir.convertors.conv10_30.DiagnosticReport10_30; -import org.hl7.fhir.convertors.conv10_30.DocumentManifest10_30; -import org.hl7.fhir.convertors.conv10_30.DocumentReference10_30; -import org.hl7.fhir.convertors.conv10_30.Encounter10_30; -import org.hl7.fhir.convertors.conv10_30.EnrollmentRequest10_30; -import org.hl7.fhir.convertors.conv10_30.EnrollmentResponse10_30; -import org.hl7.fhir.convertors.conv10_30.EpisodeOfCare10_30; -import org.hl7.fhir.convertors.conv10_30.FamilyMemberHistory10_30; -import org.hl7.fhir.convertors.conv10_30.Flag10_30; -import org.hl7.fhir.convertors.conv10_30.Group10_30; -import org.hl7.fhir.convertors.conv10_30.HealthcareService10_30; -import org.hl7.fhir.convertors.conv10_30.ImagingStudy10_30; -import org.hl7.fhir.convertors.conv10_30.Immunization10_30; -import org.hl7.fhir.convertors.conv10_30.ImmunizationRecommendation10_30; -import org.hl7.fhir.convertors.conv10_30.ImplementationGuide10_30; -import org.hl7.fhir.convertors.conv10_30.List10_30; -import org.hl7.fhir.convertors.conv10_30.Location10_30; -import org.hl7.fhir.convertors.conv10_30.Media10_30; -import org.hl7.fhir.convertors.conv10_30.Medication10_30; -import org.hl7.fhir.convertors.conv10_30.MedicationDispense10_30; -import org.hl7.fhir.convertors.conv10_30.MedicationStatement10_30; -import org.hl7.fhir.convertors.conv10_30.MessageHeader10_30; -import org.hl7.fhir.convertors.conv10_30.NamingSystem10_30; -import org.hl7.fhir.convertors.conv10_30.Observation10_30; -import org.hl7.fhir.convertors.conv10_30.OperationDefinition10_30; -import org.hl7.fhir.convertors.conv10_30.OperationOutcome10_30; -import org.hl7.fhir.convertors.conv10_30.Organization10_30; -import org.hl7.fhir.convertors.conv10_30.Parameters10_30; -import org.hl7.fhir.convertors.conv10_30.Patient10_30; -import org.hl7.fhir.convertors.conv10_30.Person10_30; -import org.hl7.fhir.convertors.conv10_30.Practitioner10_30; -import org.hl7.fhir.convertors.conv10_30.Procedure10_30; -import org.hl7.fhir.convertors.conv10_30.ProcedureRequest10_30; -import org.hl7.fhir.convertors.conv10_30.Provenance10_30; -import org.hl7.fhir.convertors.conv10_30.Questionnaire10_30; -import org.hl7.fhir.convertors.conv10_30.QuestionnaireResponse10_30; -import org.hl7.fhir.convertors.conv10_30.ReferralRequest10_30; -import org.hl7.fhir.convertors.conv10_30.RelatedPerson10_30; -import org.hl7.fhir.convertors.conv10_30.RiskAssessment10_30; -import org.hl7.fhir.convertors.conv10_30.Schedule10_30; -import org.hl7.fhir.convertors.conv10_30.SearchParameter10_30; -import org.hl7.fhir.convertors.conv10_30.Slot10_30; -import org.hl7.fhir.convertors.conv10_30.Specimen10_30; -import org.hl7.fhir.convertors.conv10_30.StructureDefinition10_30; -import org.hl7.fhir.convertors.conv10_30.Subscription10_30; -import org.hl7.fhir.convertors.conv10_30.Substance10_30; -import org.hl7.fhir.convertors.conv10_30.SupplyDelivery10_30; -import org.hl7.fhir.convertors.conv10_30.SupplyRequest10_30; -import org.hl7.fhir.convertors.conv10_30.TestScript10_30; -import org.hl7.fhir.convertors.conv10_30.ValueSet10_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.CodeSystem; -import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent; -import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent; -import org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent; -import org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent; -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; /* Copyright (c) 2011+, HL7, Inc. @@ -139,2558 +68,2569 @@ import org.hl7.fhir.utilities.Utilities; */ public class VersionConvertor_10_30 { - 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)); - } - } - - 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 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 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 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; - } - - 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; - } - - 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 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 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 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 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 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 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; - } - - 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; - } - - 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 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 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 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 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; - } - - 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; - } - - 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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; - } - - 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); - if (src.hasUrlElement()) - tgt.setUrlElement(convertUri(src.getUrlElement())); - if (src.hasValue()) - 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); - if (src.hasUrlElement()) - tgt.setUrlElement(convertUri(src.getUrlElement())); - if (src.hasValue()) - 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); - if (src.hasStatus()) - tgt.setStatusElement(convertNarrativeStatus(src.getStatusElement())); - if (src.hasDiv()) - 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); - if (src.hasStatus()) - tgt.setStatusElement(convertNarrativeStatus(src.getStatusElement())); - tgt.setDiv(src.getDiv()); - return tgt; - } - - static public org.hl7.fhir.dstu3.model.Enumeration convertNarrativeStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Narrative.NarrativeStatusEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case GENERATED: - tgt.setValue(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED); - break; - case EXTENSIONS: - tgt.setValue(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EXTENSIONS); - break; - case ADDITIONAL: - tgt.setValue(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.ADDITIONAL); - break; - case EMPTY: - tgt.setValue(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EMPTY); - break; - default: - tgt.setValue(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.NULL); - break; - } - return tgt; - } - - static public org.hl7.fhir.dstu2.model.Enumeration convertNarrativeStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Narrative.NarrativeStatusEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case GENERATED: - tgt.setValue(org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.GENERATED); - break; - case EXTENSIONS: - tgt.setValue(org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.EXTENSIONS); - break; - case ADDITIONAL: - tgt.setValue(org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.ADDITIONAL); - break; - case EMPTY: - tgt.setValue(org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.EMPTY); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.NULL); - break; - } - return tgt; - } - - 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); - if (src.hasAuthor()) - tgt.setAuthor(convertType(src.getAuthor())); - if (src.hasTimeElement()) - tgt.setTimeElement(convertDateTime(src.getTimeElement())); - if (src.hasTextElement()) - tgt.setTextElement(convertString(src.getTextElement())); - 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); - if (src.hasAuthor()) - tgt.setAuthor(convertType(src.getAuthor())); - if (src.hasTimeElement()) - tgt.setTimeElement(convertDateTime(src.getTimeElement())); - if (src.hasTextElement()) - tgt.setTextElement(convertString(src.getTextElement())); - 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); - if (src.hasContentTypeElement()) - tgt.setContentTypeElement(convertCode(src.getContentTypeElement())); - if (src.hasLanguageElement()) - tgt.setLanguageElement(convertCode(src.getLanguageElement())); - if (src.hasDataElement()) - tgt.setDataElement(convertBase64Binary(src.getDataElement())); - if (src.hasUrlElement()) - tgt.setUrlElement(convertUri(src.getUrlElement())); - if (src.hasSizeElement()) - tgt.setSizeElement(convertUnsignedInt(src.getSizeElement())); - if (src.hasHashElement()) - tgt.setHashElement(convertBase64Binary(src.getHashElement())); - if (src.hasTitleElement()) - tgt.setTitleElement(convertString(src.getTitleElement())); - if (src.hasCreationElement()) - tgt.setCreationElement(convertDateTime(src.getCreationElement())); - 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); - if (src.hasContentTypeElement()) - tgt.setContentTypeElement(convertCode(src.getContentTypeElement())); - if (src.hasLanguageElement()) - tgt.setLanguageElement(convertCode(src.getLanguageElement())); - if (src.hasDataElement()) - tgt.setDataElement(convertBase64Binary(src.getDataElement())); - if (src.hasUrlElement()) - tgt.setUrlElement(convertUri(src.getUrlElement())); - if (src.hasSizeElement()) - tgt.setSizeElement(convertUnsignedInt(src.getSizeElement())); - if (src.hasHashElement()) - tgt.setHashElement(convertBase64Binary(src.getHashElement())); - if (src.hasTitleElement()) - tgt.setTitleElement(convertString(src.getTitleElement())); - if (src.hasCreationElement()) - tgt.setCreationElement(convertDateTime(src.getCreationElement())); - 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)); - if (src.hasTextElement()) - tgt.setTextElement(convertString(src.getTextElement())); - 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)); - if (src.hasTextElement()) - tgt.setTextElement(convertString(src.getTextElement())); - 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); - if (src.hasSystemElement()) - tgt.setSystemElement(convertUri(src.getSystemElement())); - if (src.hasVersionElement()) - tgt.setVersionElement(convertString(src.getVersionElement())); - if (src.hasCodeElement()) - tgt.setCodeElement(convertCode(src.getCodeElement())); - if (src.hasDisplayElement()) - tgt.setDisplayElement(convertString(src.getDisplayElement())); - if (src.hasUserSelectedElement()) - tgt.setUserSelectedElement(convertBoolean(src.getUserSelectedElement())); - 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); - if (src.hasSystemElement()) - tgt.setSystemElement(convertUri(src.getSystemElement())); - if (src.hasVersionElement()) - tgt.setVersionElement(convertString(src.getVersionElement())); - if (src.hasCodeElement()) - tgt.setCodeElement(convertCode(src.getCodeElement())); - if (src.hasDisplayElement()) - tgt.setDisplayElement(convertString(src.getDisplayElement())); - if (src.hasUserSelectedElement()) - tgt.setUserSelectedElement(convertBoolean(src.getUserSelectedElement())); - 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); - if (src.hasUse()) - tgt.setUseElement(convertIdentifierUse(src.getUseElement())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSystemElement()) - tgt.setSystemElement(convertUri(src.getSystemElement())); - if (src.hasValueElement()) - tgt.setValueElement(convertString(src.getValueElement())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasAssigner()) - 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.setUseElement(convertIdentifierUse(src.getUseElement())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSystem()) - tgt.setSystemElement(convertUri(src.getSystemElement())); - if (src.hasValue()) - tgt.setValueElement(convertString(src.getValueElement())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasAssigner()) - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - static public org.hl7.fhir.dstu3.model.Enumeration convertIdentifierUse(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Identifier.IdentifierUseEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case USUAL: - tgt.setValue(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.USUAL); - break; - case OFFICIAL: - tgt.setValue(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.OFFICIAL); - break; - case TEMP: - tgt.setValue(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.TEMP); - break; - case SECONDARY: - tgt.setValue(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.SECONDARY); - break; - default: - tgt.setValue(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.NULL); - break; - } - return tgt; - } - - static public org.hl7.fhir.dstu2.model.Enumeration convertIdentifierUse(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Identifier.IdentifierUseEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case USUAL: - tgt.setValue(org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.USUAL); - break; - case OFFICIAL: - tgt.setValue(org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.OFFICIAL); - break; - case TEMP: - tgt.setValue(org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.TEMP); - break; - case SECONDARY: - tgt.setValue(org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.SECONDARY); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.NULL); - break; - } - return tgt; - } - - 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); - if (src.hasStartElement()) - tgt.setStartElement(convertDateTime(src.getStartElement())); - if (src.hasEndElement()) - tgt.setEndElement(convertDateTime(src.getEndElement())); - 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); - if (src.hasStartElement()) - tgt.setStartElement(convertDateTime(src.getStartElement())); - if (src.hasEndElement()) - tgt.setEndElement(convertDateTime(src.getEndElement())); - 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); - if (src.hasValueElement()) - tgt.setValueElement(convertDecimal(src.getValueElement())); - if (src.hasComparator()) - tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); - if (src.hasUnitElement()) - tgt.setUnitElement(convertString(src.getUnitElement())); - if (src.hasSystemElement()) - tgt.setSystemElement(convertUri(src.getSystemElement())); - if (src.hasCodeElement()) - tgt.setCodeElement(convertCode(src.getCodeElement())); - 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); - if (src.hasValueElement()) - tgt.setValueElement(convertDecimal(src.getValueElement())); - if (src.hasComparator()) - tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); - if (src.hasUnitElement()) - tgt.setUnitElement(convertString(src.getUnitElement())); - if (src.hasSystemElement()) - tgt.setSystemElement(convertUri(src.getSystemElement())); - if (src.hasCodeElement()) - tgt.setCodeElement(convertCode(src.getCodeElement())); - return tgt; - } - - static public org.hl7.fhir.dstu3.model.Enumeration convertQuantityComparator(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Quantity.QuantityComparatorEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case LESS_THAN: - tgt.setValue(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_THAN); - break; - case LESS_OR_EQUAL: - tgt.setValue(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_OR_EQUAL); - break; - case GREATER_OR_EQUAL: - tgt.setValue(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_OR_EQUAL); - break; - case GREATER_THAN: - tgt.setValue(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_THAN); - break; - default: - tgt.setValue(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.NULL); - break; - } - return tgt; - } - - static public org.hl7.fhir.dstu2.model.Enumeration convertQuantityComparator(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Quantity.QuantityComparatorEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case LESS_THAN: - tgt.setValue(org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.LESS_THAN); - break; - case LESS_OR_EQUAL: - tgt.setValue(org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.LESS_OR_EQUAL); - break; - case GREATER_OR_EQUAL: - tgt.setValue(org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.GREATER_OR_EQUAL); - break; - case GREATER_THAN: - tgt.setValue(org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.GREATER_THAN); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.NULL); - break; - } - return tgt; - } - - 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); - if (src.hasLow()) - tgt.setLow(convertSimpleQuantity(src.getLow())); - if (src.hasHigh()) - 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); - 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.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); - if (src.hasNumerator()) - tgt.setNumerator(convertQuantity(src.getNumerator())); - if (src.hasDenominator()) - 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); - 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.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); - if (src.hasReference()) - tgt.setReference(src.getReference()); - if (src.hasDisplayElement()) - tgt.setDisplayElement(convertString(src.getDisplayElement())); - 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); - if (src.hasReference()) - tgt.setReference(src.getReference()); - if (src.hasDisplayElement()) - tgt.setDisplayElement(convertString(src.getDisplayElement())); - 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); - if (src.hasOrigin()) - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - if (src.hasPeriodElement()) - tgt.setPeriodElement(convertDecimal(src.getPeriodElement())); - if (src.hasFactorElement()) - tgt.setFactorElement(convertDecimal(src.getFactorElement())); - if (src.hasLowerLimitElement()) - tgt.setLowerLimitElement(convertDecimal(src.getLowerLimitElement())); - if (src.hasUpperLimitElement()) - tgt.setUpperLimitElement(convertDecimal(src.getUpperLimitElement())); - if (src.hasDimensionsElement()) - tgt.setDimensionsElement(convertPositiveInt(src.getDimensionsElement())); - if (src.hasDataElement()) - tgt.setDataElement(convertString(src.getDataElement())); - 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); - if (src.hasOrigin()) - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - if (src.hasPeriodElement()) - tgt.setPeriodElement(convertDecimal(src.getPeriodElement())); - if (src.hasFactorElement()) - tgt.setFactorElement(convertDecimal(src.getFactorElement())); - if (src.hasLowerLimitElement()) - tgt.setLowerLimitElement(convertDecimal(src.getLowerLimitElement())); - if (src.hasUpperLimitElement()) - tgt.setUpperLimitElement(convertDecimal(src.getUpperLimitElement())); - if (src.hasDimensionsElement()) - tgt.setDimensionsElement(convertPositiveInt(src.getDimensionsElement())); - if (src.hasDataElement()) - tgt.setDataElement(convertString(src.getDataElement())); - 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)); - if (src.hasWhenElement()) - tgt.setWhenElement(convertInstant(src.getWhenElement())); - if (src.hasWho()) - tgt.setWho(convertType(src.getWho())); - if (src.hasContentTypeElement()) - tgt.setContentTypeElement(convertCode(src.getContentTypeElement())); - if (src.hasBlobElement()) - tgt.setBlobElement(convertBase64Binary(src.getBlobElement())); - 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)); - if (src.hasWhenElement()) - tgt.setWhenElement(convertInstant(src.getWhenElement())); - if (src.hasWho()) - tgt.setWho(convertType(src.getWho())); - if (src.hasContentTypeElement()) - tgt.setContentTypeElement(convertCode(src.getContentTypeElement())); - if (src.hasBlobElement()) - tgt.setBlobElement(convertBase64Binary(src.getBlobElement())); - 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); - if (src.hasUse()) - tgt.setUseElement(convertAddressUse(src.getUseElement())); - if (src.hasType()) - tgt.setTypeElement(convertAddressType(src.getTypeElement())); - if (src.hasTextElement()) - tgt.setTextElement(convertString(src.getTextElement())); - for (org.hl7.fhir.dstu2.model.StringType t : src.getLine()) tgt.addLine(t.getValue()); - if (src.hasCityElement()) - tgt.setCityElement(convertString(src.getCityElement())); - if (src.hasDistrictElement()) - tgt.setDistrictElement(convertString(src.getDistrictElement())); - if (src.hasStateElement()) - tgt.setStateElement(convertString(src.getStateElement())); - if (src.hasPostalCodeElement()) - tgt.setPostalCodeElement(convertString(src.getPostalCodeElement())); - if (src.hasCountryElement()) - tgt.setCountryElement(convertString(src.getCountryElement())); - if (src.hasPeriod()) - 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); - if (src.hasUse()) - tgt.setUseElement(convertAddressUse(src.getUseElement())); - if (src.hasType()) - tgt.setTypeElement(convertAddressType(src.getTypeElement())); - if (src.hasTextElement()) - tgt.setTextElement(convertString(src.getTextElement())); - for (org.hl7.fhir.dstu3.model.StringType t : src.getLine()) tgt.addLine(t.getValue()); - if (src.hasCityElement()) - tgt.setCityElement(convertString(src.getCityElement())); - if (src.hasDistrictElement()) - tgt.setDistrictElement(convertString(src.getDistrictElement())); - if (src.hasStateElement()) - tgt.setStateElement(convertString(src.getStateElement())); - if (src.hasPostalCodeElement()) - tgt.setPostalCodeElement(convertString(src.getPostalCodeElement())); - if (src.hasCountryElement()) - tgt.setCountryElement(convertString(src.getCountryElement())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - static public org.hl7.fhir.dstu3.model.Enumeration convertAddressUse(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Address.AddressUseEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case HOME: - tgt.setValue(org.hl7.fhir.dstu3.model.Address.AddressUse.HOME); - break; - case WORK: - tgt.setValue(org.hl7.fhir.dstu3.model.Address.AddressUse.WORK); - break; - case TEMP: - tgt.setValue(org.hl7.fhir.dstu3.model.Address.AddressUse.TEMP); - break; - case OLD: - tgt.setValue(org.hl7.fhir.dstu3.model.Address.AddressUse.OLD); - break; - default: - tgt.setValue(org.hl7.fhir.dstu3.model.Address.AddressUse.NULL); - break; - } - return tgt; - } - - static public org.hl7.fhir.dstu2.model.Enumeration convertAddressUse(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Address.AddressUseEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case HOME: - tgt.setValue(org.hl7.fhir.dstu2.model.Address.AddressUse.HOME); - break; - case WORK: - tgt.setValue(org.hl7.fhir.dstu2.model.Address.AddressUse.WORK); - break; - case TEMP: - tgt.setValue(org.hl7.fhir.dstu2.model.Address.AddressUse.TEMP); - break; - case OLD: - tgt.setValue(org.hl7.fhir.dstu2.model.Address.AddressUse.OLD); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.Address.AddressUse.NULL); - break; - } - return tgt; - } - - static public org.hl7.fhir.dstu3.model.Enumeration convertAddressType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Address.AddressTypeEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case POSTAL: - tgt.setValue(org.hl7.fhir.dstu3.model.Address.AddressType.POSTAL); - break; - case PHYSICAL: - tgt.setValue(org.hl7.fhir.dstu3.model.Address.AddressType.PHYSICAL); - break; - case BOTH: - tgt.setValue(org.hl7.fhir.dstu3.model.Address.AddressType.BOTH); - break; - default: - tgt.setValue(org.hl7.fhir.dstu3.model.Address.AddressType.NULL); - break; - } - return tgt; - } - - static public org.hl7.fhir.dstu2.model.Enumeration convertAddressType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Address.AddressTypeEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case POSTAL: - tgt.setValue(org.hl7.fhir.dstu2.model.Address.AddressType.POSTAL); - break; - case PHYSICAL: - tgt.setValue(org.hl7.fhir.dstu2.model.Address.AddressType.PHYSICAL); - break; - case BOTH: - tgt.setValue(org.hl7.fhir.dstu2.model.Address.AddressType.BOTH); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.Address.AddressType.NULL); - break; - } - return tgt; - } - - 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); - if (src.hasSystem()) - tgt.setSystemElement(convertContactPointSystem(src.getSystemElement())); - if (src.hasValueElement()) - tgt.setValueElement(convertString(src.getValueElement())); - if (src.hasUse()) - tgt.setUseElement(convertContactPointUse(src.getUseElement())); - if (src.hasRank()) - tgt.setRankElement(convertPositiveInt(src.getRankElement())); - if (src.hasPeriod()) - 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.setSystemElement(convertContactPointSystem(src.getSystemElement())); - if (src.hasValueElement()) - tgt.setValueElement(convertString(src.getValueElement())); - if (src.hasUse()) - tgt.setUseElement(convertContactPointUse(src.getUseElement())); - if (src.hasRankElement()) - tgt.setRankElement(convertPositiveInt(src.getRankElement())); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - static public org.hl7.fhir.dstu3.model.Enumeration convertContactPointSystem(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystemEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case PHONE: - tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PHONE); - break; - case FAX: - tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.FAX); - break; - case EMAIL: - tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.EMAIL); - break; - case PAGER: - tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PAGER); - break; - case OTHER: - tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.OTHER); - break; - default: - tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.NULL); - break; - } - return tgt; - } - - static public org.hl7.fhir.dstu2.model.Enumeration convertContactPointSystem(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystemEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case PHONE: - tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.PHONE); - break; - case FAX: - tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.FAX); - break; - case EMAIL: - tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.EMAIL); - break; - case PAGER: - tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.PAGER); - break; - case OTHER: - tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.OTHER); - break; - case URL: - tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.OTHER); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.NULL); - break; - } - return tgt; - } - - static public org.hl7.fhir.dstu3.model.Enumeration convertContactPointUse(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUseEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case HOME: - tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.HOME); - break; - case WORK: - tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.WORK); - break; - case TEMP: - tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.TEMP); - break; - case OLD: - tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.OLD); - break; - case MOBILE: - tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.MOBILE); - break; - default: - tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.NULL); - break; - } - return tgt; - } - - static public org.hl7.fhir.dstu2.model.Enumeration convertContactPointUse(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUseEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case HOME: - tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.HOME); - break; - case WORK: - tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.WORK); - break; - case TEMP: - tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.TEMP); - break; - case OLD: - tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.OLD); - break; - case MOBILE: - tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.MOBILE); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.NULL); - break; - } - return tgt; - } - - 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); - if (src.hasPathElement()) - tgt.setPathElement(convertString(src.getPathElement())); - tgt.setRepresentation(src.getRepresentation().stream() - .map(VersionConvertor_10_30::convertPropertyRepresentation) - .collect(Collectors.toList())); - if (src.hasName()) { - if (slicePaths.contains(src.getPath())) - tgt.setSliceNameElement(convertString(src.getNameElement())); - if (src.hasNameElement()) - tgt.setIdElement(convertString(src.getNameElement())); - } - if (src.hasLabel()) - tgt.setLabelElement(convertString(src.getLabelElement())); - 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.setShortElement(convertString(src.getShortElement())); - if (src.hasDefinition()) - tgt.setDefinitionElement(convertMarkdown(src.getDefinitionElement())); - if (src.hasComments()) - tgt.setCommentElement(convertMarkdown(src.getCommentsElement())); - if (src.hasRequirements()) - tgt.setRequirementsElement(convertMarkdown(src.getRequirementsElement())); - 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.setMaxElement(convertString(src.getMaxElement())); - 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.setMeaningWhenMissingElement(convertMarkdown(src.getMeaningWhenMissingElement())); - 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.setMaxLengthElement(convertInteger(src.getMaxLengthElement())); - 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.setMustSupportElement(convertBoolean(src.getMustSupportElement())); - if (src.hasIsModifier()) - tgt.setIsModifierElement(convertBoolean(src.getIsModifierElement())); - if (src.hasIsSummary()) - tgt.setIsSummaryElement(convertBoolean(src.getIsSummaryElement())); - 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); - if (src.hasPathElement()) - tgt.setPathElement(convertString(src.getPathElement())); - tgt.setRepresentation(src.getRepresentation().stream() - .map(VersionConvertor_10_30::convertPropertyRepresentation) - .collect(Collectors.toList())); - if (src.hasSliceName()) - tgt.setNameElement(convertString(src.getSliceNameElement())); - else - tgt.setNameElement(convertString(src.getIdElement())); - if (src.hasLabelElement()) - tgt.setLabelElement(convertString(src.getLabelElement())); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) tgt.addCode(convertCoding(t)); - if (src.hasSlicing()) - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); - if (src.hasShortElement()) - tgt.setShortElement(convertString(src.getShortElement())); - if (src.hasDefinitionElement()) - tgt.setDefinitionElement(convertMarkdown(src.getDefinitionElement())); - if (src.hasCommentElement()) - tgt.setCommentsElement(convertMarkdown(src.getCommentElement())); - if (src.hasRequirementsElement()) - tgt.setRequirementsElement(convertMarkdown(src.getRequirementsElement())); - for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); - tgt.setMin(src.getMin()); - if (src.hasMaxElement()) - tgt.setMaxElement(convertString(src.getMaxElement())); - 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)); - if (src.hasDefaultValue()) - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasMeaningWhenMissingElement()) - tgt.setMeaningWhenMissingElement(convertMarkdown(src.getMeaningWhenMissingElement())); - if (src.hasFixed()) - tgt.setFixed(convertType(src.getFixed())); - if (src.hasPattern()) - tgt.setPattern(convertType(src.getPattern())); - if (src.hasExample()) - tgt.setExample(convertType(src.getExampleFirstRep().getValue())); - if (src.hasMinValue()) - tgt.setMinValue(convertType(src.getMinValue())); - if (src.hasMaxValue()) - tgt.setMaxValue(convertType(src.getMaxValue())); - if (src.hasMaxLengthElement()) - tgt.setMaxLengthElement(convertInteger(src.getMaxLengthElement())); - 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.hasMustSupportElement()) - tgt.setMustSupportElement(convertBoolean(src.getMustSupportElement())); - if (src.hasIsModifierElement()) - tgt.setIsModifierElement(convertBoolean(src.getIsModifierElement())); - if (src.hasIsSummaryElement()) - tgt.setIsSummaryElement(convertBoolean(src.getIsSummaryElement())); - 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.Enumeration convertPropertyRepresentation(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentationEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case XMLATTR: - tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLATTR); - break; - default: - tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.NULL); - break; - } - return tgt; - } - - static public org.hl7.fhir.dstu2.model.Enumeration convertPropertyRepresentation(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentationEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case XMLATTR: - tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation.XMLATTR); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation.NULL); - break; - } - return tgt; - } - - 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())); - if (src.hasDescriptionElement()) - tgt.setDescriptionElement(convertString(src.getDescriptionElement())); - if (src.hasOrderedElement()) - tgt.setOrderedElement(convertBoolean(src.getOrderedElement())); - if (src.hasRules()) - tgt.setRulesElement(convertSlicingRules(src.getRulesElement())); - return tgt; - } - - 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)); - if (src.hasDescriptionElement()) - tgt.setDescriptionElement(convertString(src.getDescriptionElement())); - if (src.hasOrderedElement()) - tgt.setOrderedElement(convertBoolean(src.getOrderedElement())); - if (src.hasRules()) - tgt.setRulesElement(convertSlicingRules(src.getRulesElement())); - return tgt; - } - - static public org.hl7.fhir.dstu3.model.Enumeration convertSlicingRules(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRulesEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case CLOSED: - tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.CLOSED); - break; - case OPEN: - tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPEN); - break; - case OPENATEND: - tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPENATEND); - break; - default: - tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.NULL); - break; - } - return tgt; - } - - static public org.hl7.fhir.dstu2.model.Enumeration convertSlicingRules(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRulesEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case CLOSED: - tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.CLOSED); - break; - case OPEN: - tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.OPEN); - break; - case OPENATEND: - tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.OPENATEND); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.NULL); - break; - } - return tgt; - } - - 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); - if (src.hasPathElement()) - tgt.setPathElement(convertString(src.getPathElement())); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMaxElement()) - tgt.setMaxElement(convertString(src.getMaxElement())); - return tgt; - } - - 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); - if (src.hasPathElement()) - tgt.setPathElement(convertString(src.getPathElement())); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMaxElement()) - tgt.setMaxElement(convertString(src.getMaxElement())); - return tgt; - } - - 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); - if (src.hasCodeElement()) - 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()); - tgt.setAggregation(src.getAggregation().stream() - .map(VersionConvertor_10_30::convertAggregationMode) - .collect(Collectors.toList())); - return tgt; - } - - 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); - if (src.hasCodeElement()) - tgt.setCodeElement(convertUriToCode(src.getCodeElement())); - if (src.hasTarget()) { - if (src.hasTargetProfile()) - tgt.addProfile(src.getTargetProfile()); - } else if (src.hasProfile()) - tgt.addProfile(src.getProfile()); - tgt.setAggregation(src.getAggregation().stream() - .map(VersionConvertor_10_30::convertAggregationMode) - .collect(Collectors.toList())); - return tgt; - } - - static public org.hl7.fhir.dstu3.model.Enumeration convertAggregationMode(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ElementDefinition.AggregationModeEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case CONTAINED: - tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.CONTAINED); - break; - case REFERENCED: - tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.REFERENCED); - break; - case BUNDLED: - tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.BUNDLED); - break; - default: - tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.NULL); - break; - } - return tgt; - } - - static public org.hl7.fhir.dstu2.model.Enumeration convertAggregationMode(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ElementDefinition.AggregationModeEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case CONTAINED: - tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.CONTAINED); - break; - case REFERENCED: - tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.REFERENCED); - break; - case BUNDLED: - tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.BUNDLED); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.NULL); - break; - } - 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); - if (src.hasKeyElement()) - tgt.setKeyElement(convertId(src.getKeyElement())); - if (src.hasRequirementsElement()) - tgt.setRequirementsElement(convertString(src.getRequirementsElement())); - if (src.hasSeverity()) - tgt.setSeverityElement(convertConstraintSeverity(src.getSeverityElement())); - if (src.hasHumanElement()) - tgt.setHumanElement(convertString(src.getHumanElement())); - tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); - if (src.hasXpathElement()) - tgt.setXpathElement(convertString(src.getXpathElement())); - 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); - if (src.hasKeyElement()) - tgt.setKeyElement(convertId(src.getKeyElement())); - if (src.hasRequirementsElement()) - tgt.setRequirementsElement(convertString(src.getRequirementsElement())); - if (src.hasSeverity()) - tgt.setSeverityElement(convertConstraintSeverity(src.getSeverityElement())); - if (src.hasHumanElement()) - tgt.setHumanElement(convertString(src.getHumanElement())); - if (src.hasExpression()) - ToolingExtensions.addStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); - if (src.hasXpathElement()) - tgt.setXpathElement(convertString(src.getXpathElement())); - return tgt; - } - - static public org.hl7.fhir.dstu3.model.Enumeration convertConstraintSeverity(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverityEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case ERROR: - tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.ERROR); - break; - case WARNING: - tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.WARNING); - break; - default: - tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.NULL); - break; - } - return tgt; - } - - static public org.hl7.fhir.dstu2.model.Enumeration convertConstraintSeverity(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverityEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case ERROR: - tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.ERROR); - break; - case WARNING: - tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.WARNING); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.NULL); - break; - } - return tgt; - } - - 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); - if (src.hasStrength()) - tgt.setStrengthElement(convertBindingStrength(src.getStrengthElement())); - if (src.hasDescriptionElement()) - tgt.setDescriptionElement(convertString(src.getDescriptionElement())); - if (src.hasValueSet()) - 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); - if (src.hasStrength()) - tgt.setStrengthElement(convertBindingStrength(src.getStrengthElement())); - if (src.hasDescriptionElement()) - tgt.setDescriptionElement(convertString(src.getDescriptionElement())); - if (src.hasValueSet()) - tgt.setValueSet(convertType(src.getValueSet())); - return tgt; - } - - static public org.hl7.fhir.dstu3.model.Enumeration convertBindingStrength(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Enumerations.BindingStrengthEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case REQUIRED: - tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.REQUIRED); - break; - case EXTENSIBLE: - tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXTENSIBLE); - break; - case PREFERRED: - tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.PREFERRED); - break; - case EXAMPLE: - tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXAMPLE); - break; - default: - tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.NULL); - break; - } - return tgt; - } - - static public org.hl7.fhir.dstu2.model.Enumeration convertBindingStrength(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Enumerations.BindingStrengthEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case REQUIRED: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.REQUIRED); - break; - case EXTENSIBLE: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.EXTENSIBLE); - break; - case PREFERRED: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.PREFERRED); - break; - case EXAMPLE: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.EXAMPLE); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.NULL); - break; - } - return tgt; - } - - 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); - if (src.hasIdentityElement()) - tgt.setIdentityElement(convertId(src.getIdentityElement())); - if (src.hasLanguageElement()) - tgt.setLanguageElement(convertCode(src.getLanguageElement())); - if (src.hasMapElement()) - tgt.setMapElement(convertString(src.getMapElement())); - 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); - if (src.hasIdentityElement()) - tgt.setIdentityElement(convertId(src.getIdentityElement())); - if (src.hasLanguageElement()) - tgt.setLanguageElement(convertCode(src.getLanguageElement())); - if (src.hasMapElement()) - tgt.setMapElement(convertString(src.getMapElement())); - 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); - if (src.hasUse()) - tgt.setUseElement(convertNameUse(src.getUseElement())); - if (src.hasTextElement()) - tgt.setTextElement(convertString(src.getTextElement())); - 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()); - if (src.hasPeriod()) - 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); - if (src.hasUse()) - tgt.setUseElement(convertNameUse(src.getUseElement())); - if (src.hasTextElement()) - tgt.setTextElement(convertString(src.getTextElement())); - 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()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - static public org.hl7.fhir.dstu3.model.Enumeration convertNameUse(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.HumanName.NameUseEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case USUAL: - tgt.setValue(org.hl7.fhir.dstu3.model.HumanName.NameUse.USUAL); - break; - case OFFICIAL: - tgt.setValue(org.hl7.fhir.dstu3.model.HumanName.NameUse.OFFICIAL); - break; - case TEMP: - tgt.setValue(org.hl7.fhir.dstu3.model.HumanName.NameUse.TEMP); - break; - case NICKNAME: - tgt.setValue(org.hl7.fhir.dstu3.model.HumanName.NameUse.NICKNAME); - break; - case ANONYMOUS: - tgt.setValue(org.hl7.fhir.dstu3.model.HumanName.NameUse.ANONYMOUS); - break; - case OLD: - tgt.setValue(org.hl7.fhir.dstu3.model.HumanName.NameUse.OLD); - break; - case MAIDEN: - tgt.setValue(org.hl7.fhir.dstu3.model.HumanName.NameUse.MAIDEN); - break; - default: - tgt.setValue(org.hl7.fhir.dstu3.model.HumanName.NameUse.NULL); - break; - } - return tgt; - } - - static public org.hl7.fhir.dstu2.model.Enumeration convertNameUse(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.HumanName.NameUseEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case USUAL: - tgt.setValue(org.hl7.fhir.dstu2.model.HumanName.NameUse.USUAL); - break; - case OFFICIAL: - tgt.setValue(org.hl7.fhir.dstu2.model.HumanName.NameUse.OFFICIAL); - break; - case TEMP: - tgt.setValue(org.hl7.fhir.dstu2.model.HumanName.NameUse.TEMP); - break; - case NICKNAME: - tgt.setValue(org.hl7.fhir.dstu2.model.HumanName.NameUse.NICKNAME); - break; - case ANONYMOUS: - tgt.setValue(org.hl7.fhir.dstu2.model.HumanName.NameUse.ANONYMOUS); - break; - case OLD: - tgt.setValue(org.hl7.fhir.dstu2.model.HumanName.NameUse.OLD); - break; - case MAIDEN: - tgt.setValue(org.hl7.fhir.dstu2.model.HumanName.NameUse.MAIDEN); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.HumanName.NameUse.NULL); - break; - } - return tgt; - } - - 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); - if (src.hasVersionIdElement()) - tgt.setVersionIdElement(convertId(src.getVersionIdElement())); - if (src.hasLastUpdatedElement()) - tgt.setLastUpdatedElement(convertInstant(src.getLastUpdatedElement())); - 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); - if (src.hasVersionIdElement()) - tgt.setVersionIdElement(convertId(src.getVersionIdElement())); - if (src.hasLastUpdatedElement()) - 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.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()); - if (src.hasRepeat()) - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - if (src.hasCode()) - 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()); - 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.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); - if (src.hasBounds()) - tgt.setBounds(convertType(src.getBounds())); - if (src.hasCountElement()) - tgt.setCountElement(convertInteger(src.getCountElement())); - if (src.hasDurationElement()) - tgt.setDurationElement(convertDecimal(src.getDurationElement())); - if (src.hasDurationMaxElement()) - tgt.setDurationMaxElement(convertDecimal(src.getDurationMaxElement())); - if (src.hasDurationUnits()) - tgt.setDurationUnitElement(convertUnitsOfTime(src.getDurationUnitsElement())); - if (src.hasFrequencyElement()) - tgt.setFrequencyElement(convertInteger(src.getFrequencyElement())); - if (src.hasFrequencyMaxElement()) - tgt.setFrequencyMaxElement(convertInteger(src.getFrequencyMaxElement())); - if (src.hasPeriodElement()) - tgt.setPeriodElement(convertDecimal(src.getPeriodElement())); - if (src.hasPeriodMaxElement()) - tgt.setPeriodMaxElement(convertDecimal(src.getPeriodMaxElement())); - if (src.hasPeriodUnits()) - tgt.setPeriodUnitElement(convertUnitsOfTime(src.getPeriodUnitsElement())); - tgt.setWhen(Collections.singletonList(convertEventTiming(src.getWhenElement()))); - 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); - if (src.hasBounds()) - tgt.setBounds(convertType(src.getBounds())); - if (src.hasCountElement()) - tgt.setCountElement(convertInteger(src.getCountElement())); - if (src.hasDurationElement()) - tgt.setDurationElement(convertDecimal(src.getDurationElement())); - if (src.hasDurationMaxElement()) - tgt.setDurationMaxElement(convertDecimal(src.getDurationMaxElement())); - if (src.hasDurationUnit()) - tgt.setDurationUnitsElement(convertUnitsOfTime(src.getDurationUnitElement())); - if (src.hasFrequencyElement()) - tgt.setFrequencyElement(convertInteger(src.getFrequencyElement())); - if (src.hasFrequencyMaxElement()) - tgt.setFrequencyMaxElement(convertInteger(src.getFrequencyMaxElement())); - if (src.hasPeriodElement()) - tgt.setPeriodElement(convertDecimal(src.getPeriodElement())); - if (src.hasPeriodMaxElement()) - tgt.setPeriodMaxElement(convertDecimal(src.getPeriodMaxElement())); - if (src.hasPeriodUnit()) - tgt.setPeriodUnitsElement(convertUnitsOfTime(src.getPeriodUnitElement())); - if (src.hasWhen()) - tgt.setWhenElement(convertEventTiming(src.getWhen().get(0))); - return tgt; - } - - static public org.hl7.fhir.dstu3.model.Enumeration convertUnitsOfTime(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Timing.UnitsOfTimeEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case S: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.S); - break; - case MIN: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MIN); - break; - case H: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.H); - break; - case D: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.D); - break; - case WK: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.WK); - break; - case MO: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MO); - break; - case A: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.A); - break; - default: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.NULL); - break; - } - return tgt; - } - - static public org.hl7.fhir.dstu2.model.Enumeration convertUnitsOfTime(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Timing.UnitsOfTimeEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case S: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.S); - break; - case MIN: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.MIN); - break; - case H: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.H); - break; - case D: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.D); - break; - case WK: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.WK); - break; - case MO: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.MO); - break; - case A: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.A); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.NULL); - break; - } - return tgt; - } - - static public org.hl7.fhir.dstu3.model.Enumeration convertEventTiming(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Timing.EventTimingEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case HS: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.HS); - break; - case WAKE: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.WAKE); - break; - case C: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.C); - break; - case CM: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.CM); - break; - case CD: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.CD); - break; - case CV: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.CV); - break; - case AC: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.AC); - break; - case ACM: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.ACM); - break; - case ACD: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.ACD); - break; - case ACV: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.ACV); - break; - case PC: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.PC); - break; - case PCM: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.PCM); - break; - case PCD: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.PCD); - break; - case PCV: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.PCV); - break; - default: - tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.NULL); - break; - } - return tgt; - } - - static public org.hl7.fhir.dstu2.model.Enumeration convertEventTiming(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Timing.EventTimingEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case HS: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.HS); - break; - case WAKE: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.WAKE); - break; - case C: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.C); - break; - case CM: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.CM); - break; - case CD: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.CD); - break; - case CV: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.CV); - break; - case AC: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.AC); - break; - case ACM: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.ACM); - break; - case ACD: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.ACD); - break; - case ACV: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.ACV); - break; - case PC: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.PC); - break; - case PCM: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.PCM); - break; - case PCD: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.PCD); - break; - case PCV: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.PCV); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.NULL); - break; - } - return tgt; - } - - 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); - if (src.hasValueElement()) - tgt.setValueElement(convertDecimal(src.getValueElement())); - if (src.hasComparator()) - tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); - if (src.hasUnitElement()) - tgt.setUnitElement(convertString(src.getUnitElement())); - if (src.hasSystemElement()) - tgt.setSystemElement(convertUri(src.getSystemElement())); - if (src.hasCodeElement()) - tgt.setCodeElement(convertCode(src.getCodeElement())); - 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); - if (src.hasValueElement()) - tgt.setValueElement(convertDecimal(src.getValueElement())); - if (src.hasComparator()) - tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); - if (src.hasUnitElement()) - tgt.setUnitElement(convertString(src.getUnitElement())); - if (src.hasSystemElement()) - tgt.setSystemElement(convertUri(src.getSystemElement())); - if (src.hasCodeElement()) - tgt.setCodeElement(convertCode(src.getCodeElement())); - 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); - if (src.hasValueElement()) - tgt.setValueElement(convertDecimal(src.getValueElement())); - if (src.hasComparator()) - tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); - if (src.hasUnitElement()) - tgt.setUnitElement(convertString(src.getUnitElement())); - if (src.hasSystemElement()) - tgt.setSystemElement(convertUri(src.getSystemElement())); - if (src.hasCodeElement()) - tgt.setCodeElement(convertCode(src.getCodeElement())); - 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); - if (src.hasValueElement()) - tgt.setValueElement(convertDecimal(src.getValueElement())); - if (src.hasComparator()) - tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); - if (src.hasUnitElement()) - tgt.setUnitElement(convertString(src.getUnitElement())); - if (src.hasSystemElement()) - tgt.setSystemElement(convertUri(src.getSystemElement())); - if (src.hasCodeElement()) - tgt.setCodeElement(convertCode(src.getCodeElement())); - 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); - if (src.hasValueElement()) - tgt.setValueElement(convertDecimal(src.getValueElement())); - if (src.hasComparator()) - tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); - if (src.hasUnitElement()) - tgt.setUnitElement(convertString(src.getUnitElement())); - if (src.hasSystemElement()) - tgt.setSystemElement(convertUri(src.getSystemElement())); - if (src.hasCodeElement()) - tgt.setCodeElement(convertCode(src.getCodeElement())); - 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); - if (src.hasValueElement()) - tgt.setValueElement(convertDecimal(src.getValueElement())); - if (src.hasComparator()) - tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); - if (src.hasUnitElement()) - tgt.setUnitElement(convertString(src.getUnitElement())); - if (src.hasSystemElement()) - tgt.setSystemElement(convertUri(src.getSystemElement())); - if (src.hasCodeElement()) - tgt.setCodeElement(convertCode(src.getCodeElement())); - 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); - if (src.hasValueElement()) - tgt.setValueElement(convertDecimal(src.getValueElement())); - if (src.hasComparator()) - tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); - if (src.hasUnitElement()) - tgt.setUnitElement(convertString(src.getUnitElement())); - if (src.hasSystemElement()) - tgt.setSystemElement(convertUri(src.getSystemElement())); - if (src.hasCodeElement()) - tgt.setCodeElement(convertCode(src.getCodeElement())); - 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); - if (src.hasValueElement()) - tgt.setValueElement(convertDecimal(src.getValueElement())); - if (src.hasComparator()) - tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); - if (src.hasUnitElement()) - tgt.setUnitElement(convertString(src.getUnitElement())); - if (src.hasSystemElement()) - tgt.setSystemElement(convertUri(src.getSystemElement())); - if (src.hasCodeElement()) - tgt.setCodeElement(convertCode(src.getCodeElement())); - 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); - if (src.hasValueElement()) - tgt.setValueElement(convertDecimal(src.getValueElement())); - if (src.hasComparator()) - tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); - if (src.hasUnitElement()) - tgt.setUnitElement(convertString(src.getUnitElement())); - if (src.hasSystemElement()) - tgt.setSystemElement(convertUri(src.getSystemElement())); - if (src.hasCodeElement()) - tgt.setCodeElement(convertCode(src.getCodeElement())); - 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); - if (src.hasValueElement()) - tgt.setValueElement(convertDecimal(src.getValueElement())); - if (src.hasComparator()) - tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); - if (src.hasUnitElement()) - tgt.setUnitElement(convertString(src.getUnitElement())); - if (src.hasSystemElement()) - tgt.setSystemElement(convertUri(src.getSystemElement())); - if (src.hasCodeElement()) - tgt.setCodeElement(convertCode(src.getCodeElement())); - 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); - if (src.hasValueElement()) - tgt.setValueElement(convertDecimal(src.getValueElement())); - if (src.hasComparator()) - tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); - if (src.hasUnitElement()) - tgt.setUnitElement(convertString(src.getUnitElement())); - if (src.hasSystemElement()) - tgt.setSystemElement(convertUri(src.getSystemElement())); - if (src.hasCodeElement()) - tgt.setCodeElement(convertCode(src.getCodeElement())); - 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); - if (src.hasValueElement()) - tgt.setValueElement(convertDecimal(src.getValueElement())); - if (src.hasComparator()) - tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); - if (src.hasUnitElement()) - tgt.setUnitElement(convertString(src.getUnitElement())); - if (src.hasSystemElement()) - tgt.setSystemElement(convertUri(src.getSystemElement())); - if (src.hasCodeElement()) - tgt.setCodeElement(convertCode(src.getCodeElement())); - 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.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.dstu2.model.PositiveIntType) 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.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.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.UuidType) - return convertUuid((org.hl7.fhir.dstu2.model.UuidType) 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.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.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); - 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); - 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.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.dstu3.model.PositiveIntType) 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.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.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.UuidType) - return convertUuid((org.hl7.fhir.dstu3.model.UuidType) 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.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.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); - 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()); - } - - 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()); - } - - static public org.hl7.fhir.dstu3.model.Enumeration convertAdministrativeGender(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGenderEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case MALE: - tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.MALE); - break; - case FEMALE: - tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.FEMALE); - break; - case OTHER: - tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.OTHER); - break; - case UNKNOWN: - tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.UNKNOWN); - break; - default: - tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.NULL); - break; - } - return tgt; - } - - static public org.hl7.fhir.dstu2.model.Enumeration convertAdministrativeGender(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGenderEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case MALE: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.MALE); - break; - case FEMALE: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.FEMALE); - break; - case OTHER: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.OTHER); - break; - case UNKNOWN: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.UNKNOWN); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.NULL); - break; - } - return tgt; - } - - static public org.hl7.fhir.dstu3.model.Enumeration convertSearchParamType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Enumerations.SearchParamTypeEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - tgt.setValue(convertSearchParamType(src.getValue())); - return tgt; - } - - static public org.hl7.fhir.dstu3.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType src) throws FHIRException { - switch(src) { + 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)); + } + } + + 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 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 static org.hl7.fhir.dstu3.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu2.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.dstu3.model.Base64BinaryType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.Base64BinaryType(src.getValue()) : new org.hl7.fhir.dstu3.model.Base64BinaryType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu2.model.Base64BinaryType(src.getValue()) : new org.hl7.fhir.dstu2.model.Base64BinaryType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu3.model.BooleanType(src.getValue()) : new org.hl7.fhir.dstu3.model.BooleanType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu2.model.BooleanType(src.getValue()) : new org.hl7.fhir.dstu2.model.BooleanType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu3.model.CodeType(src.getValue()) : new org.hl7.fhir.dstu3.model.CodeType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu2.model.CodeType(src.getValue()) : new org.hl7.fhir.dstu2.model.CodeType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu3.model.UriType(src.getValue()) : new org.hl7.fhir.dstu3.model.UriType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu2.model.CodeType(src.getValue()) : new org.hl7.fhir.dstu2.model.CodeType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu3.model.DateType(src.getValueAsString()) : new org.hl7.fhir.dstu3.model.DateType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu3.model.DateType(src.getValueAsString()) : new org.hl7.fhir.dstu3.model.DateType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()) : new org.hl7.fhir.dstu2.model.DateType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()) : new org.hl7.fhir.dstu2.model.DateType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu3.model.DateTimeType(src.getValueAsString()) : new org.hl7.fhir.dstu3.model.DateTimeType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu2.model.DateTimeType(src.getValueAsString()) : new org.hl7.fhir.dstu2.model.DateTimeType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu3.model.DecimalType(src.getValue()) : new org.hl7.fhir.dstu3.model.DecimalType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu2.model.DecimalType(src.getValue()) : new org.hl7.fhir.dstu2.model.DecimalType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu3.model.IdType(src.getValue()) : new org.hl7.fhir.dstu3.model.IdType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu2.model.IdType(src.getValue()) : new org.hl7.fhir.dstu2.model.IdType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu3.model.InstantType(src.getValueAsString()) : new org.hl7.fhir.dstu3.model.InstantType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu2.model.InstantType(src.getValueAsString()) : new org.hl7.fhir.dstu2.model.InstantType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu3.model.IntegerType(src.getValue()) : new org.hl7.fhir.dstu3.model.IntegerType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu2.model.IntegerType(src.getValue()) : new org.hl7.fhir.dstu2.model.IntegerType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu3.model.MarkdownType(src.getValue()) : new org.hl7.fhir.dstu3.model.MarkdownType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu2.model.MarkdownType(src.getValue()) : new org.hl7.fhir.dstu2.model.MarkdownType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu3.model.OidType(src.getValue()) : new org.hl7.fhir.dstu3.model.OidType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu2.model.OidType(src.getValue()) : new org.hl7.fhir.dstu2.model.OidType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu3.model.PositiveIntType(src.getValue()) : new org.hl7.fhir.dstu3.model.PositiveIntType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu2.model.PositiveIntType(src.getValue()) : new org.hl7.fhir.dstu2.model.PositiveIntType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu3.model.StringType(src.getValue()) : new org.hl7.fhir.dstu3.model.StringType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu2.model.StringType(src.getValue()) : new org.hl7.fhir.dstu2.model.StringType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu3.model.TimeType(src.getValue()) : new org.hl7.fhir.dstu3.model.TimeType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu2.model.TimeType(src.getValue()) : new org.hl7.fhir.dstu2.model.TimeType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu3.model.UnsignedIntType(src.getValue()) : new org.hl7.fhir.dstu3.model.UnsignedIntType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu2.model.UnsignedIntType(src.getValue()) : new org.hl7.fhir.dstu2.model.UnsignedIntType(); + copyElement(src, tgt); + return tgt; + } + + 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 = src.hasValue() ? new org.hl7.fhir.dstu3.model.UriType(src.getValue()) : new org.hl7.fhir.dstu3.model.UriType(); + 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 = src.hasValue() ? new org.hl7.fhir.dstu2.model.UriType(src.getValue()) : new org.hl7.fhir.dstu2.model.UriType(); + 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 = src.hasValue() ? new org.hl7.fhir.dstu3.model.UuidType(src.getValue()) : new org.hl7.fhir.dstu3.model.UuidType(); + 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 = src.hasValue() ? new org.hl7.fhir.dstu2.model.UuidType(src.getValue()) : new org.hl7.fhir.dstu2.model.UuidType(); + 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); + if (src.hasUrlElement()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasValue()) + 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); + if (src.hasUrlElement()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasValue()) + 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); + if (src.hasStatus()) + tgt.setStatusElement(convertNarrativeStatus(src.getStatusElement())); + if (src.hasDiv()) + 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); + if (src.hasStatus()) + tgt.setStatusElement(convertNarrativeStatus(src.getStatusElement())); + tgt.setDiv(src.getDiv()); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumeration convertNarrativeStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Narrative.NarrativeStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case GENERATED: + tgt.setValue(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED); + break; + case EXTENSIONS: + tgt.setValue(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EXTENSIONS); + break; + case ADDITIONAL: + tgt.setValue(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.ADDITIONAL); + break; + case EMPTY: + tgt.setValue(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EMPTY); + break; + default: + tgt.setValue(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.NULL); + break; + } + return tgt; + } + + static public org.hl7.fhir.dstu2.model.Enumeration convertNarrativeStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Narrative.NarrativeStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case GENERATED: + tgt.setValue(org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.GENERATED); + break; + case EXTENSIONS: + tgt.setValue(org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.EXTENSIONS); + break; + case ADDITIONAL: + tgt.setValue(org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.ADDITIONAL); + break; + case EMPTY: + tgt.setValue(org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.EMPTY); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.NULL); + break; + } + return tgt; + } + + 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); + if (src.hasAuthor()) + tgt.setAuthor(convertType(src.getAuthor())); + if (src.hasTimeElement()) + tgt.setTimeElement(convertDateTime(src.getTimeElement())); + if (src.hasTextElement()) + tgt.setTextElement(convertString(src.getTextElement())); + 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); + if (src.hasAuthor()) + tgt.setAuthor(convertType(src.getAuthor())); + if (src.hasTimeElement()) + tgt.setTimeElement(convertDateTime(src.getTimeElement())); + if (src.hasTextElement()) + tgt.setTextElement(convertString(src.getTextElement())); + 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); + if (src.hasContentTypeElement()) + tgt.setContentTypeElement(convertCode(src.getContentTypeElement())); + if (src.hasLanguageElement()) + tgt.setLanguageElement(convertCode(src.getLanguageElement())); + if (src.hasDataElement()) + tgt.setDataElement(convertBase64Binary(src.getDataElement())); + if (src.hasUrlElement()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasSizeElement()) + tgt.setSizeElement(convertUnsignedInt(src.getSizeElement())); + if (src.hasHashElement()) + tgt.setHashElement(convertBase64Binary(src.getHashElement())); + if (src.hasTitleElement()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasCreationElement()) + tgt.setCreationElement(convertDateTime(src.getCreationElement())); + 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); + if (src.hasContentTypeElement()) + tgt.setContentTypeElement(convertCode(src.getContentTypeElement())); + if (src.hasLanguageElement()) + tgt.setLanguageElement(convertCode(src.getLanguageElement())); + if (src.hasDataElement()) + tgt.setDataElement(convertBase64Binary(src.getDataElement())); + if (src.hasUrlElement()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasSizeElement()) + tgt.setSizeElement(convertUnsignedInt(src.getSizeElement())); + if (src.hasHashElement()) + tgt.setHashElement(convertBase64Binary(src.getHashElement())); + if (src.hasTitleElement()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasCreationElement()) + tgt.setCreationElement(convertDateTime(src.getCreationElement())); + 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)); + if (src.hasTextElement()) + tgt.setTextElement(convertString(src.getTextElement())); + 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)); + if (src.hasTextElement()) + tgt.setTextElement(convertString(src.getTextElement())); + 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); + if (src.hasSystemElement()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasVersionElement()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasCodeElement()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasDisplayElement()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + if (src.hasUserSelectedElement()) + tgt.setUserSelectedElement(convertBoolean(src.getUserSelectedElement())); + 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); + if (src.hasSystemElement()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasVersionElement()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasCodeElement()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasDisplayElement()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + if (src.hasUserSelectedElement()) + tgt.setUserSelectedElement(convertBoolean(src.getUserSelectedElement())); + 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); + if (src.hasUse()) + tgt.setUseElement(convertIdentifierUse(src.getUseElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystemElement()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasValueElement()) + tgt.setValueElement(convertString(src.getValueElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasAssigner()) + 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.setUseElement(convertIdentifierUse(src.getUseElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasAssigner()) + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumeration convertIdentifierUse(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Identifier.IdentifierUseEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case USUAL: + tgt.setValue(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.USUAL); + break; + case OFFICIAL: + tgt.setValue(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.OFFICIAL); + break; + case TEMP: + tgt.setValue(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.TEMP); + break; + case SECONDARY: + tgt.setValue(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.SECONDARY); + break; + default: + tgt.setValue(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.NULL); + break; + } + return tgt; + } + + static public org.hl7.fhir.dstu2.model.Enumeration convertIdentifierUse(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Identifier.IdentifierUseEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case USUAL: + tgt.setValue(org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.USUAL); + break; + case OFFICIAL: + tgt.setValue(org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.OFFICIAL); + break; + case TEMP: + tgt.setValue(org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.TEMP); + break; + case SECONDARY: + tgt.setValue(org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.SECONDARY); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.NULL); + break; + } + return tgt; + } + + 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); + if (src.hasStartElement()) + tgt.setStartElement(convertDateTime(src.getStartElement())); + if (src.hasEndElement()) + tgt.setEndElement(convertDateTime(src.getEndElement())); + 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); + if (src.hasStartElement()) + tgt.setStartElement(convertDateTime(src.getStartElement())); + if (src.hasEndElement()) + tgt.setEndElement(convertDateTime(src.getEndElement())); + 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); + if (src.hasValueElement()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasComparator()) + tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); + if (src.hasUnitElement()) + tgt.setUnitElement(convertString(src.getUnitElement())); + if (src.hasSystemElement()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasCodeElement()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + 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); + if (src.hasValueElement()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasComparator()) + tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); + if (src.hasUnitElement()) + tgt.setUnitElement(convertString(src.getUnitElement())); + if (src.hasSystemElement()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasCodeElement()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumeration convertQuantityComparator(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Quantity.QuantityComparatorEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case LESS_THAN: + tgt.setValue(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_THAN); + break; + case LESS_OR_EQUAL: + tgt.setValue(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_OR_EQUAL); + break; + case GREATER_OR_EQUAL: + tgt.setValue(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_OR_EQUAL); + break; + case GREATER_THAN: + tgt.setValue(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_THAN); + break; + default: + tgt.setValue(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.NULL); + break; + } + return tgt; + } + + static public org.hl7.fhir.dstu2.model.Enumeration convertQuantityComparator(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Quantity.QuantityComparatorEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case LESS_THAN: + tgt.setValue(org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.LESS_THAN); + break; + case LESS_OR_EQUAL: + tgt.setValue(org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.LESS_OR_EQUAL); + break; + case GREATER_OR_EQUAL: + tgt.setValue(org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.GREATER_OR_EQUAL); + break; + case GREATER_THAN: + tgt.setValue(org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.GREATER_THAN); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.NULL); + break; + } + return tgt; + } + + 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); + if (src.hasLow()) + tgt.setLow(convertSimpleQuantity(src.getLow())); + if (src.hasHigh()) + 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); + 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.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); + if (src.hasNumerator()) + tgt.setNumerator(convertQuantity(src.getNumerator())); + if (src.hasDenominator()) + 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); + 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.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); + if (src.hasReference()) + tgt.setReference(src.getReference()); + if (src.hasDisplayElement()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + 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); + if (src.hasReference()) + tgt.setReference(src.getReference()); + if (src.hasDisplayElement()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + 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); + if (src.hasOrigin()) + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + if (src.hasPeriodElement()) + tgt.setPeriodElement(convertDecimal(src.getPeriodElement())); + if (src.hasFactorElement()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasLowerLimitElement()) + tgt.setLowerLimitElement(convertDecimal(src.getLowerLimitElement())); + if (src.hasUpperLimitElement()) + tgt.setUpperLimitElement(convertDecimal(src.getUpperLimitElement())); + if (src.hasDimensionsElement()) + tgt.setDimensionsElement(convertPositiveInt(src.getDimensionsElement())); + if (src.hasDataElement()) + tgt.setDataElement(convertString(src.getDataElement())); + 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); + if (src.hasOrigin()) + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + if (src.hasPeriodElement()) + tgt.setPeriodElement(convertDecimal(src.getPeriodElement())); + if (src.hasFactorElement()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasLowerLimitElement()) + tgt.setLowerLimitElement(convertDecimal(src.getLowerLimitElement())); + if (src.hasUpperLimitElement()) + tgt.setUpperLimitElement(convertDecimal(src.getUpperLimitElement())); + if (src.hasDimensionsElement()) + tgt.setDimensionsElement(convertPositiveInt(src.getDimensionsElement())); + if (src.hasDataElement()) + tgt.setDataElement(convertString(src.getDataElement())); + 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)); + if (src.hasWhenElement()) + tgt.setWhenElement(convertInstant(src.getWhenElement())); + if (src.hasWho()) + tgt.setWho(convertType(src.getWho())); + if (src.hasContentTypeElement()) + tgt.setContentTypeElement(convertCode(src.getContentTypeElement())); + if (src.hasBlobElement()) + tgt.setBlobElement(convertBase64Binary(src.getBlobElement())); + 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)); + if (src.hasWhenElement()) + tgt.setWhenElement(convertInstant(src.getWhenElement())); + if (src.hasWho()) + tgt.setWho(convertType(src.getWho())); + if (src.hasContentTypeElement()) + tgt.setContentTypeElement(convertCode(src.getContentTypeElement())); + if (src.hasBlobElement()) + tgt.setBlobElement(convertBase64Binary(src.getBlobElement())); + 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); + if (src.hasUse()) + tgt.setUseElement(convertAddressUse(src.getUseElement())); + if (src.hasType()) + tgt.setTypeElement(convertAddressType(src.getTypeElement())); + if (src.hasTextElement()) + tgt.setTextElement(convertString(src.getTextElement())); + for (org.hl7.fhir.dstu2.model.StringType t : src.getLine()) tgt.addLine(t.getValue()); + if (src.hasCityElement()) + tgt.setCityElement(convertString(src.getCityElement())); + if (src.hasDistrictElement()) + tgt.setDistrictElement(convertString(src.getDistrictElement())); + if (src.hasStateElement()) + tgt.setStateElement(convertString(src.getStateElement())); + if (src.hasPostalCodeElement()) + tgt.setPostalCodeElement(convertString(src.getPostalCodeElement())); + if (src.hasCountryElement()) + tgt.setCountryElement(convertString(src.getCountryElement())); + if (src.hasPeriod()) + 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); + if (src.hasUse()) + tgt.setUseElement(convertAddressUse(src.getUseElement())); + if (src.hasType()) + tgt.setTypeElement(convertAddressType(src.getTypeElement())); + if (src.hasTextElement()) + tgt.setTextElement(convertString(src.getTextElement())); + for (org.hl7.fhir.dstu3.model.StringType t : src.getLine()) tgt.addLine(t.getValue()); + if (src.hasCityElement()) + tgt.setCityElement(convertString(src.getCityElement())); + if (src.hasDistrictElement()) + tgt.setDistrictElement(convertString(src.getDistrictElement())); + if (src.hasStateElement()) + tgt.setStateElement(convertString(src.getStateElement())); + if (src.hasPostalCodeElement()) + tgt.setPostalCodeElement(convertString(src.getPostalCodeElement())); + if (src.hasCountryElement()) + tgt.setCountryElement(convertString(src.getCountryElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumeration convertAddressUse(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Address.AddressUseEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case HOME: + tgt.setValue(org.hl7.fhir.dstu3.model.Address.AddressUse.HOME); + break; + case WORK: + tgt.setValue(org.hl7.fhir.dstu3.model.Address.AddressUse.WORK); + break; + case TEMP: + tgt.setValue(org.hl7.fhir.dstu3.model.Address.AddressUse.TEMP); + break; + case OLD: + tgt.setValue(org.hl7.fhir.dstu3.model.Address.AddressUse.OLD); + break; + default: + tgt.setValue(org.hl7.fhir.dstu3.model.Address.AddressUse.NULL); + break; + } + return tgt; + } + + static public org.hl7.fhir.dstu2.model.Enumeration convertAddressUse(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Address.AddressUseEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case HOME: + tgt.setValue(org.hl7.fhir.dstu2.model.Address.AddressUse.HOME); + break; + case WORK: + tgt.setValue(org.hl7.fhir.dstu2.model.Address.AddressUse.WORK); + break; + case TEMP: + tgt.setValue(org.hl7.fhir.dstu2.model.Address.AddressUse.TEMP); + break; + case OLD: + tgt.setValue(org.hl7.fhir.dstu2.model.Address.AddressUse.OLD); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.Address.AddressUse.NULL); + break; + } + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumeration convertAddressType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Address.AddressTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case POSTAL: + tgt.setValue(org.hl7.fhir.dstu3.model.Address.AddressType.POSTAL); + break; + case PHYSICAL: + tgt.setValue(org.hl7.fhir.dstu3.model.Address.AddressType.PHYSICAL); + break; + case BOTH: + tgt.setValue(org.hl7.fhir.dstu3.model.Address.AddressType.BOTH); + break; + default: + tgt.setValue(org.hl7.fhir.dstu3.model.Address.AddressType.NULL); + break; + } + return tgt; + } + + static public org.hl7.fhir.dstu2.model.Enumeration convertAddressType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Address.AddressTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case POSTAL: + tgt.setValue(org.hl7.fhir.dstu2.model.Address.AddressType.POSTAL); + break; + case PHYSICAL: + tgt.setValue(org.hl7.fhir.dstu2.model.Address.AddressType.PHYSICAL); + break; + case BOTH: + tgt.setValue(org.hl7.fhir.dstu2.model.Address.AddressType.BOTH); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.Address.AddressType.NULL); + break; + } + return tgt; + } + + 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); + if (src.hasSystem()) + tgt.setSystemElement(convertContactPointSystem(src.getSystemElement())); + if (src.hasValueElement()) + tgt.setValueElement(convertString(src.getValueElement())); + if (src.hasUse()) + tgt.setUseElement(convertContactPointUse(src.getUseElement())); + if (src.hasRank()) + tgt.setRankElement(convertPositiveInt(src.getRankElement())); + if (src.hasPeriod()) + 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.setSystemElement(convertContactPointSystem(src.getSystemElement())); + if (src.hasValueElement()) + tgt.setValueElement(convertString(src.getValueElement())); + if (src.hasUse()) + tgt.setUseElement(convertContactPointUse(src.getUseElement())); + if (src.hasRankElement()) + tgt.setRankElement(convertPositiveInt(src.getRankElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumeration convertContactPointSystem(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystemEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case PHONE: + tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PHONE); + break; + case FAX: + tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.FAX); + break; + case EMAIL: + tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.EMAIL); + break; + case PAGER: + tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PAGER); + break; + case OTHER: + tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.OTHER); + break; + default: + tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.NULL); + break; + } + return tgt; + } + + static public org.hl7.fhir.dstu2.model.Enumeration convertContactPointSystem(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystemEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case PHONE: + tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.PHONE); + break; + case FAX: + tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.FAX); + break; + case EMAIL: + tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.EMAIL); + break; + case PAGER: + tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.PAGER); + break; + case OTHER: + tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.OTHER); + break; + case URL: + tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.OTHER); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.NULL); + break; + } + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumeration convertContactPointUse(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUseEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case HOME: + tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.HOME); + break; + case WORK: + tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.WORK); + break; + case TEMP: + tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.TEMP); + break; + case OLD: + tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.OLD); + break; + case MOBILE: + tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.MOBILE); + break; + default: + tgt.setValue(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.NULL); + break; + } + return tgt; + } + + static public org.hl7.fhir.dstu2.model.Enumeration convertContactPointUse(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUseEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case HOME: + tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.HOME); + break; + case WORK: + tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.WORK); + break; + case TEMP: + tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.TEMP); + break; + case OLD: + tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.OLD); + break; + case MOBILE: + tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.MOBILE); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.NULL); + break; + } + return tgt; + } + + 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); + if (src.hasPathElement()) + tgt.setPathElement(convertString(src.getPathElement())); + tgt.setRepresentation(src.getRepresentation().stream() + .map(VersionConvertor_10_30::convertPropertyRepresentation) + .collect(Collectors.toList())); + if (src.hasName()) { + if (slicePaths.contains(src.getPath())) + tgt.setSliceNameElement(convertString(src.getNameElement())); + if (src.hasNameElement()) + tgt.setIdElement(convertString(src.getNameElement())); + } + if (src.hasLabel()) + tgt.setLabelElement(convertString(src.getLabelElement())); + 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.setShortElement(convertString(src.getShortElement())); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertMarkdown(src.getDefinitionElement())); + if (src.hasComments()) + tgt.setCommentElement(convertMarkdown(src.getCommentsElement())); + if (src.hasRequirements()) + tgt.setRequirementsElement(convertMarkdown(src.getRequirementsElement())); + 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.setMaxElement(convertString(src.getMaxElement())); + 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.setMeaningWhenMissingElement(convertMarkdown(src.getMeaningWhenMissingElement())); + 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.setMaxLengthElement(convertInteger(src.getMaxLengthElement())); + 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.setMustSupportElement(convertBoolean(src.getMustSupportElement())); + if (src.hasIsModifier()) + tgt.setIsModifierElement(convertBoolean(src.getIsModifierElement())); + if (src.hasIsSummary()) + tgt.setIsSummaryElement(convertBoolean(src.getIsSummaryElement())); + 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); + if (src.hasPathElement()) + tgt.setPathElement(convertString(src.getPathElement())); + tgt.setRepresentation(src.getRepresentation().stream() + .map(VersionConvertor_10_30::convertPropertyRepresentation) + .collect(Collectors.toList())); + if (src.hasSliceName()) + tgt.setNameElement(convertString(src.getSliceNameElement())); + else + tgt.setNameElement(convertString(src.getIdElement())); + if (src.hasLabelElement()) + tgt.setLabelElement(convertString(src.getLabelElement())); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + if (src.hasShortElement()) + tgt.setShortElement(convertString(src.getShortElement())); + if (src.hasDefinitionElement()) + tgt.setDefinitionElement(convertMarkdown(src.getDefinitionElement())); + if (src.hasCommentElement()) + tgt.setCommentsElement(convertMarkdown(src.getCommentElement())); + if (src.hasRequirementsElement()) + tgt.setRequirementsElement(convertMarkdown(src.getRequirementsElement())); + for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); + tgt.setMin(src.getMin()); + if (src.hasMaxElement()) + tgt.setMaxElement(convertString(src.getMaxElement())); + 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)); + if (src.hasDefaultValue()) + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissingElement()) + tgt.setMeaningWhenMissingElement(convertMarkdown(src.getMeaningWhenMissingElement())); + if (src.hasFixed()) + tgt.setFixed(convertType(src.getFixed())); + if (src.hasPattern()) + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.setExample(convertType(src.getExampleFirstRep().getValue())); + if (src.hasMinValue()) + tgt.setMinValue(convertType(src.getMinValue())); + if (src.hasMaxValue()) + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLengthElement()) + tgt.setMaxLengthElement(convertInteger(src.getMaxLengthElement())); + 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.hasMustSupportElement()) + tgt.setMustSupportElement(convertBoolean(src.getMustSupportElement())); + if (src.hasIsModifierElement()) + tgt.setIsModifierElement(convertBoolean(src.getIsModifierElement())); + if (src.hasIsSummaryElement()) + tgt.setIsSummaryElement(convertBoolean(src.getIsSummaryElement())); + 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.Enumeration convertPropertyRepresentation(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentationEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case XMLATTR: + tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLATTR); + break; + default: + tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.NULL); + break; + } + return tgt; + } + + static public org.hl7.fhir.dstu2.model.Enumeration convertPropertyRepresentation(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentationEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case XMLATTR: + tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation.XMLATTR); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation.NULL); + break; + } + return tgt; + } + + 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())); + if (src.hasDescriptionElement()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasOrderedElement()) + tgt.setOrderedElement(convertBoolean(src.getOrderedElement())); + if (src.hasRules()) + tgt.setRulesElement(convertSlicingRules(src.getRulesElement())); + return tgt; + } + + 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)); + if (src.hasDescriptionElement()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasOrderedElement()) + tgt.setOrderedElement(convertBoolean(src.getOrderedElement())); + if (src.hasRules()) + tgt.setRulesElement(convertSlicingRules(src.getRulesElement())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumeration convertSlicingRules(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRulesEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case CLOSED: + tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.CLOSED); + break; + case OPEN: + tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPEN); + break; + case OPENATEND: + tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPENATEND); + break; + default: + tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.NULL); + break; + } + return tgt; + } + + static public org.hl7.fhir.dstu2.model.Enumeration convertSlicingRules(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRulesEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case CLOSED: + tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.CLOSED); + break; + case OPEN: + tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.OPEN); + break; + case OPENATEND: + tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.OPENATEND); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.NULL); + break; + } + return tgt; + } + + 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); + if (src.hasPathElement()) + tgt.setPathElement(convertString(src.getPathElement())); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMaxElement()) + tgt.setMaxElement(convertString(src.getMaxElement())); + return tgt; + } + + 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); + if (src.hasPathElement()) + tgt.setPathElement(convertString(src.getPathElement())); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMaxElement()) + tgt.setMaxElement(convertString(src.getMaxElement())); + return tgt; + } + + 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); + if (src.hasCodeElement()) + 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()); + tgt.setAggregation(src.getAggregation().stream() + .map(VersionConvertor_10_30::convertAggregationMode) + .collect(Collectors.toList())); + return tgt; + } + + 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); + if (src.hasCodeElement()) + tgt.setCodeElement(convertUriToCode(src.getCodeElement())); + if (src.hasTarget()) { + if (src.hasTargetProfile()) + tgt.addProfile(src.getTargetProfile()); + } else if (src.hasProfile()) + tgt.addProfile(src.getProfile()); + tgt.setAggregation(src.getAggregation().stream() + .map(VersionConvertor_10_30::convertAggregationMode) + .collect(Collectors.toList())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumeration convertAggregationMode(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ElementDefinition.AggregationModeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case CONTAINED: + tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.CONTAINED); + break; + case REFERENCED: + tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.REFERENCED); + break; + case BUNDLED: + tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.BUNDLED); + break; + default: + tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.NULL); + break; + } + return tgt; + } + + static public org.hl7.fhir.dstu2.model.Enumeration convertAggregationMode(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ElementDefinition.AggregationModeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case CONTAINED: + tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.CONTAINED); + break; + case REFERENCED: + tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.REFERENCED); + break; + case BUNDLED: + tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.BUNDLED); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.NULL); + break; + } + 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); + if (src.hasKeyElement()) + tgt.setKeyElement(convertId(src.getKeyElement())); + if (src.hasRequirementsElement()) + tgt.setRequirementsElement(convertString(src.getRequirementsElement())); + if (src.hasSeverity()) + tgt.setSeverityElement(convertConstraintSeverity(src.getSeverityElement())); + if (src.hasHumanElement()) + tgt.setHumanElement(convertString(src.getHumanElement())); + tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); + if (src.hasXpathElement()) + tgt.setXpathElement(convertString(src.getXpathElement())); + 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); + if (src.hasKeyElement()) + tgt.setKeyElement(convertId(src.getKeyElement())); + if (src.hasRequirementsElement()) + tgt.setRequirementsElement(convertString(src.getRequirementsElement())); + if (src.hasSeverity()) + tgt.setSeverityElement(convertConstraintSeverity(src.getSeverityElement())); + if (src.hasHumanElement()) + tgt.setHumanElement(convertString(src.getHumanElement())); + if (src.hasExpression()) + ToolingExtensions.addStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); + if (src.hasXpathElement()) + tgt.setXpathElement(convertString(src.getXpathElement())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumeration convertConstraintSeverity(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverityEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case ERROR: + tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.ERROR); + break; + case WARNING: + tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.WARNING); + break; + default: + tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.NULL); + break; + } + return tgt; + } + + static public org.hl7.fhir.dstu2.model.Enumeration convertConstraintSeverity(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverityEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case ERROR: + tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.ERROR); + break; + case WARNING: + tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.WARNING); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.NULL); + break; + } + return tgt; + } + + 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); + if (src.hasStrength()) + tgt.setStrengthElement(convertBindingStrength(src.getStrengthElement())); + if (src.hasDescriptionElement()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasValueSet()) + 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); + if (src.hasStrength()) + tgt.setStrengthElement(convertBindingStrength(src.getStrengthElement())); + if (src.hasDescriptionElement()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasValueSet()) + tgt.setValueSet(convertType(src.getValueSet())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumeration convertBindingStrength(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Enumerations.BindingStrengthEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case REQUIRED: + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.REQUIRED); + break; + case EXTENSIBLE: + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXTENSIBLE); + break; + case PREFERRED: + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.PREFERRED); + break; + case EXAMPLE: + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXAMPLE); + break; + default: + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.NULL); + break; + } + return tgt; + } + + static public org.hl7.fhir.dstu2.model.Enumeration convertBindingStrength(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Enumerations.BindingStrengthEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case REQUIRED: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.REQUIRED); + break; + case EXTENSIBLE: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.EXTENSIBLE); + break; + case PREFERRED: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.PREFERRED); + break; + case EXAMPLE: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.EXAMPLE); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.NULL); + break; + } + return tgt; + } + + 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); + if (src.hasIdentityElement()) + tgt.setIdentityElement(convertId(src.getIdentityElement())); + if (src.hasLanguageElement()) + tgt.setLanguageElement(convertCode(src.getLanguageElement())); + if (src.hasMapElement()) + tgt.setMapElement(convertString(src.getMapElement())); + 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); + if (src.hasIdentityElement()) + tgt.setIdentityElement(convertId(src.getIdentityElement())); + if (src.hasLanguageElement()) + tgt.setLanguageElement(convertCode(src.getLanguageElement())); + if (src.hasMapElement()) + tgt.setMapElement(convertString(src.getMapElement())); + 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); + if (src.hasUse()) + tgt.setUseElement(convertNameUse(src.getUseElement())); + if (src.hasTextElement()) + tgt.setTextElement(convertString(src.getTextElement())); + 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()); + if (src.hasPeriod()) + 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); + if (src.hasUse()) + tgt.setUseElement(convertNameUse(src.getUseElement())); + if (src.hasTextElement()) + tgt.setTextElement(convertString(src.getTextElement())); + 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()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumeration convertNameUse(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.HumanName.NameUseEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case USUAL: + tgt.setValue(org.hl7.fhir.dstu3.model.HumanName.NameUse.USUAL); + break; + case OFFICIAL: + tgt.setValue(org.hl7.fhir.dstu3.model.HumanName.NameUse.OFFICIAL); + break; + case TEMP: + tgt.setValue(org.hl7.fhir.dstu3.model.HumanName.NameUse.TEMP); + break; + case NICKNAME: + tgt.setValue(org.hl7.fhir.dstu3.model.HumanName.NameUse.NICKNAME); + break; + case ANONYMOUS: + tgt.setValue(org.hl7.fhir.dstu3.model.HumanName.NameUse.ANONYMOUS); + break; + case OLD: + tgt.setValue(org.hl7.fhir.dstu3.model.HumanName.NameUse.OLD); + break; + case MAIDEN: + tgt.setValue(org.hl7.fhir.dstu3.model.HumanName.NameUse.MAIDEN); + break; + default: + tgt.setValue(org.hl7.fhir.dstu3.model.HumanName.NameUse.NULL); + break; + } + return tgt; + } + + static public org.hl7.fhir.dstu2.model.Enumeration convertNameUse(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.HumanName.NameUseEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case USUAL: + tgt.setValue(org.hl7.fhir.dstu2.model.HumanName.NameUse.USUAL); + break; + case OFFICIAL: + tgt.setValue(org.hl7.fhir.dstu2.model.HumanName.NameUse.OFFICIAL); + break; + case TEMP: + tgt.setValue(org.hl7.fhir.dstu2.model.HumanName.NameUse.TEMP); + break; + case NICKNAME: + tgt.setValue(org.hl7.fhir.dstu2.model.HumanName.NameUse.NICKNAME); + break; + case ANONYMOUS: + tgt.setValue(org.hl7.fhir.dstu2.model.HumanName.NameUse.ANONYMOUS); + break; + case OLD: + tgt.setValue(org.hl7.fhir.dstu2.model.HumanName.NameUse.OLD); + break; + case MAIDEN: + tgt.setValue(org.hl7.fhir.dstu2.model.HumanName.NameUse.MAIDEN); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.HumanName.NameUse.NULL); + break; + } + return tgt; + } + + 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); + if (src.hasVersionIdElement()) + tgt.setVersionIdElement(convertId(src.getVersionIdElement())); + if (src.hasLastUpdatedElement()) + tgt.setLastUpdatedElement(convertInstant(src.getLastUpdatedElement())); + 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); + if (src.hasVersionIdElement()) + tgt.setVersionIdElement(convertId(src.getVersionIdElement())); + if (src.hasLastUpdatedElement()) + 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.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()); + if (src.hasRepeat()) + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + if (src.hasCode()) + 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()); + 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.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); + if (src.hasBounds()) + tgt.setBounds(convertType(src.getBounds())); + if (src.hasCountElement()) + tgt.setCountElement(convertInteger(src.getCountElement())); + if (src.hasDurationElement()) + tgt.setDurationElement(convertDecimal(src.getDurationElement())); + if (src.hasDurationMaxElement()) + tgt.setDurationMaxElement(convertDecimal(src.getDurationMaxElement())); + if (src.hasDurationUnits()) + tgt.setDurationUnitElement(convertUnitsOfTime(src.getDurationUnitsElement())); + if (src.hasFrequencyElement()) + tgt.setFrequencyElement(convertInteger(src.getFrequencyElement())); + if (src.hasFrequencyMaxElement()) + tgt.setFrequencyMaxElement(convertInteger(src.getFrequencyMaxElement())); + if (src.hasPeriodElement()) + tgt.setPeriodElement(convertDecimal(src.getPeriodElement())); + if (src.hasPeriodMaxElement()) + tgt.setPeriodMaxElement(convertDecimal(src.getPeriodMaxElement())); + if (src.hasPeriodUnits()) + tgt.setPeriodUnitElement(convertUnitsOfTime(src.getPeriodUnitsElement())); + tgt.setWhen(Collections.singletonList(convertEventTiming(src.getWhenElement()))); + 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); + if (src.hasBounds()) + tgt.setBounds(convertType(src.getBounds())); + if (src.hasCountElement()) + tgt.setCountElement(convertInteger(src.getCountElement())); + if (src.hasDurationElement()) + tgt.setDurationElement(convertDecimal(src.getDurationElement())); + if (src.hasDurationMaxElement()) + tgt.setDurationMaxElement(convertDecimal(src.getDurationMaxElement())); + if (src.hasDurationUnit()) + tgt.setDurationUnitsElement(convertUnitsOfTime(src.getDurationUnitElement())); + if (src.hasFrequencyElement()) + tgt.setFrequencyElement(convertInteger(src.getFrequencyElement())); + if (src.hasFrequencyMaxElement()) + tgt.setFrequencyMaxElement(convertInteger(src.getFrequencyMaxElement())); + if (src.hasPeriodElement()) + tgt.setPeriodElement(convertDecimal(src.getPeriodElement())); + if (src.hasPeriodMaxElement()) + tgt.setPeriodMaxElement(convertDecimal(src.getPeriodMaxElement())); + if (src.hasPeriodUnit()) + tgt.setPeriodUnitsElement(convertUnitsOfTime(src.getPeriodUnitElement())); + if (src.hasWhen()) + tgt.setWhenElement(convertEventTiming(src.getWhen().get(0))); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumeration convertUnitsOfTime(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Timing.UnitsOfTimeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case S: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.S); + break; + case MIN: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MIN); + break; + case H: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.H); + break; + case D: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.D); + break; + case WK: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.WK); + break; + case MO: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MO); + break; + case A: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.A); + break; + default: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.NULL); + break; + } + return tgt; + } + + static public org.hl7.fhir.dstu2.model.Enumeration convertUnitsOfTime(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Timing.UnitsOfTimeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case S: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.S); + break; + case MIN: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.MIN); + break; + case H: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.H); + break; + case D: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.D); + break; + case WK: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.WK); + break; + case MO: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.MO); + break; + case A: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.A); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.NULL); + break; + } + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumeration convertEventTiming(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Timing.EventTimingEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case HS: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.HS); + break; + case WAKE: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.WAKE); + break; + case C: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.C); + break; + case CM: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.CM); + break; + case CD: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.CD); + break; + case CV: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.CV); + break; + case AC: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.AC); + break; + case ACM: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.ACM); + break; + case ACD: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.ACD); + break; + case ACV: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.ACV); + break; + case PC: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.PC); + break; + case PCM: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.PCM); + break; + case PCD: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.PCD); + break; + case PCV: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.PCV); + break; + default: + tgt.setValue(org.hl7.fhir.dstu3.model.Timing.EventTiming.NULL); + break; + } + return tgt; + } + + static public org.hl7.fhir.dstu2.model.Enumeration convertEventTiming(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Timing.EventTimingEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case HS: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.HS); + break; + case WAKE: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.WAKE); + break; + case C: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.C); + break; + case CM: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.CM); + break; + case CD: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.CD); + break; + case CV: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.CV); + break; + case AC: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.AC); + break; + case ACM: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.ACM); + break; + case ACD: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.ACD); + break; + case ACV: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.ACV); + break; + case PC: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.PC); + break; + case PCM: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.PCM); + break; + case PCD: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.PCD); + break; + case PCV: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.PCV); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.Timing.EventTiming.NULL); + break; + } + return tgt; + } + + 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); + if (src.hasValueElement()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasComparator()) + tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); + if (src.hasUnitElement()) + tgt.setUnitElement(convertString(src.getUnitElement())); + if (src.hasSystemElement()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasCodeElement()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + 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); + if (src.hasValueElement()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasComparator()) + tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); + if (src.hasUnitElement()) + tgt.setUnitElement(convertString(src.getUnitElement())); + if (src.hasSystemElement()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasCodeElement()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + 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); + if (src.hasValueElement()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasComparator()) + tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); + if (src.hasUnitElement()) + tgt.setUnitElement(convertString(src.getUnitElement())); + if (src.hasSystemElement()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasCodeElement()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + 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); + if (src.hasValueElement()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasComparator()) + tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); + if (src.hasUnitElement()) + tgt.setUnitElement(convertString(src.getUnitElement())); + if (src.hasSystemElement()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasCodeElement()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + 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); + if (src.hasValueElement()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasComparator()) + tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); + if (src.hasUnitElement()) + tgt.setUnitElement(convertString(src.getUnitElement())); + if (src.hasSystemElement()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasCodeElement()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + 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); + if (src.hasValueElement()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasComparator()) + tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); + if (src.hasUnitElement()) + tgt.setUnitElement(convertString(src.getUnitElement())); + if (src.hasSystemElement()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasCodeElement()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + 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); + if (src.hasValueElement()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasComparator()) + tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); + if (src.hasUnitElement()) + tgt.setUnitElement(convertString(src.getUnitElement())); + if (src.hasSystemElement()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasCodeElement()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + 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); + if (src.hasValueElement()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasComparator()) + tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); + if (src.hasUnitElement()) + tgt.setUnitElement(convertString(src.getUnitElement())); + if (src.hasSystemElement()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasCodeElement()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + 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); + if (src.hasValueElement()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasComparator()) + tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); + if (src.hasUnitElement()) + tgt.setUnitElement(convertString(src.getUnitElement())); + if (src.hasSystemElement()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasCodeElement()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + 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); + if (src.hasValueElement()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasComparator()) + tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); + if (src.hasUnitElement()) + tgt.setUnitElement(convertString(src.getUnitElement())); + if (src.hasSystemElement()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasCodeElement()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + 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); + if (src.hasValueElement()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasComparator()) + tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); + if (src.hasUnitElement()) + tgt.setUnitElement(convertString(src.getUnitElement())); + if (src.hasSystemElement()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasCodeElement()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + 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); + if (src.hasValueElement()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasComparator()) + tgt.setComparatorElement(convertQuantityComparator(src.getComparatorElement())); + if (src.hasUnitElement()) + tgt.setUnitElement(convertString(src.getUnitElement())); + if (src.hasSystemElement()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasCodeElement()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + 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.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.dstu2.model.PositiveIntType) 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.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.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.UuidType) + return convertUuid((org.hl7.fhir.dstu2.model.UuidType) 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.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.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); + 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); + 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.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.dstu3.model.PositiveIntType) 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.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.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.UuidType) + return convertUuid((org.hl7.fhir.dstu3.model.UuidType) 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.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.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); + 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()); + } + + 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()); + } + + static public org.hl7.fhir.dstu3.model.Enumeration convertAdministrativeGender(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGenderEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case MALE: + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.MALE); + break; + case FEMALE: + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.FEMALE); + break; + case OTHER: + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.OTHER); + break; + case UNKNOWN: + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.UNKNOWN); + break; + default: + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.NULL); + break; + } + return tgt; + } + + static public org.hl7.fhir.dstu2.model.Enumeration convertAdministrativeGender(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGenderEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case MALE: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.MALE); + break; + case FEMALE: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.FEMALE); + break; + case OTHER: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.OTHER); + break; + case UNKNOWN: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.UNKNOWN); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.NULL); + break; + } + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumeration convertSearchParamType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Enumerations.SearchParamTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + tgt.setValue(convertSearchParamType(src.getValue())); + return tgt; + } + + static public org.hl7.fhir.dstu3.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType src) throws FHIRException { + switch (src) { case NUMBER: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NUMBER; case DATE: @@ -2709,740 +2649,741 @@ public class VersionConvertor_10_30 { return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.URI; default: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NULL; - } + } + } + + static public org.hl7.fhir.dstu2.model.Enumeration convertSearchParamType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Enumerations.SearchParamTypeEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case NUMBER: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.NUMBER); + break; + case DATE: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.DATE); + break; + case STRING: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.STRING); + break; + case TOKEN: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.TOKEN); + break; + case REFERENCE: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.REFERENCE); + break; + case COMPOSITE: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.COMPOSITE); + break; + case QUANTITY: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.QUANTITY); + break; + case URI: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.URI); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.NULL); + break; + } + return tgt; + } + + static public class SourceElementComponentWrapper { + + public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) { + super(); + this.source = source; + this.target = target; + this.comp = comp; } - static public org.hl7.fhir.dstu2.model.Enumeration convertSearchParamType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Enumerations.SearchParamTypeEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case NUMBER: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.NUMBER); - break; - case DATE: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.DATE); - break; - case STRING: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.STRING); - break; - case TOKEN: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.TOKEN); - break; - case REFERENCE: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.REFERENCE); - break; - case COMPOSITE: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.COMPOSITE); - break; - case QUANTITY: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.QUANTITY); - break; - case URI: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.URI); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.NULL); - break; - } - return tgt; + 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; + } + + static public org.hl7.fhir.dstu3.model.Enumeration convertConformanceResourceStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Enumerations.PublicationStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case DRAFT: + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT); + break; + case ACTIVE: + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE); + break; + case RETIRED: + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED); + break; + default: + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL); + break; } + 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.dstu3.model.ConceptMap.SourceElementComponent comp; + static public org.hl7.fhir.dstu2.model.Enumeration convertConformanceResourceStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case DRAFT: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.DRAFT); + break; + case ACTIVE: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.ACTIVE); + break; + case RETIRED: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.RETIRED); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.NULL); + break; } + return tgt; + } - 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; + static public org.hl7.fhir.dstu3.model.Enumeration convertDocumentReferenceStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case CURRENT: + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.CURRENT); + break; + case SUPERSEDED: + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.SUPERSEDED); + break; + case ENTEREDINERROR: + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR); + break; + default: + tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.NULL); + break; } + return tgt; + } - static public org.hl7.fhir.dstu3.model.Enumeration convertConformanceResourceStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Enumerations.PublicationStatusEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case DRAFT: - tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT); - break; - case ACTIVE: - tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE); - break; - case RETIRED: - tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED); - break; - default: - tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL); - break; - } - return tgt; + static public org.hl7.fhir.dstu2.model.Enumeration convertDocumentReferenceStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case CURRENT: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.CURRENT); + break; + case SUPERSEDED: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.SUPERSEDED); + break; + case ENTEREDINERROR: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.NULL); + break; } + return tgt; + } - static public org.hl7.fhir.dstu2.model.Enumeration convertConformanceResourceStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatusEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case DRAFT: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.DRAFT); - break; - case ACTIVE: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.ACTIVE); - break; - case RETIRED: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.RETIRED); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.NULL); - break; - } - return tgt; + 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 org.hl7.fhir.dstu3.model.Enumeration convertDocumentReferenceStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatusEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case CURRENT: - tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.CURRENT); - break; - case SUPERSEDED: - tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.SUPERSEDED); - break; - case ENTEREDINERROR: - tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR); - break; - default: - tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.NULL); - break; - } - return tgt; + 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; + } - static public org.hl7.fhir.dstu2.model.Enumeration convertDocumentReferenceStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatusEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case CURRENT: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.CURRENT); - break; - case SUPERSEDED: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.SUPERSEDED); - break; - case ENTEREDINERROR: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.NULL); - break; - } - return tgt; - } + 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); + if (src.hasTextElement()) + tgt.setTextElement(convertString(src.getTextElement())); + if (src.hasTiming()) + tgt.setTiming(convertTiming(src.getTiming())); + if (src.hasAsNeeded()) + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSiteCodeableConcept()) + tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); + if (src.hasRoute()) + tgt.setRoute(convertCodeableConcept(src.getRoute())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasDose()) + tgt.setDose(convertType(src.getDose())); + if (src.hasRate()) + tgt.setRate(convertType(src.getRate())); + if (src.hasMaxDosePerPeriod()) + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } - 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; - } + 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); + if (src.hasTextElement()) + tgt.setTextElement(convertString(src.getTextElement())); + if (src.hasTiming()) + tgt.setTiming(convertTiming(src.getTiming())); + if (src.hasAsNeeded()) + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSite()) + tgt.setSite(convertType(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(convertCodeableConcept(src.getRoute())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasDose()) + tgt.setDose(convertType(src.getDose())); + if (src.hasRate()) + tgt.setRate(convertType(src.getRate())); + if (src.hasMaxDosePerPeriod()) + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } - 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; + static public org.hl7.fhir.dstu3.model.Enumeration convertActionList(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ProcessRequest.ActionListEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case CANCEL: + tgt.setValue(org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.CANCEL); + break; + case POLL: + tgt.setValue(org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.POLL); + break; + case REPROCESS: + tgt.setValue(org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.REPROCESS); + break; + case STATUS: + tgt.setValue(org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.STATUS); + break; + default: + tgt.setValue(org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.NULL); + break; } + return tgt; + } - 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); - if (src.hasTextElement()) - tgt.setTextElement(convertString(src.getTextElement())); - if (src.hasTiming()) - tgt.setTiming(convertTiming(src.getTiming())); - if (src.hasAsNeeded()) - tgt.setAsNeeded(convertType(src.getAsNeeded())); - if (src.hasSiteCodeableConcept()) - tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); - if (src.hasRoute()) - tgt.setRoute(convertCodeableConcept(src.getRoute())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasDose()) - tgt.setDose(convertType(src.getDose())); - if (src.hasRate()) - tgt.setRate(convertType(src.getRate())); - if (src.hasMaxDosePerPeriod()) - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; + static public org.hl7.fhir.dstu2.model.Enumeration convertActionList(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ProcessRequest.ActionListEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case CANCEL: + tgt.setValue(org.hl7.fhir.dstu2.model.ProcessRequest.ActionList.CANCEL); + break; + case POLL: + tgt.setValue(org.hl7.fhir.dstu2.model.ProcessRequest.ActionList.POLL); + break; + case REPROCESS: + tgt.setValue(org.hl7.fhir.dstu2.model.ProcessRequest.ActionList.REPROCESS); + break; + case STATUS: + tgt.setValue(org.hl7.fhir.dstu2.model.ProcessRequest.ActionList.STATUS); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.ProcessRequest.ActionList.NULL); + break; } + 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); - if (src.hasTextElement()) - tgt.setTextElement(convertString(src.getTextElement())); - if (src.hasTiming()) - tgt.setTiming(convertTiming(src.getTiming())); - if (src.hasAsNeeded()) - tgt.setAsNeeded(convertType(src.getAsNeeded())); - if (src.hasSite()) - tgt.setSite(convertType(src.getSite())); - if (src.hasRoute()) - tgt.setRoute(convertCodeableConcept(src.getRoute())); - if (src.hasMethod()) - tgt.setMethod(convertCodeableConcept(src.getMethod())); - if (src.hasDose()) - tgt.setDose(convertType(src.getDose())); - if (src.hasRate()) - tgt.setRate(convertType(src.getRate())); - if (src.hasMaxDosePerPeriod()) - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } + 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); + if (src.hasSequenceLinkIdElement()) + tgt.setSequenceLinkIdElement(convertInteger(src.getSequenceLinkIdElement())); + return tgt; + } - static public org.hl7.fhir.dstu3.model.Enumeration convertActionList(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ProcessRequest.ActionListEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case CANCEL: - tgt.setValue(org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.CANCEL); - break; - case POLL: - tgt.setValue(org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.POLL); - break; - case REPROCESS: - tgt.setValue(org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.REPROCESS); - break; - case STATUS: - tgt.setValue(org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.STATUS); - break; - default: - tgt.setValue(org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.NULL); - break; - } - 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); + if (src.hasSequenceLinkIdElement()) + tgt.setSequenceLinkIdElement(convertInteger(src.getSequenceLinkIdElement())); + return tgt; + } - static public org.hl7.fhir.dstu2.model.Enumeration convertActionList(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.ProcessRequest.ActionListEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case CANCEL: - tgt.setValue(org.hl7.fhir.dstu2.model.ProcessRequest.ActionList.CANCEL); - break; - case POLL: - tgt.setValue(org.hl7.fhir.dstu2.model.ProcessRequest.ActionList.POLL); - break; - case REPROCESS: - tgt.setValue(org.hl7.fhir.dstu2.model.ProcessRequest.ActionList.REPROCESS); - break; - case STATUS: - tgt.setValue(org.hl7.fhir.dstu2.model.ProcessRequest.ActionList.STATUS); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.ProcessRequest.ActionList.NULL); - break; - } - return tgt; + static public org.hl7.fhir.dstu3.model.Enumeration convertSlotStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Slot.SlotStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case BUSY: + tgt.setValue(org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSY); + break; + case FREE: + tgt.setValue(org.hl7.fhir.dstu3.model.Slot.SlotStatus.FREE); + break; + case BUSYUNAVAILABLE: + tgt.setValue(org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYUNAVAILABLE); + break; + case BUSYTENTATIVE: + tgt.setValue(org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYTENTATIVE); + break; + default: + tgt.setValue(org.hl7.fhir.dstu3.model.Slot.SlotStatus.NULL); + break; } + return tgt; + } - 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); - if (src.hasSequenceLinkIdElement()) - tgt.setSequenceLinkIdElement(convertInteger(src.getSequenceLinkIdElement())); - return tgt; + static public org.hl7.fhir.dstu2.model.Enumeration convertSlotStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Slot.SlotStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case BUSY: + tgt.setValue(org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSY); + break; + case FREE: + tgt.setValue(org.hl7.fhir.dstu2.model.Slot.SlotStatus.FREE); + break; + case BUSYUNAVAILABLE: + tgt.setValue(org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSYUNAVAILABLE); + break; + case BUSYTENTATIVE: + tgt.setValue(org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSYTENTATIVE); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.Slot.SlotStatus.NULL); + break; } + 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); - if (src.hasSequenceLinkIdElement()) - tgt.setSequenceLinkIdElement(convertInteger(src.getSequenceLinkIdElement())); - return tgt; + static public org.hl7.fhir.dstu3.model.Enumeration convertSupplyRequestStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case REQUESTED: + tgt.setValue(org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.ACTIVE); + break; + case COMPLETED: + tgt.setValue(org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.COMPLETED); + break; + case FAILED: + tgt.setValue(org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.CANCELLED); + break; + case CANCELLED: + tgt.setValue(org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.CANCELLED); + break; + default: + tgt.setValue(org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.NULL); + break; } + return tgt; + } - static public org.hl7.fhir.dstu3.model.Enumeration convertSlotStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Slot.SlotStatusEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case BUSY: - tgt.setValue(org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSY); - break; - case FREE: - tgt.setValue(org.hl7.fhir.dstu3.model.Slot.SlotStatus.FREE); - break; - case BUSYUNAVAILABLE: - tgt.setValue(org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYUNAVAILABLE); - break; - case BUSYTENTATIVE: - tgt.setValue(org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYTENTATIVE); - break; - default: - tgt.setValue(org.hl7.fhir.dstu3.model.Slot.SlotStatus.NULL); - break; - } - return tgt; + static public org.hl7.fhir.dstu2.model.Enumeration convertSupplyRequestStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatusEnumFactory()); + VersionConvertor_10_30.copyElement(src, tgt); + switch (src.getValue()) { + case ACTIVE: + tgt.setValue(org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.REQUESTED); + break; + case COMPLETED: + tgt.setValue(org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.COMPLETED); + break; + case CANCELLED: + tgt.setValue(org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.CANCELLED); + break; + default: + tgt.setValue(org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.NULL); + break; } + return tgt; + } - static public org.hl7.fhir.dstu2.model.Enumeration convertSlotStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Slot.SlotStatusEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case BUSY: - tgt.setValue(org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSY); - break; - case FREE: - tgt.setValue(org.hl7.fhir.dstu2.model.Slot.SlotStatus.FREE); - break; - case BUSYUNAVAILABLE: - tgt.setValue(org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSYUNAVAILABLE); - break; - case BUSYTENTATIVE: - tgt.setValue(org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSYTENTATIVE); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.Slot.SlotStatus.NULL); - break; - } - return tgt; - } + 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); + if (src.hasUrlElement()) + tgt.setSystemElement(convertUri(src.getUrlElement())); + if (src.hasVersionElement()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasCaseSensitiveElement()) + tgt.setCaseSensitiveElement(convertBoolean(src.getCaseSensitiveElement())); + for (ConceptDefinitionComponent cc : src.getConcept()) tgt.addConcept(convertCodeSystemConcept(src, cc)); + return tgt; + } - static public org.hl7.fhir.dstu3.model.Enumeration convertSupplyRequestStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatusEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case REQUESTED: - tgt.setValue(org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.ACTIVE); - break; - case COMPLETED: - tgt.setValue(org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.COMPLETED); - break; - case FAILED: - tgt.setValue(org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.CANCELLED); - break; - case CANCELLED: - tgt.setValue(org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.CANCELLED); - break; - default: - tgt.setValue(org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.NULL); - break; - } - 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; + } - static public org.hl7.fhir.dstu2.model.Enumeration convertSupplyRequestStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatusEnumFactory()); - VersionConvertor_10_30.copyElement(src, tgt); - switch(src.getValue()) { - case ACTIVE: - tgt.setValue(org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.REQUESTED); - break; - case COMPLETED: - tgt.setValue(org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.COMPLETED); - break; - case CANCELLED: - tgt.setValue(org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.CANCELLED); - break; - default: - tgt.setValue(org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.NULL); - break; - } - 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; + } - 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); - if (src.hasUrlElement()) - tgt.setSystemElement(convertUri(src.getUrlElement())); - if (src.hasVersionElement()) - tgt.setVersionElement(convertString(src.getVersionElement())); - if (src.hasCaseSensitiveElement()) - tgt.setCaseSensitiveElement(convertBoolean(src.getCaseSensitiveElement())); - for (ConceptDefinitionComponent cc : src.getConcept()) tgt.addConcept(convertCodeSystemConcept(src, cc)); - 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.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.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.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 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()); + } - 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 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, 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.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, 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); - } + 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 3cd708bce..a4922239b 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 @@ -170,241 +170,241 @@ public class VersionConvertor_10_40 { } 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()); + org.hl7.fhir.r4.model.Base64BinaryType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.Base64BinaryType(src.getValue()) : new org.hl7.fhir.r4.model.Base64BinaryType(); 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()); + org.hl7.fhir.dstu2.model.Base64BinaryType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.Base64BinaryType(src.getValue()) : new org.hl7.fhir.dstu2.model.Base64BinaryType(); 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()); + org.hl7.fhir.r4.model.BooleanType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.BooleanType(src.getValue()) : new org.hl7.fhir.r4.model.BooleanType(); 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()); + org.hl7.fhir.dstu2.model.BooleanType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.BooleanType(src.getValue()) : new org.hl7.fhir.dstu2.model.BooleanType(); 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()); + org.hl7.fhir.r4.model.CodeType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.CodeType(src.getValue()) : new org.hl7.fhir.r4.model.CodeType(); 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()); + org.hl7.fhir.dstu2.model.CodeType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.CodeType(src.getValue()) : new org.hl7.fhir.dstu2.model.CodeType(); 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()); + org.hl7.fhir.r4.model.UriType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.UriType(src.getValue()) : new org.hl7.fhir.r4.model.UriType(); 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()); + org.hl7.fhir.dstu2.model.CodeType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.CodeType(src.getValue()) : new org.hl7.fhir.dstu2.model.CodeType(); 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()); + org.hl7.fhir.r4.model.DateType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.DateType(src.getValueAsString()) : new org.hl7.fhir.r4.model.DateType(); 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()); + org.hl7.fhir.r4.model.DateType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.DateType(src.getValueAsString()) : new org.hl7.fhir.r4.model.DateType(); 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()); + org.hl7.fhir.r4.model.DateTimeType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.DateTimeType(src.getValueAsString()) : new org.hl7.fhir.r4.model.DateTimeType(); 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()); + org.hl7.fhir.dstu2.model.DateType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()) : new org.hl7.fhir.dstu2.model.DateType(); 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()); + org.hl7.fhir.dstu2.model.DateType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()) : new org.hl7.fhir.dstu2.model.DateType(); 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()); + org.hl7.fhir.dstu2.model.DateType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()) : new org.hl7.fhir.dstu2.model.DateType(); 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()); + org.hl7.fhir.r4.model.DateTimeType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.DateTimeType(src.getValueAsString()) : new org.hl7.fhir.r4.model.DateTimeType(); 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()); + org.hl7.fhir.dstu2.model.DateTimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.DateTimeType(src.getValueAsString()) : new org.hl7.fhir.dstu2.model.DateTimeType(); 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()); + org.hl7.fhir.r4.model.DecimalType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.DecimalType(src.getValue()) : new org.hl7.fhir.r4.model.DecimalType(); 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()); + org.hl7.fhir.dstu2.model.DecimalType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.DecimalType(src.getValue()) : new org.hl7.fhir.dstu2.model.DecimalType(); 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()); + org.hl7.fhir.r4.model.IdType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.IdType(src.getValue()) : new org.hl7.fhir.r4.model.IdType(); 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()); + org.hl7.fhir.dstu2.model.IdType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.IdType(src.getValue()) : new org.hl7.fhir.dstu2.model.IdType(); 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()); + org.hl7.fhir.r4.model.InstantType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.InstantType(src.getValue()) : new org.hl7.fhir.r4.model.InstantType(); 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()); + org.hl7.fhir.dstu2.model.InstantType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.InstantType(src.getValue()) : new org.hl7.fhir.dstu2.model.InstantType(); 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()); + org.hl7.fhir.r4.model.IntegerType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.IntegerType(src.getValue()) : new org.hl7.fhir.r4.model.IntegerType(); 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()); + org.hl7.fhir.dstu2.model.IntegerType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.IntegerType(src.getValue()) : new org.hl7.fhir.dstu2.model.IntegerType(); 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()); + org.hl7.fhir.r4.model.MarkdownType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.MarkdownType(src.getValue()) : new org.hl7.fhir.r4.model.MarkdownType(); 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()); + org.hl7.fhir.dstu2.model.MarkdownType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.MarkdownType(src.getValue()) : new org.hl7.fhir.dstu2.model.MarkdownType(); 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()); + org.hl7.fhir.r4.model.OidType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.OidType(src.getValue()) : new org.hl7.fhir.r4.model.OidType(); 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()); + org.hl7.fhir.dstu2.model.OidType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.OidType(src.getValue()) : new org.hl7.fhir.dstu2.model.OidType(); 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()); + org.hl7.fhir.r4.model.PositiveIntType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.PositiveIntType(src.getValue()) : new org.hl7.fhir.r4.model.PositiveIntType(); 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()); + org.hl7.fhir.dstu2.model.PositiveIntType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.PositiveIntType(src.getValue()) : new org.hl7.fhir.dstu2.model.PositiveIntType(); 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()); + org.hl7.fhir.r4.model.StringType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.StringType(src.getValue()) : new org.hl7.fhir.r4.model.StringType(); 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()); + org.hl7.fhir.dstu2.model.StringType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.StringType(src.getValue()) : new org.hl7.fhir.dstu2.model.StringType(); 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()); + org.hl7.fhir.r4.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.TimeType(src.getValue()) : new org.hl7.fhir.r4.model.TimeType(); 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()); + org.hl7.fhir.dstu2.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.TimeType(src.getValue()) : new org.hl7.fhir.dstu2.model.TimeType(); 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()); + org.hl7.fhir.r4.model.UnsignedIntType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.UnsignedIntType(src.getValue()) : new org.hl7.fhir.r4.model.UnsignedIntType(); 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()); + org.hl7.fhir.dstu2.model.UnsignedIntType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.UnsignedIntType(src.getValue()) : new org.hl7.fhir.dstu2.model.UnsignedIntType(); 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()); + org.hl7.fhir.r4.model.UriType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.UriType(src.getValue()) : new org.hl7.fhir.r4.model.UriType(); 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()); + org.hl7.fhir.dstu2.model.UriType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.UriType(src.getValue()) : new org.hl7.fhir.dstu2.model.UriType(); 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()); + org.hl7.fhir.r4.model.UuidType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.UuidType(src.getValue()) : new org.hl7.fhir.r4.model.UuidType(); 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()); + org.hl7.fhir.dstu2.model.UuidType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.UuidType(src.getValue()) : new org.hl7.fhir.dstu2.model.UuidType(); copyElement(src, tgt); return tgt; } 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 972e5873c..a9ffd31bb 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 @@ -179,241 +179,241 @@ public class VersionConvertor_10_50 { } 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()); + org.hl7.fhir.r5.model.Base64BinaryType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.Base64BinaryType(src.getValue()) : new org.hl7.fhir.r5.model.Base64BinaryType(); 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()); + org.hl7.fhir.dstu2.model.Base64BinaryType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.Base64BinaryType(src.getValue()) : new org.hl7.fhir.dstu2.model.Base64BinaryType(); 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()); + org.hl7.fhir.r5.model.BooleanType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.BooleanType(src.getValue()) : new org.hl7.fhir.r5.model.BooleanType(); 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()); + org.hl7.fhir.dstu2.model.BooleanType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.BooleanType(src.getValue()) : new org.hl7.fhir.dstu2.model.BooleanType(); 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()); + org.hl7.fhir.r5.model.CodeType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.CodeType(src.getValue()) : new org.hl7.fhir.r5.model.CodeType(); 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()); + org.hl7.fhir.dstu2.model.CodeType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.CodeType(src.getValue()) : new org.hl7.fhir.dstu2.model.CodeType(); 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()); + org.hl7.fhir.r5.model.UriType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.UriType(src.getValue()) : new org.hl7.fhir.r5.model.UriType(); 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()); + org.hl7.fhir.dstu2.model.CodeType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.CodeType(src.getValue()) : new org.hl7.fhir.dstu2.model.CodeType(); 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()); + org.hl7.fhir.r5.model.DateType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.DateType(src.getValueAsString()) : new org.hl7.fhir.r5.model.DateType(); 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()); + org.hl7.fhir.r5.model.DateType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.DateType(src.getValueAsString()) : new org.hl7.fhir.r5.model.DateType(); 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()); + org.hl7.fhir.r5.model.DateTimeType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.DateTimeType(src.getValueAsString()) : new org.hl7.fhir.r5.model.DateTimeType(); 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()); + org.hl7.fhir.dstu2.model.DateType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()) : new org.hl7.fhir.dstu2.model.DateType(); 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()); + org.hl7.fhir.dstu2.model.DateType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()) : new org.hl7.fhir.dstu2.model.DateType(); 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()); + org.hl7.fhir.dstu2.model.DateType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()) : new org.hl7.fhir.dstu2.model.DateType(); 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()); + org.hl7.fhir.r5.model.DateTimeType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.DateTimeType(src.getValueAsString()) : new org.hl7.fhir.r5.model.DateTimeType(); 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()); + org.hl7.fhir.dstu2.model.DateTimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.DateTimeType(src.getValueAsString()) : new org.hl7.fhir.dstu2.model.DateTimeType(); 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()); + org.hl7.fhir.r5.model.DecimalType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.DecimalType(src.getValue()) : new org.hl7.fhir.r5.model.DecimalType(); 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()); + org.hl7.fhir.dstu2.model.DecimalType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.DecimalType(src.getValue()) : new org.hl7.fhir.dstu2.model.DecimalType(); 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()); + org.hl7.fhir.r5.model.IdType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.IdType(src.getValue()) : new org.hl7.fhir.r5.model.IdType(); 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()); + org.hl7.fhir.dstu2.model.IdType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.IdType(src.getValue()) : new org.hl7.fhir.dstu2.model.IdType(); 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()); + org.hl7.fhir.r5.model.InstantType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.InstantType(src.getValue()) : new org.hl7.fhir.r5.model.InstantType(); 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()); + org.hl7.fhir.dstu2.model.InstantType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.InstantType(src.getValue()) : new org.hl7.fhir.dstu2.model.InstantType(); 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()); + org.hl7.fhir.r5.model.IntegerType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.IntegerType(src.getValue()) : new org.hl7.fhir.r5.model.IntegerType(); 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()); + org.hl7.fhir.dstu2.model.IntegerType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.IntegerType(src.getValue()) : new org.hl7.fhir.dstu2.model.IntegerType(); 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()); + org.hl7.fhir.r5.model.MarkdownType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.MarkdownType(src.getValue()) : new org.hl7.fhir.r5.model.MarkdownType(); 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()); + org.hl7.fhir.dstu2.model.MarkdownType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.MarkdownType(src.getValue()) : new org.hl7.fhir.dstu2.model.MarkdownType(); 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()); + org.hl7.fhir.r5.model.OidType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.OidType(src.getValue()) : new org.hl7.fhir.r5.model.OidType(); 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()); + org.hl7.fhir.dstu2.model.OidType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.OidType(src.getValue()) : new org.hl7.fhir.dstu2.model.OidType(); 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()); + org.hl7.fhir.r5.model.PositiveIntType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.PositiveIntType(src.getValue()) : new org.hl7.fhir.r5.model.PositiveIntType(); 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()); + org.hl7.fhir.dstu2.model.PositiveIntType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.PositiveIntType(src.getValue()) : new org.hl7.fhir.dstu2.model.PositiveIntType(); 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()); + org.hl7.fhir.r5.model.StringType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.StringType(src.getValue()) : new org.hl7.fhir.r5.model.StringType(); 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()); + org.hl7.fhir.dstu2.model.StringType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.StringType(src.getValue()) : new org.hl7.fhir.dstu2.model.StringType(); 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()); + org.hl7.fhir.r5.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.TimeType(src.getValue()) : new org.hl7.fhir.r5.model.TimeType(); 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()); + org.hl7.fhir.dstu2.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.TimeType(src.getValue()) : new org.hl7.fhir.dstu2.model.TimeType(); 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()); + org.hl7.fhir.r5.model.UnsignedIntType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.UnsignedIntType(src.getValue()) : new org.hl7.fhir.r5.model.UnsignedIntType(); 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()); + org.hl7.fhir.dstu2.model.UnsignedIntType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.UnsignedIntType(src.getValue()) : new org.hl7.fhir.dstu2.model.UnsignedIntType(); 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()); + org.hl7.fhir.r5.model.UriType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.UriType(src.getValue()) : new org.hl7.fhir.r5.model.UriType(); 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()); + org.hl7.fhir.dstu2.model.UriType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.UriType(src.getValue()) : new org.hl7.fhir.dstu2.model.UriType(); 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()); + org.hl7.fhir.r5.model.UuidType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.UuidType(src.getValue()) : new org.hl7.fhir.r5.model.UuidType(); 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()); + org.hl7.fhir.dstu2.model.UuidType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.UuidType(src.getValue()) : new org.hl7.fhir.dstu2.model.UuidType(); copyElement(src, tgt); return tgt; } 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 3e7c38022..412cadfc3 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 @@ -79,8 +79,7 @@ import java.util.stream.Collectors; public class VersionConvertor_14_30 { 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()); + 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)); @@ -89,8 +88,7 @@ public class VersionConvertor_14_30 { } 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()); + 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)); @@ -114,272 +112,238 @@ public class VersionConvertor_14_30 { 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + 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()); + if (src.hasValue()) tgt.setValue(src.getValue()); copyElement(src, tgt); return tgt; } 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 413a731dd..601f90728 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 @@ -202,217 +202,217 @@ public class VersionConvertor_30_40 { } 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()); + org.hl7.fhir.r4.model.Base64BinaryType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.Base64BinaryType(src.getValue()) : new org.hl7.fhir.r4.model.Base64BinaryType(); 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()); + org.hl7.fhir.dstu3.model.Base64BinaryType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.Base64BinaryType(src.getValue()) : new org.hl7.fhir.dstu3.model.Base64BinaryType(); 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()); + org.hl7.fhir.r4.model.BooleanType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.BooleanType(src.getValue()) : new org.hl7.fhir.r4.model.BooleanType(); 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()); + org.hl7.fhir.dstu3.model.BooleanType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.BooleanType(src.getValue()) : new org.hl7.fhir.dstu3.model.BooleanType(); 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()); + org.hl7.fhir.r4.model.CodeType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.CodeType(src.getValue()) : new org.hl7.fhir.r4.model.CodeType(); 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()); + org.hl7.fhir.dstu3.model.CodeType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.CodeType(src.getValue()) : new org.hl7.fhir.dstu3.model.CodeType(); 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()); + org.hl7.fhir.r4.model.DateType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.DateType(src.getValueAsString()) : new org.hl7.fhir.r4.model.DateType(); 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()); + org.hl7.fhir.r4.model.DateTimeType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.DateTimeType(src.getValueAsString()) : new org.hl7.fhir.r4.model.DateTimeType(); 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()); + org.hl7.fhir.dstu3.model.DateType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.DateType(src.getValueAsString()) : new org.hl7.fhir.dstu3.model.DateType(); 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()); + org.hl7.fhir.dstu3.model.DateType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.DateType(src.getValueAsString()) : new org.hl7.fhir.dstu3.model.DateType(); 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()); + org.hl7.fhir.r4.model.DateTimeType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.DateTimeType(src.getValueAsString()) : new org.hl7.fhir.r4.model.DateTimeType(); 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()); + org.hl7.fhir.dstu3.model.DateTimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.DateTimeType(src.getValueAsString()) : new org.hl7.fhir.dstu3.model.DateTimeType(); 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()); + org.hl7.fhir.r4.model.DecimalType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.DecimalType(src.getValue()) : new org.hl7.fhir.r4.model.DecimalType(); 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()); + org.hl7.fhir.dstu3.model.DecimalType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.DecimalType(src.getValue()) : new org.hl7.fhir.dstu3.model.DecimalType(); 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()); + org.hl7.fhir.r4.model.IdType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.IdType(src.getValue()) : new org.hl7.fhir.r4.model.IdType(); 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()); + org.hl7.fhir.dstu3.model.IdType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.IdType(src.getValue()) : new org.hl7.fhir.dstu3.model.IdType(); 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()); + org.hl7.fhir.r4.model.InstantType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.InstantType(src.getValueAsString()) : new org.hl7.fhir.r4.model.InstantType(); 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()); + org.hl7.fhir.dstu3.model.InstantType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.InstantType(src.getValueAsString()) : new org.hl7.fhir.dstu3.model.InstantType(); 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()); + org.hl7.fhir.r4.model.IntegerType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.IntegerType(src.getValue()) : new org.hl7.fhir.r4.model.IntegerType(); 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()); + org.hl7.fhir.dstu3.model.IntegerType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.IntegerType(src.getValue()) : new org.hl7.fhir.dstu3.model.IntegerType(); 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()); + org.hl7.fhir.r4.model.MarkdownType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.MarkdownType(src.getValue()) : new org.hl7.fhir.r4.model.MarkdownType(); 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()); + org.hl7.fhir.dstu3.model.MarkdownType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.MarkdownType(src.getValue()) : new org.hl7.fhir.dstu3.model.MarkdownType(); 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()); + org.hl7.fhir.r4.model.OidType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.OidType(src.getValue()) : new org.hl7.fhir.r4.model.OidType(); 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()); + org.hl7.fhir.dstu3.model.OidType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.OidType(src.getValue()) : new org.hl7.fhir.dstu3.model.OidType(); 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()); + org.hl7.fhir.r4.model.PositiveIntType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.PositiveIntType(src.getValue()) : new org.hl7.fhir.r4.model.PositiveIntType(); 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()); + org.hl7.fhir.dstu3.model.PositiveIntType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.PositiveIntType(src.getValue()) : new org.hl7.fhir.dstu3.model.PositiveIntType(); 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()); + org.hl7.fhir.r4.model.StringType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.StringType(src.getValue()) : new org.hl7.fhir.r4.model.StringType(); 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()); + org.hl7.fhir.dstu3.model.StringType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.StringType(src.getValue()) : new org.hl7.fhir.dstu3.model.StringType(); 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()); + org.hl7.fhir.r4.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.TimeType(src.getValue()) : new org.hl7.fhir.r4.model.TimeType(); 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()); + org.hl7.fhir.dstu3.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.TimeType(src.getValue()) : new org.hl7.fhir.dstu3.model.TimeType(); 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()); + org.hl7.fhir.r4.model.UnsignedIntType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.UnsignedIntType(src.getValue()) : new org.hl7.fhir.r4.model.UnsignedIntType(); 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()); + org.hl7.fhir.dstu3.model.UnsignedIntType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.UnsignedIntType(src.getValue()) : new org.hl7.fhir.dstu3.model.UnsignedIntType(); 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()); + org.hl7.fhir.r4.model.UriType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.UriType(src.getValue()) : new org.hl7.fhir.r4.model.UriType(); 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()); + org.hl7.fhir.dstu3.model.UriType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.UriType(src.getValue()) : new org.hl7.fhir.dstu3.model.UriType(); 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()); + org.hl7.fhir.r4.model.UuidType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.UuidType(src.getValue()) : new org.hl7.fhir.r4.model.UuidType(); 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()); + org.hl7.fhir.dstu3.model.UuidType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.UuidType(src.getValue()) : new org.hl7.fhir.dstu3.model.UuidType(); copyElement(src, tgt); return tgt; } 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 8151527c0..417489293 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 @@ -203,145 +203,145 @@ public class VersionConvertor_30_50 { } 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()); + org.hl7.fhir.r5.model.Base64BinaryType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.Base64BinaryType(src.getValue()) : new org.hl7.fhir.r5.model.Base64BinaryType(); 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()); + org.hl7.fhir.dstu3.model.Base64BinaryType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.Base64BinaryType(src.getValue()) : new org.hl7.fhir.dstu3.model.Base64BinaryType(); 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()); + org.hl7.fhir.r5.model.BooleanType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.BooleanType(src.getValue()) : new org.hl7.fhir.r5.model.BooleanType(); 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()); + org.hl7.fhir.dstu3.model.BooleanType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.BooleanType(src.getValue()) : new org.hl7.fhir.dstu3.model.BooleanType(); 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()); + org.hl7.fhir.r5.model.CodeType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.CodeType(src.getValue()) : new org.hl7.fhir.r5.model.CodeType(); 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()); + org.hl7.fhir.dstu3.model.CodeType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.CodeType(src.getValue()) : new org.hl7.fhir.dstu3.model.CodeType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.CodeType convertStringToCode(org.hl7.fhir.dstu3.model.StringType src) throws FHIRException { - org.hl7.fhir.r5.model.CodeType tgt = new org.hl7.fhir.r5.model.CodeType(src.getValue()); + org.hl7.fhir.r5.model.CodeType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.CodeType(src.getValue()) : new org.hl7.fhir.r5.model.CodeType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.dstu3.model.StringType convertCodeToString(org.hl7.fhir.r5.model.CodeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.StringType tgt = new org.hl7.fhir.dstu3.model.StringType(src.getValue()); + org.hl7.fhir.dstu3.model.StringType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.StringType(src.getValue()) : new org.hl7.fhir.dstu3.model.StringType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.dstu3.model.CodeType convertStringToCode(org.hl7.fhir.r5.model.StringType src) throws FHIRException { - org.hl7.fhir.dstu3.model.CodeType tgt = new org.hl7.fhir.dstu3.model.CodeType(src.getValue()); + org.hl7.fhir.dstu3.model.CodeType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.CodeType(src.getValue()) : new org.hl7.fhir.dstu3.model.CodeType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.StringType convertCodeToString(org.hl7.fhir.dstu3.model.CodeType src) throws FHIRException { - org.hl7.fhir.r5.model.StringType tgt = new org.hl7.fhir.r5.model.StringType(src.getValue()); + org.hl7.fhir.r5.model.StringType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.StringType(src.getValue()) : new org.hl7.fhir.r5.model.StringType(); 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()); + org.hl7.fhir.r5.model.DateType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.DateType(src.getValueAsString()) : new org.hl7.fhir.r5.model.DateType(); 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()); + org.hl7.fhir.r5.model.DateTimeType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.DateTimeType(src.getValueAsString()) : new org.hl7.fhir.r5.model.DateTimeType(); 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()); + org.hl7.fhir.dstu3.model.DateType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.DateType(src.getValueAsString()) : new org.hl7.fhir.dstu3.model.DateType(); 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()); + org.hl7.fhir.dstu3.model.DateType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.DateType(src.getValueAsString()) : new org.hl7.fhir.dstu3.model.DateType(); 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()); + org.hl7.fhir.r5.model.DateTimeType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.DateTimeType(src.getValueAsString()) : new org.hl7.fhir.r5.model.DateTimeType(); 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()); + org.hl7.fhir.dstu3.model.DateTimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.DateTimeType(src.getValueAsString()) : new org.hl7.fhir.dstu3.model.DateTimeType(); 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()); + org.hl7.fhir.r5.model.DecimalType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.DecimalType(src.getValue()) : new org.hl7.fhir.r5.model.DecimalType(); 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()); + org.hl7.fhir.dstu3.model.DecimalType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.DecimalType(src.getValue()) : new org.hl7.fhir.dstu3.model.DecimalType(); 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()); + org.hl7.fhir.r5.model.IdType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.IdType(src.getValue()) : new org.hl7.fhir.r5.model.IdType(); 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()); + org.hl7.fhir.dstu3.model.IdType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.IdType(src.getValue()) : new org.hl7.fhir.dstu3.model.IdType(); 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()); + org.hl7.fhir.r5.model.InstantType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.InstantType(src.getValueAsString()) : new org.hl7.fhir.r5.model.InstantType(); 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()); + org.hl7.fhir.dstu3.model.InstantType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.InstantType(src.getValueAsString()) : new org.hl7.fhir.dstu3.model.InstantType(); 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()); + org.hl7.fhir.r5.model.IntegerType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.IntegerType(src.getValue()) : new org.hl7.fhir.r5.model.IntegerType(); 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()); + org.hl7.fhir.dstu3.model.IntegerType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.IntegerType(src.getValue()) : new org.hl7.fhir.dstu3.model.IntegerType(); copyElement(src, tgt); return tgt; } @@ -353,121 +353,121 @@ public class VersionConvertor_30_50 { } 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()); + org.hl7.fhir.r5.model.MarkdownType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.MarkdownType(src.getValue()) : new org.hl7.fhir.r5.model.MarkdownType(); 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()); + org.hl7.fhir.dstu3.model.MarkdownType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.MarkdownType(src.getValue()) : new org.hl7.fhir.dstu3.model.MarkdownType(); 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()); + org.hl7.fhir.r5.model.OidType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.OidType(src.getValue()) : new org.hl7.fhir.r5.model.OidType(); 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()); + org.hl7.fhir.dstu3.model.OidType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.OidType(src.getValue()) : new org.hl7.fhir.dstu3.model.OidType(); 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()); + org.hl7.fhir.r5.model.PositiveIntType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.PositiveIntType(src.getValue()) : new org.hl7.fhir.r5.model.PositiveIntType(); 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()); + org.hl7.fhir.dstu3.model.PositiveIntType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.PositiveIntType(src.getValue()) : new org.hl7.fhir.dstu3.model.PositiveIntType(); 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()); + org.hl7.fhir.r5.model.StringType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.StringType(src.getValue()) : new org.hl7.fhir.r5.model.StringType(); 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()); + org.hl7.fhir.dstu3.model.StringType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.StringType(src.getValue()) : new org.hl7.fhir.dstu3.model.StringType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.MarkdownType convertStringToMarkdown(org.hl7.fhir.dstu3.model.StringType src) throws FHIRException { - org.hl7.fhir.r5.model.MarkdownType tgt = new org.hl7.fhir.r5.model.MarkdownType(src.getValue()); + org.hl7.fhir.r5.model.MarkdownType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.MarkdownType(src.getValue()) : new org.hl7.fhir.r5.model.MarkdownType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.dstu3.model.StringType convertMarkdownToString(org.hl7.fhir.r5.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.dstu3.model.StringType tgt = new org.hl7.fhir.dstu3.model.StringType(src.getValue()); + org.hl7.fhir.dstu3.model.StringType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.StringType(src.getValue()) : new org.hl7.fhir.dstu3.model.StringType(); 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()); + org.hl7.fhir.r5.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.TimeType(src.getValue()) : new org.hl7.fhir.r5.model.TimeType(); 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()); + org.hl7.fhir.dstu3.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.TimeType(src.getValue()) : new org.hl7.fhir.dstu3.model.TimeType(); 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()); + org.hl7.fhir.r5.model.UnsignedIntType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.UnsignedIntType(src.getValue()) : new org.hl7.fhir.r5.model.UnsignedIntType(); 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()); + org.hl7.fhir.dstu3.model.UnsignedIntType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.UnsignedIntType(src.getValue()) : new org.hl7.fhir.dstu3.model.UnsignedIntType(); 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()); + org.hl7.fhir.r5.model.UriType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.UriType(src.getValue()) : new org.hl7.fhir.r5.model.UriType(); 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()); + org.hl7.fhir.dstu3.model.UriType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.UriType(src.getValue()) : new org.hl7.fhir.dstu3.model.UriType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.UriType convertCodeToUri(org.hl7.fhir.dstu3.model.CodeType src) throws FHIRException { - org.hl7.fhir.r5.model.UriType tgt = new org.hl7.fhir.r5.model.UriType(src.getValue()); + org.hl7.fhir.r5.model.UriType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.UriType(src.getValue()) : new org.hl7.fhir.r5.model.UriType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.dstu3.model.CodeType convertUriToCode(org.hl7.fhir.r5.model.UriType src) throws FHIRException { - org.hl7.fhir.dstu3.model.CodeType tgt = new org.hl7.fhir.dstu3.model.CodeType(src.getValue()); + org.hl7.fhir.dstu3.model.CodeType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.CodeType(src.getValue()) : new org.hl7.fhir.dstu3.model.CodeType(); 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()); + org.hl7.fhir.r5.model.UuidType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.UuidType(src.getValue()) : new org.hl7.fhir.r5.model.UuidType(); 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()); + org.hl7.fhir.dstu3.model.UuidType tgt = src.hasValue() ? new org.hl7.fhir.dstu3.model.UuidType(src.getValue()) : new org.hl7.fhir.dstu3.model.UuidType(); copyElement(src, tgt); return tgt; } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_40_50.java index 7a7ac771e..8c58b003f 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_40_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_40_50.java @@ -70,8 +70,7 @@ public class VersionConvertor_40_50 { } protected static void copyElement(org.hl7.fhir.r4.model.Element src, org.hl7.fhir.r5.model.Element tgt, String... extensionsToIgnore) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); + 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)); @@ -80,8 +79,7 @@ public class VersionConvertor_40_50 { } protected static void copyElement(org.hl7.fhir.r5.model.Element src, org.hl7.fhir.r4.model.Element tgt, String... extensionsToIgnore) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); + 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)); @@ -90,16 +88,14 @@ public class VersionConvertor_40_50 { } protected static void copyEnumeration(org.hl7.fhir.r4.model.Enumeration src, org.hl7.fhir.r5.model.Enumeration tgt) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); + if (src.hasId()) tgt.setId(src.getId()); for (org.hl7.fhir.r4.model.Extension e : src.getExtension()) { tgt.addExtension(convertExtension(e)); } } protected static void copyEnumeration(org.hl7.fhir.r5.model.Enumeration src, org.hl7.fhir.r4.model.Enumeration tgt) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); + if (src.hasId()) tgt.setId(src.getId()); for (org.hl7.fhir.r5.model.Extension e : src.getExtension()) { tgt.addExtension(convertExtension(e)); } @@ -138,241 +134,241 @@ public class VersionConvertor_40_50 { } public static org.hl7.fhir.r5.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r4.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.r5.model.Base64BinaryType tgt = new org.hl7.fhir.r5.model.Base64BinaryType(src.getValue()); + org.hl7.fhir.r5.model.Base64BinaryType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.Base64BinaryType(src.getValue()) : new org.hl7.fhir.r5.model.Base64BinaryType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r4.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r5.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.r4.model.Base64BinaryType tgt = new org.hl7.fhir.r4.model.Base64BinaryType(src.getValue()); + org.hl7.fhir.r4.model.Base64BinaryType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.Base64BinaryType(src.getValue()) : new org.hl7.fhir.r4.model.Base64BinaryType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.BooleanType convertBoolean(org.hl7.fhir.r4.model.BooleanType src) throws FHIRException { - org.hl7.fhir.r5.model.BooleanType tgt = new org.hl7.fhir.r5.model.BooleanType(src.getValue()); + org.hl7.fhir.r5.model.BooleanType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.BooleanType(src.getValue()) : new org.hl7.fhir.r5.model.BooleanType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r4.model.BooleanType convertBoolean(org.hl7.fhir.r5.model.BooleanType src) throws FHIRException { - org.hl7.fhir.r4.model.BooleanType tgt = new org.hl7.fhir.r4.model.BooleanType(src.getValue()); + org.hl7.fhir.r4.model.BooleanType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.BooleanType(src.getValue()) : new org.hl7.fhir.r4.model.BooleanType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.CanonicalType convertCanonical(org.hl7.fhir.r4.model.CanonicalType src) throws FHIRException { - org.hl7.fhir.r5.model.CanonicalType tgt = new org.hl7.fhir.r5.model.CanonicalType(src.getValue()); + org.hl7.fhir.r5.model.CanonicalType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.CanonicalType(src.getValue()) : new org.hl7.fhir.r5.model.CanonicalType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r4.model.CanonicalType convertCanonical(org.hl7.fhir.r5.model.CanonicalType src) throws FHIRException { - org.hl7.fhir.r4.model.CanonicalType tgt = new org.hl7.fhir.r4.model.CanonicalType(src.getValue()); + org.hl7.fhir.r4.model.CanonicalType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.CanonicalType(src.getValue()) : new org.hl7.fhir.r4.model.CanonicalType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.CodeType convertCode(org.hl7.fhir.r4.model.CodeType src) throws FHIRException { - org.hl7.fhir.r5.model.CodeType tgt = new org.hl7.fhir.r5.model.CodeType(src.getValue()); + org.hl7.fhir.r5.model.CodeType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.CodeType(src.getValue()) : new org.hl7.fhir.r5.model.CodeType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r4.model.CodeType convertCode(org.hl7.fhir.r5.model.CodeType src) throws FHIRException { - org.hl7.fhir.r4.model.CodeType tgt = new org.hl7.fhir.r4.model.CodeType(src.getValue()); + org.hl7.fhir.r4.model.CodeType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.CodeType(src.getValue()) : new org.hl7.fhir.r4.model.CodeType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.DateType convertDate(org.hl7.fhir.r4.model.DateType src) throws FHIRException { - org.hl7.fhir.r5.model.DateType tgt = new org.hl7.fhir.r5.model.DateType(src.getValue()); + org.hl7.fhir.r5.model.DateType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.DateType(src.getValue()) : new org.hl7.fhir.r5.model.DateType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r4.model.DateType convertDate(org.hl7.fhir.r5.model.DateType src) throws FHIRException { - org.hl7.fhir.r4.model.DateType tgt = new org.hl7.fhir.r4.model.DateType(src.getValue()); + org.hl7.fhir.r4.model.DateType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.DateType(src.getValue()) : new org.hl7.fhir.r4.model.DateType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.DateTimeType convertDateTime(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.r5.model.DateTimeType tgt = new org.hl7.fhir.r5.model.DateTimeType(src.getValue()); + org.hl7.fhir.r5.model.DateTimeType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.DateTimeType(src.getValue()) : new org.hl7.fhir.r5.model.DateTimeType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r4.model.DateTimeType convertDateTime(org.hl7.fhir.r5.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.r4.model.DateTimeType tgt = new org.hl7.fhir.r4.model.DateTimeType(src.getValue()); + org.hl7.fhir.r4.model.DateTimeType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.DateTimeType(src.getValue()) : new org.hl7.fhir.r4.model.DateTimeType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.DecimalType convertDecimal(org.hl7.fhir.r4.model.DecimalType src) throws FHIRException { - org.hl7.fhir.r5.model.DecimalType tgt = new org.hl7.fhir.r5.model.DecimalType(src.getValue()); + org.hl7.fhir.r5.model.DecimalType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.DecimalType(src.getValue()) : new org.hl7.fhir.r5.model.DecimalType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r4.model.DecimalType convertDecimal(org.hl7.fhir.r5.model.DecimalType src) throws FHIRException { - org.hl7.fhir.r4.model.DecimalType tgt = new org.hl7.fhir.r4.model.DecimalType(src.getValue()); + org.hl7.fhir.r4.model.DecimalType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.DecimalType(src.getValue()) : new org.hl7.fhir.r4.model.DecimalType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.IdType convertId(org.hl7.fhir.r4.model.IdType src) throws FHIRException { - org.hl7.fhir.r5.model.IdType tgt = new org.hl7.fhir.r5.model.IdType(src.getValue()); + org.hl7.fhir.r5.model.IdType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.IdType(src.getValue()) : new org.hl7.fhir.r5.model.IdType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r4.model.IdType convertId(org.hl7.fhir.r5.model.IdType src) throws FHIRException { - org.hl7.fhir.r4.model.IdType tgt = new org.hl7.fhir.r4.model.IdType(src.getValue()); + org.hl7.fhir.r4.model.IdType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.IdType(src.getValue()) : new org.hl7.fhir.r4.model.IdType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.InstantType convertInstant(org.hl7.fhir.r4.model.InstantType src) throws FHIRException { - org.hl7.fhir.r5.model.InstantType tgt = new org.hl7.fhir.r5.model.InstantType(src.getValue()); + org.hl7.fhir.r5.model.InstantType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.InstantType(src.getValue()) : new org.hl7.fhir.r5.model.InstantType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r4.model.InstantType convertInstant(org.hl7.fhir.r5.model.InstantType src) throws FHIRException { - org.hl7.fhir.r4.model.InstantType tgt = new org.hl7.fhir.r4.model.InstantType(src.getValue()); + org.hl7.fhir.r4.model.InstantType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.InstantType(src.getValue()) : new org.hl7.fhir.r4.model.InstantType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.IntegerType convertInteger(org.hl7.fhir.r4.model.IntegerType src) throws FHIRException { - org.hl7.fhir.r5.model.IntegerType tgt = new org.hl7.fhir.r5.model.IntegerType(src.getValue()); + org.hl7.fhir.r5.model.IntegerType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.IntegerType(src.getValue()) : new org.hl7.fhir.r5.model.IntegerType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.Integer64Type convertUnsignedIntToInteger64(org.hl7.fhir.r4.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.r5.model.Integer64Type tgt = new org.hl7.fhir.r5.model.Integer64Type(Long.valueOf(src.getValue())); + org.hl7.fhir.r5.model.Integer64Type tgt = src.hasValue() ? new org.hl7.fhir.r5.model.Integer64Type(Long.valueOf(src.getValue())) : new org.hl7.fhir.r5.model.Integer64Type(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r4.model.UnsignedIntType convertInteger64ToUnsignedInt(org.hl7.fhir.r5.model.Integer64Type src) throws FHIRException { - org.hl7.fhir.r4.model.UnsignedIntType tgt = new org.hl7.fhir.r4.model.UnsignedIntType(Math.toIntExact(src.getValue())); + org.hl7.fhir.r4.model.UnsignedIntType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.UnsignedIntType(Math.toIntExact(src.getValue())) : new org.hl7.fhir.r4.model.UnsignedIntType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r4.model.IntegerType convertInteger(org.hl7.fhir.r5.model.IntegerType src) throws FHIRException { - org.hl7.fhir.r4.model.IntegerType tgt = new org.hl7.fhir.r4.model.IntegerType(src.getValue()); + org.hl7.fhir.r4.model.IntegerType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.IntegerType(src.getValue()) : new org.hl7.fhir.r4.model.IntegerType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.MarkdownType convertMarkdown(org.hl7.fhir.r4.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.r5.model.MarkdownType tgt = new org.hl7.fhir.r5.model.MarkdownType(src.getValue()); + org.hl7.fhir.r5.model.MarkdownType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.MarkdownType(src.getValue()) : new org.hl7.fhir.r5.model.MarkdownType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r4.model.MarkdownType convertMarkdown(org.hl7.fhir.r5.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.r4.model.MarkdownType tgt = new org.hl7.fhir.r4.model.MarkdownType(src.getValue()); + org.hl7.fhir.r4.model.MarkdownType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.MarkdownType(src.getValue()) : new org.hl7.fhir.r4.model.MarkdownType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.OidType convertOid(org.hl7.fhir.r4.model.OidType src) throws FHIRException { - org.hl7.fhir.r5.model.OidType tgt = new org.hl7.fhir.r5.model.OidType(src.getValue()); + org.hl7.fhir.r5.model.OidType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.OidType(src.getValue()) : new org.hl7.fhir.r5.model.OidType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r4.model.OidType convertOid(org.hl7.fhir.r5.model.OidType src) throws FHIRException { - org.hl7.fhir.r4.model.OidType tgt = new org.hl7.fhir.r4.model.OidType(src.getValue()); + org.hl7.fhir.r4.model.OidType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.OidType(src.getValue()) : new org.hl7.fhir.r4.model.OidType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r4.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.r5.model.PositiveIntType tgt = new org.hl7.fhir.r5.model.PositiveIntType(src.getValue()); + org.hl7.fhir.r5.model.PositiveIntType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.PositiveIntType(src.getValue()) : new org.hl7.fhir.r5.model.PositiveIntType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r4.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r5.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.r4.model.PositiveIntType tgt = new org.hl7.fhir.r4.model.PositiveIntType(src.getValue()); + org.hl7.fhir.r4.model.PositiveIntType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.PositiveIntType(src.getValue()) : new org.hl7.fhir.r4.model.PositiveIntType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.StringType convertString(org.hl7.fhir.r4.model.StringType src) throws FHIRException { - org.hl7.fhir.r5.model.StringType tgt = new org.hl7.fhir.r5.model.StringType(src.getValue()); + org.hl7.fhir.r5.model.StringType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.StringType(src.getValue()) : new org.hl7.fhir.r5.model.StringType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r4.model.StringType convertString(org.hl7.fhir.r5.model.StringType src) throws FHIRException { - org.hl7.fhir.r4.model.StringType tgt = new org.hl7.fhir.r4.model.StringType(src.getValue()); + org.hl7.fhir.r4.model.StringType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.StringType(src.getValue()) : new org.hl7.fhir.r4.model.StringType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.TimeType convertTime(org.hl7.fhir.r4.model.TimeType src) throws FHIRException { - org.hl7.fhir.r5.model.TimeType tgt = new org.hl7.fhir.r5.model.TimeType(src.getValue()); + org.hl7.fhir.r5.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.TimeType(src.getValue()) : new org.hl7.fhir.r5.model.TimeType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r4.model.TimeType convertTime(org.hl7.fhir.r5.model.TimeType src) throws FHIRException { - org.hl7.fhir.r4.model.TimeType tgt = new org.hl7.fhir.r4.model.TimeType(src.getValue()); + org.hl7.fhir.r4.model.TimeType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.TimeType(src.getValue()) : new org.hl7.fhir.r4.model.TimeType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r4.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.r5.model.UnsignedIntType tgt = new org.hl7.fhir.r5.model.UnsignedIntType(src.getValue()); + org.hl7.fhir.r5.model.UnsignedIntType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.UnsignedIntType(src.getValue()) : new org.hl7.fhir.r5.model.UnsignedIntType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r4.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r5.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.r4.model.UnsignedIntType tgt = new org.hl7.fhir.r4.model.UnsignedIntType(src.getValue()); + org.hl7.fhir.r4.model.UnsignedIntType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.UnsignedIntType(src.getValue()) : new org.hl7.fhir.r4.model.UnsignedIntType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.UriType convertUri(org.hl7.fhir.r4.model.UriType src) throws FHIRException { - org.hl7.fhir.r5.model.UriType tgt = new org.hl7.fhir.r5.model.UriType(src.getValue()); + org.hl7.fhir.r5.model.UriType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.UriType(src.getValue()) : new org.hl7.fhir.r5.model.UriType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r4.model.UriType convertUri(org.hl7.fhir.r5.model.UriType src) throws FHIRException { - org.hl7.fhir.r4.model.UriType tgt = new org.hl7.fhir.r4.model.UriType(src.getValue()); + org.hl7.fhir.r4.model.UriType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.UriType(src.getValue()) : new org.hl7.fhir.r4.model.UriType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.UrlType convertUrl(org.hl7.fhir.r4.model.UrlType src) throws FHIRException { - org.hl7.fhir.r5.model.UrlType tgt = new org.hl7.fhir.r5.model.UrlType(src.getValue()); + org.hl7.fhir.r5.model.UrlType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.UrlType(src.getValue()) : new org.hl7.fhir.r5.model.UrlType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r4.model.UrlType convertUrl(org.hl7.fhir.r5.model.UrlType src) throws FHIRException { - org.hl7.fhir.r4.model.UrlType tgt = new org.hl7.fhir.r4.model.UrlType(src.getValue()); + org.hl7.fhir.r4.model.UrlType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.UrlType(src.getValue()) : new org.hl7.fhir.r4.model.UrlType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r5.model.UuidType convertUuid(org.hl7.fhir.r4.model.UuidType src) throws FHIRException { - org.hl7.fhir.r5.model.UuidType tgt = new org.hl7.fhir.r5.model.UuidType(src.getValue()); + org.hl7.fhir.r5.model.UuidType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.UuidType(src.getValue()) : new org.hl7.fhir.r5.model.UuidType(); copyElement(src, tgt); return tgt; } public static org.hl7.fhir.r4.model.UuidType convertUuid(org.hl7.fhir.r5.model.UuidType src) throws FHIRException { - org.hl7.fhir.r4.model.UuidType tgt = new org.hl7.fhir.r4.model.UuidType(src.getValue()); + org.hl7.fhir.r4.model.UuidType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.UuidType(src.getValue()) : new org.hl7.fhir.r4.model.UuidType(); copyElement(src, tgt); return tgt; } diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType10_30Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType10_30Test.java new file mode 100644 index 000000000..1f08808a9 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType10_30Test.java @@ -0,0 +1,76 @@ +package org.hl7.fhir.convertors; + +import org.hl7.fhir.dstu2.model.BooleanType; +import org.hl7.fhir.dstu2.model.CodeType; +import org.hl7.fhir.dstu2.model.DateType; +import org.hl7.fhir.dstu2.model.DateTimeType; +import org.hl7.fhir.dstu2.model.DecimalType; +import org.hl7.fhir.dstu2.model.IdType; +import org.hl7.fhir.dstu2.model.InstantType; +import org.hl7.fhir.dstu2.model.PositiveIntType; +import org.hl7.fhir.dstu2.model.UnsignedIntType; +import org.hl7.fhir.dstu2.model.IntegerType; +import org.hl7.fhir.dstu2.model.MarkdownType; +import org.hl7.fhir.dstu2.model.OidType; +import org.hl7.fhir.dstu2.model.StringType; +import org.hl7.fhir.dstu2.model.TimeType; +import org.hl7.fhir.dstu2.model.UuidType; +import org.hl7.fhir.dstu2.model.PrimitiveType; +import org.hl7.fhir.dstu2.model.Base64BinaryType; +import org.hl7.fhir.dstu2.model.UriType; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +import java.io.Serializable; +import java.util.stream.Stream; + +public class VersionConvertorPrimitiveType10_30Test { + + + + @Test + @DisplayName("Test 10_30 UnsignedIntType preserves value on conversion.") + public void testConvertUnsignedInt() { + org.hl7.fhir.dstu3.model.UnsignedIntType output; + output = (org.hl7.fhir.dstu3.model.UnsignedIntType)VersionConvertor_10_30.convertType(new org.hl7.fhir.dstu2.model.UnsignedIntType(33)); + Assertions.assertEquals(33, output.getValue().intValue()); + } + +// @Test +// @DisplayName("Test 10_30 conversion has null safety for UnsignedIntType value.") +// public void testConvertEmptyValuedUnsignedInt() { +// org.hl7.fhir.dstu2.model.UnsignedIntType input = new org.hl7.fhir.dstu2.model.UnsignedIntType(); +// input.addExtension().setUrl("http://example.com/AnyValue").setValue(new org.hl7.fhir.dstu2.model.StringType("A value")); +// org.hl7.fhir.dstu3.model.UnsignedIntType output; +// output = (org.hl7.fhir.dstu3.model.UnsignedIntType)VersionConvertor_10_30.convertType(input); +// Assertions.assertNull(output.getValue()); +// } +// +// @Test +// @DisplayName("Test 10_30 conversion has null safety for UnsignedIntType value.") +// public void testConvertEmptyValuedUnsignedInt() { +// UnsignedIntType input = new UnsignedIntType(); +// input.addExtension().setUrl("http://example.com/AnyValue").setValue(new StringType("A value")); +// +// Assertions.assertNull(((org.hl7.fhir.dstu3.model.PrimitiveType) VersionConvertor_10_30.convertType(input)).getValue();); +// } + + @ParameterizedTest(name = "{0} converstion") + @MethodSource("PrimitiveTypes") + public void testNullValuePrimitive(T obj) { + obj.addExtension().setUrl("http://example.com/AnyValue").setValue(new org.hl7.fhir.dstu3.model.StringType("A value")); + Assertions.assertNull(((org.hl7.fhir.dstu3.model.PrimitiveType) VersionConvertor_10_30.convertType(obj)).getValue()); + } + + public Stream PrimitiveTypes() { + return Stream.of(new UnsignedIntType(), new Base64BinaryType()); + } + + + +} + diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertor_10_30Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertor_10_30Test.java index ab6e543dd..f9134d1c5 100644 --- a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertor_10_30Test.java +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertor_10_30Test.java @@ -1,18 +1,28 @@ package org.hl7.fhir.convertors; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; public class VersionConvertor_10_30Test { @Test + @DisplayName("Test 10_30 UnsignedIntType preserves value on conversion.") public void testConvertUnsignedInt() { - org.hl7.fhir.dstu3.model.UnsignedIntType output; output = (org.hl7.fhir.dstu3.model.UnsignedIntType)VersionConvertor_10_30.convertType(new org.hl7.fhir.dstu2.model.UnsignedIntType(33)); - assertEquals(33, output.getValue().intValue()); + Assertions.assertEquals(33, output.getValue().intValue()); + } + @Test + @DisplayName("Test 10_30 conversion does null check on UnsignedIntType.") + public void testConvertEmptyValuedUnsignedInt() { + org.hl7.fhir.dstu2.model.UnsignedIntType input = new org.hl7.fhir.dstu2.model.UnsignedIntType(); + input.addExtension().setUrl("http://example.com/AnyValue").setValue(new org.hl7.fhir.dstu2.model.StringType("A value")); + org.hl7.fhir.dstu3.model.UnsignedIntType output; + output = (org.hl7.fhir.dstu3.model.UnsignedIntType)VersionConvertor_10_30.convertType(input); + Assertions.assertNull(output.getValue()); } } + diff --git a/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/model/Element.java b/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/model/Element.java index 143982e56..4bb033fc0 100644 --- a/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/model/Element.java +++ b/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/model/Element.java @@ -52,6 +52,7 @@ package org.hl7.fhir.dstu3.model; // Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x import java.util.ArrayList; import java.util.List; +import java.util.stream.Stream; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.instance.model.api.IBaseElement; diff --git a/org.hl7.fhir.validation/pom.xml b/org.hl7.fhir.validation/pom.xml index feed9d8c9..6ca85d51f 100644 --- a/org.hl7.fhir.validation/pom.xml +++ b/org.hl7.fhir.validation/pom.xml @@ -138,7 +138,6 @@ ${validator_test_case_version} test - diff --git a/pom.xml b/pom.xml index 0a87eca61..c536acc5d 100644 --- a/pom.xml +++ b/pom.xml @@ -18,6 +18,7 @@ 4.2.0 1.1.6-SNAPSHOT + 5.6.2 org.hl7.fhir.core @@ -70,12 +71,23 @@ test + + + org.junit.jupiter + junit-jupiter-api + ${junit_jupiter_version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit_jupiter_version} + test + - - ca.uhn.hapi.fhir hapi-fhir-base From 8093524f4b8c44390cfeea5356047080a67398c8 Mon Sep 17 00:00:00 2001 From: markiantorno Date: Mon, 20 Apr 2020 15:13:42 -0400 Subject: [PATCH 2/6] Null value check for primitive type conversions. --- ...ersionConvertorPrimitiveType10_30Test.java | 88 ++++++++++--------- ...ersionConvertorPrimitiveType10_40Test.java | 67 ++++++++++++++ ...ersionConvertorPrimitiveType10_50Test.java | 67 ++++++++++++++ ...ersionConvertorPrimitiveType30_40Test.java | 67 ++++++++++++++ ...ersionConvertorPrimitiveType30_50Test.java | 67 ++++++++++++++ ...ersionConvertorPrimitiveType40_50Test.java | 67 ++++++++++++++ .../VersionConvertor_10_30Test.java | 10 --- 7 files changed, 383 insertions(+), 50 deletions(-) create mode 100644 org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType10_40Test.java create mode 100644 org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType10_50Test.java create mode 100644 org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType30_40Test.java create mode 100644 org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType30_50Test.java create mode 100644 org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType40_50Test.java diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType10_30Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType10_30Test.java index 1f08808a9..1b1accf9a 100644 --- a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType10_30Test.java +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType10_30Test.java @@ -5,7 +5,6 @@ import org.hl7.fhir.dstu2.model.CodeType; import org.hl7.fhir.dstu2.model.DateType; import org.hl7.fhir.dstu2.model.DateTimeType; import org.hl7.fhir.dstu2.model.DecimalType; -import org.hl7.fhir.dstu2.model.IdType; import org.hl7.fhir.dstu2.model.InstantType; import org.hl7.fhir.dstu2.model.PositiveIntType; import org.hl7.fhir.dstu2.model.UnsignedIntType; @@ -20,57 +19,66 @@ import org.hl7.fhir.dstu2.model.Base64BinaryType; import org.hl7.fhir.dstu2.model.UriType; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import java.io.Serializable; import java.util.stream.Stream; public class VersionConvertorPrimitiveType10_30Test { - - - @Test - @DisplayName("Test 10_30 UnsignedIntType preserves value on conversion.") - public void testConvertUnsignedInt() { - org.hl7.fhir.dstu3.model.UnsignedIntType output; - output = (org.hl7.fhir.dstu3.model.UnsignedIntType)VersionConvertor_10_30.convertType(new org.hl7.fhir.dstu2.model.UnsignedIntType(33)); - Assertions.assertEquals(33, output.getValue().intValue()); - } - -// @Test -// @DisplayName("Test 10_30 conversion has null safety for UnsignedIntType value.") -// public void testConvertEmptyValuedUnsignedInt() { -// org.hl7.fhir.dstu2.model.UnsignedIntType input = new org.hl7.fhir.dstu2.model.UnsignedIntType(); -// input.addExtension().setUrl("http://example.com/AnyValue").setValue(new org.hl7.fhir.dstu2.model.StringType("A value")); -// org.hl7.fhir.dstu3.model.UnsignedIntType output; -// output = (org.hl7.fhir.dstu3.model.UnsignedIntType)VersionConvertor_10_30.convertType(input); -// Assertions.assertNull(output.getValue()); -// } -// -// @Test -// @DisplayName("Test 10_30 conversion has null safety for UnsignedIntType value.") -// public void testConvertEmptyValuedUnsignedInt() { -// UnsignedIntType input = new UnsignedIntType(); -// input.addExtension().setUrl("http://example.com/AnyValue").setValue(new StringType("A value")); -// -// Assertions.assertNull(((org.hl7.fhir.dstu3.model.PrimitiveType) VersionConvertor_10_30.convertType(input)).getValue();); -// } - - @ParameterizedTest(name = "{0} converstion") - @MethodSource("PrimitiveTypes") - public void testNullValuePrimitive(T obj) { - obj.addExtension().setUrl("http://example.com/AnyValue").setValue(new org.hl7.fhir.dstu3.model.StringType("A value")); + @ParameterizedTest(name = "Testing dstu2 -> dstu3 conversion of null value {0}.") + @MethodSource("dstu2PrimitiveTypes") + public void testNullValueDstu2Primitive(String classname, T obj) { + obj.addExtension().setUrl("http://example.com/AnyValue").setValue(new StringType("A value")); Assertions.assertNull(((org.hl7.fhir.dstu3.model.PrimitiveType) VersionConvertor_10_30.convertType(obj)).getValue()); } - public Stream PrimitiveTypes() { - return Stream.of(new UnsignedIntType(), new Base64BinaryType()); + @ParameterizedTest(name = "Testing dstu3 -> dstu2 conversion of null value {0}.") + @MethodSource("Dstu3PrimitiveTypes") + public void testNullValueDstu3Primitive(String classname, T obj) { + obj.addExtension().setUrl("http://example.com/AnyValue").setValue(new org.hl7.fhir.dstu3.model.StringType("A value")); + Assertions.assertNull(((org.hl7.fhir.dstu2.model.PrimitiveType) VersionConvertor_10_30.convertType(obj)).getValue()); } + public static Stream dstu2PrimitiveTypes() { + return Stream.of( + Arguments.arguments(BooleanType.class.getSimpleName(), new BooleanType()), + Arguments.arguments(CodeType.class.getSimpleName(), new CodeType()), + Arguments.arguments(DateType.class.getSimpleName(), new DateType()), + Arguments.arguments(DateTimeType.class.getSimpleName(), new DateTimeType()), + Arguments.arguments(DecimalType.class.getSimpleName(), new DecimalType()), + Arguments.arguments(InstantType.class.getSimpleName(), new InstantType()), + Arguments.arguments(PositiveIntType.class.getSimpleName(), new PositiveIntType()), + Arguments.arguments(UnsignedIntType.class.getSimpleName(), new UnsignedIntType()), + Arguments.arguments(IntegerType.class.getSimpleName(), new IntegerType()), + Arguments.arguments(MarkdownType.class.getSimpleName(), new MarkdownType()), + Arguments.arguments(OidType.class.getSimpleName(), new OidType()), + Arguments.arguments(StringType.class.getSimpleName(), new StringType()), + Arguments.arguments(TimeType.class.getSimpleName(), new TimeType()), + Arguments.arguments(UuidType.class.getSimpleName(), new UuidType()), + Arguments.arguments(Base64BinaryType.class.getSimpleName(), new Base64BinaryType()), + Arguments.arguments(UriType.class.getSimpleName(), new UriType())); + } - + public static Stream Dstu3PrimitiveTypes() { + return Stream.of( + Arguments.arguments(org.hl7.fhir.dstu3.model.BooleanType.class.getSimpleName(), new org.hl7.fhir.dstu3.model.BooleanType()), + Arguments.arguments(org.hl7.fhir.dstu3.model.CodeType.class.getSimpleName(), new org.hl7.fhir.dstu3.model.CodeType()), + Arguments.arguments(org.hl7.fhir.dstu3.model.DateType.class.getSimpleName(), new org.hl7.fhir.dstu3.model.DateType()), + Arguments.arguments(org.hl7.fhir.dstu3.model.DateTimeType.class.getSimpleName(), new org.hl7.fhir.dstu3.model.DateTimeType()), + Arguments.arguments(org.hl7.fhir.dstu3.model.DecimalType.class.getSimpleName(), new org.hl7.fhir.dstu3.model.DecimalType()), + Arguments.arguments(org.hl7.fhir.dstu3.model.InstantType.class.getSimpleName(), new org.hl7.fhir.dstu3.model.InstantType()), + Arguments.arguments(org.hl7.fhir.dstu3.model.PositiveIntType.class.getSimpleName(), new org.hl7.fhir.dstu3.model.PositiveIntType()), + Arguments.arguments(org.hl7.fhir.dstu3.model.UnsignedIntType.class.getSimpleName(), new org.hl7.fhir.dstu3.model.UnsignedIntType()), + Arguments.arguments(org.hl7.fhir.dstu3.model.IntegerType.class.getSimpleName(), new org.hl7.fhir.dstu3.model.IntegerType()), + Arguments.arguments(org.hl7.fhir.dstu3.model.MarkdownType.class.getSimpleName(), new org.hl7.fhir.dstu3.model.MarkdownType()), + Arguments.arguments(org.hl7.fhir.dstu3.model.OidType.class.getSimpleName(), new org.hl7.fhir.dstu3.model.OidType()), + Arguments.arguments(org.hl7.fhir.dstu3.model.StringType.class.getSimpleName(), new org.hl7.fhir.dstu3.model.StringType()), + Arguments.arguments(org.hl7.fhir.dstu3.model.TimeType.class.getSimpleName(), new org.hl7.fhir.dstu3.model.TimeType()), + Arguments.arguments(org.hl7.fhir.dstu3.model.UuidType.class.getSimpleName(), new org.hl7.fhir.dstu3.model.UuidType()), + Arguments.arguments(org.hl7.fhir.dstu3.model.Base64BinaryType.class.getSimpleName(), new org.hl7.fhir.dstu3.model.Base64BinaryType()), + Arguments.arguments(org.hl7.fhir.dstu3.model.UriType.class.getSimpleName(), new org.hl7.fhir.dstu3.model.UriType())); + } } diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType10_40Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType10_40Test.java new file mode 100644 index 000000000..d6c04a959 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType10_40Test.java @@ -0,0 +1,67 @@ +package org.hl7.fhir.convertors; + +import org.hl7.fhir.dstu2.model.*; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.stream.Stream; + +public class VersionConvertorPrimitiveType10_40Test { + + @ParameterizedTest(name = "Testing dstu2 -> r4 conversion of null value {0}.") + @MethodSource("dstu2PrimitiveTypes") + public void testNullValueDstu2Primitive(String classname, T obj) { + obj.addExtension().setUrl("http://example.com/AnyValue").setValue(new StringType("A value")); + Assertions.assertNull(((org.hl7.fhir.r4.model.PrimitiveType) VersionConvertor_10_40.convertType(obj)).getValue()); + } + + @ParameterizedTest(name = "Testing r4 -> dstu2 conversion of null value {0}.") + @MethodSource("r4PrimitiveTypes") + public void testNullValueR4Primitive(String classname, T obj) { + obj.addExtension().setUrl("http://example.com/AnyValue").setValue(new org.hl7.fhir.r4.model.StringType("A value")); + Assertions.assertNull(((PrimitiveType) VersionConvertor_10_40.convertType(obj)).getValue()); + } + + public static Stream dstu2PrimitiveTypes() { + return Stream.of( + Arguments.arguments(BooleanType.class.getSimpleName(), new BooleanType()), + Arguments.arguments(CodeType.class.getSimpleName(), new CodeType()), + Arguments.arguments(DateType.class.getSimpleName(), new DateType()), + Arguments.arguments(DateTimeType.class.getSimpleName(), new DateTimeType()), + Arguments.arguments(DecimalType.class.getSimpleName(), new DecimalType()), + Arguments.arguments(InstantType.class.getSimpleName(), new InstantType()), + Arguments.arguments(PositiveIntType.class.getSimpleName(), new PositiveIntType()), + Arguments.arguments(UnsignedIntType.class.getSimpleName(), new UnsignedIntType()), + Arguments.arguments(IntegerType.class.getSimpleName(), new IntegerType()), + Arguments.arguments(MarkdownType.class.getSimpleName(), new MarkdownType()), + Arguments.arguments(OidType.class.getSimpleName(), new OidType()), + Arguments.arguments(StringType.class.getSimpleName(), new StringType()), + Arguments.arguments(TimeType.class.getSimpleName(), new TimeType()), + Arguments.arguments(UuidType.class.getSimpleName(), new UuidType()), + Arguments.arguments(Base64BinaryType.class.getSimpleName(), new Base64BinaryType()), + Arguments.arguments(UriType.class.getSimpleName(), new UriType())); + } + + public static Stream r4PrimitiveTypes() { + return Stream.of( + Arguments.arguments(org.hl7.fhir.r4.model.BooleanType.class.getSimpleName(), new org.hl7.fhir.r4.model.BooleanType()), + Arguments.arguments(org.hl7.fhir.r4.model.CodeType.class.getSimpleName(), new org.hl7.fhir.r4.model.CodeType()), + Arguments.arguments(org.hl7.fhir.r4.model.DateType.class.getSimpleName(), new org.hl7.fhir.r4.model.DateType()), + Arguments.arguments(org.hl7.fhir.r4.model.DateTimeType.class.getSimpleName(), new org.hl7.fhir.r4.model.DateTimeType()), + Arguments.arguments(org.hl7.fhir.r4.model.DecimalType.class.getSimpleName(), new org.hl7.fhir.r4.model.DecimalType()), + Arguments.arguments(org.hl7.fhir.r4.model.InstantType.class.getSimpleName(), new org.hl7.fhir.r4.model.InstantType()), + Arguments.arguments(org.hl7.fhir.r4.model.PositiveIntType.class.getSimpleName(), new org.hl7.fhir.r4.model.PositiveIntType()), + Arguments.arguments(org.hl7.fhir.r4.model.UnsignedIntType.class.getSimpleName(), new org.hl7.fhir.r4.model.UnsignedIntType()), + Arguments.arguments(org.hl7.fhir.r4.model.IntegerType.class.getSimpleName(), new org.hl7.fhir.r4.model.IntegerType()), + Arguments.arguments(org.hl7.fhir.r4.model.MarkdownType.class.getSimpleName(), new org.hl7.fhir.r4.model.MarkdownType()), + Arguments.arguments(org.hl7.fhir.r4.model.OidType.class.getSimpleName(), new org.hl7.fhir.r4.model.OidType()), + Arguments.arguments(org.hl7.fhir.r4.model.StringType.class.getSimpleName(), new org.hl7.fhir.r4.model.StringType()), + Arguments.arguments(org.hl7.fhir.r4.model.TimeType.class.getSimpleName(), new org.hl7.fhir.r4.model.TimeType()), + Arguments.arguments(org.hl7.fhir.r4.model.UuidType.class.getSimpleName(), new org.hl7.fhir.r4.model.UuidType()), + Arguments.arguments(org.hl7.fhir.r4.model.Base64BinaryType.class.getSimpleName(), new org.hl7.fhir.r4.model.Base64BinaryType()), + Arguments.arguments(org.hl7.fhir.r4.model.UriType.class.getSimpleName(), new org.hl7.fhir.r4.model.UriType())); + } +} + diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType10_50Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType10_50Test.java new file mode 100644 index 000000000..aba2d717f --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType10_50Test.java @@ -0,0 +1,67 @@ +package org.hl7.fhir.convertors; + +import org.hl7.fhir.dstu2.model.*; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.stream.Stream; + +public class VersionConvertorPrimitiveType10_50Test { + + @ParameterizedTest(name = "Testing dstu2 -> r5 conversion of null value {0}.") + @MethodSource("dstu2PrimitiveTypes") + public void testNullValueDstu2Primitive(String classname, T obj) { + obj.addExtension().setUrl("http://example.com/AnyValue").setValue(new StringType("A value")); + Assertions.assertNull(((org.hl7.fhir.r4.model.PrimitiveType) VersionConvertor_10_40.convertType(obj)).getValue()); + } + + @ParameterizedTest(name = "Testing r5 -> dstu2 conversion of null value {0}.") + @MethodSource("r5PrimitiveTypes") + public void testNullValueR5Primitive(String classname, T obj) { + obj.addExtension().setUrl("http://example.com/AnyValue").setValue(new org.hl7.fhir.r5.model.StringType("A value")); + Assertions.assertNull(((PrimitiveType) VersionConvertor_10_50.convertType(obj)).getValue()); + } + + public static Stream dstu2PrimitiveTypes() { + return Stream.of( + Arguments.arguments(BooleanType.class.getSimpleName(), new BooleanType()), + Arguments.arguments(CodeType.class.getSimpleName(), new CodeType()), + Arguments.arguments(DateType.class.getSimpleName(), new DateType()), + Arguments.arguments(DateTimeType.class.getSimpleName(), new DateTimeType()), + Arguments.arguments(DecimalType.class.getSimpleName(), new DecimalType()), + Arguments.arguments(InstantType.class.getSimpleName(), new InstantType()), + Arguments.arguments(PositiveIntType.class.getSimpleName(), new PositiveIntType()), + Arguments.arguments(UnsignedIntType.class.getSimpleName(), new UnsignedIntType()), + Arguments.arguments(IntegerType.class.getSimpleName(), new IntegerType()), + Arguments.arguments(MarkdownType.class.getSimpleName(), new MarkdownType()), + Arguments.arguments(OidType.class.getSimpleName(), new OidType()), + Arguments.arguments(StringType.class.getSimpleName(), new StringType()), + Arguments.arguments(TimeType.class.getSimpleName(), new TimeType()), + Arguments.arguments(UuidType.class.getSimpleName(), new UuidType()), + Arguments.arguments(Base64BinaryType.class.getSimpleName(), new Base64BinaryType()), + Arguments.arguments(UriType.class.getSimpleName(), new UriType())); + } + + public static Stream r5PrimitiveTypes() { + return Stream.of( + Arguments.arguments(org.hl7.fhir.r5.model.BooleanType.class.getSimpleName(), new org.hl7.fhir.r5.model.BooleanType()), + Arguments.arguments(org.hl7.fhir.r5.model.CodeType.class.getSimpleName(), new org.hl7.fhir.r5.model.CodeType()), + Arguments.arguments(org.hl7.fhir.r5.model.DateType.class.getSimpleName(), new org.hl7.fhir.r5.model.DateType()), + Arguments.arguments(org.hl7.fhir.r5.model.DateTimeType.class.getSimpleName(), new org.hl7.fhir.r5.model.DateTimeType()), + Arguments.arguments(org.hl7.fhir.r5.model.DecimalType.class.getSimpleName(), new org.hl7.fhir.r5.model.DecimalType()), + Arguments.arguments(org.hl7.fhir.r5.model.InstantType.class.getSimpleName(), new org.hl7.fhir.r5.model.InstantType()), + Arguments.arguments(org.hl7.fhir.r5.model.PositiveIntType.class.getSimpleName(), new org.hl7.fhir.r5.model.PositiveIntType()), + Arguments.arguments(org.hl7.fhir.r5.model.UnsignedIntType.class.getSimpleName(), new org.hl7.fhir.r5.model.UnsignedIntType()), + Arguments.arguments(org.hl7.fhir.r5.model.IntegerType.class.getSimpleName(), new org.hl7.fhir.r5.model.IntegerType()), + Arguments.arguments(org.hl7.fhir.r5.model.MarkdownType.class.getSimpleName(), new org.hl7.fhir.r5.model.MarkdownType()), + Arguments.arguments(org.hl7.fhir.r5.model.OidType.class.getSimpleName(), new org.hl7.fhir.r5.model.OidType()), + Arguments.arguments(org.hl7.fhir.r5.model.StringType.class.getSimpleName(), new org.hl7.fhir.r5.model.StringType()), + Arguments.arguments(org.hl7.fhir.r5.model.TimeType.class.getSimpleName(), new org.hl7.fhir.r5.model.TimeType()), + Arguments.arguments(org.hl7.fhir.r5.model.UuidType.class.getSimpleName(), new org.hl7.fhir.r5.model.UuidType()), + Arguments.arguments(org.hl7.fhir.r5.model.Base64BinaryType.class.getSimpleName(), new org.hl7.fhir.r5.model.Base64BinaryType()), + Arguments.arguments(org.hl7.fhir.r5.model.UriType.class.getSimpleName(), new org.hl7.fhir.r5.model.UriType())); + } +} + diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType30_40Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType30_40Test.java new file mode 100644 index 000000000..58bb89d35 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType30_40Test.java @@ -0,0 +1,67 @@ +package org.hl7.fhir.convertors; + +import org.hl7.fhir.dstu3.model.*; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.stream.Stream; + +public class VersionConvertorPrimitiveType30_40Test { + + @ParameterizedTest(name = "Testing dstu3 -> r4 conversion of null value {0}.") + @MethodSource("dstu3PrimitiveTypes") + public void testNullValueDstu2Primitive(String classname, T obj) { + obj.addExtension().setUrl("http://example.com/AnyValue").setValue(new StringType("A value")); + Assertions.assertNull(((org.hl7.fhir.r4.model.PrimitiveType) VersionConvertor_30_40.convertType(obj)).getValue()); + } + + @ParameterizedTest(name = "Testing r4 -> dstu3 conversion of null value {0}.") + @MethodSource("r4PrimitiveTypes") + public void testNullValueR4Primitive(String classname, T obj) { + obj.addExtension().setUrl("http://example.com/AnyValue").setValue(new org.hl7.fhir.r4.model.StringType("A value")); + Assertions.assertNull(((PrimitiveType) VersionConvertor_30_40.convertType(obj)).getValue()); + } + + public static Stream dstu3PrimitiveTypes() { + return Stream.of( + Arguments.arguments(BooleanType.class.getSimpleName(), new BooleanType()), + Arguments.arguments(CodeType.class.getSimpleName(), new CodeType()), + Arguments.arguments(DateType.class.getSimpleName(), new DateType()), + Arguments.arguments(DateTimeType.class.getSimpleName(), new DateTimeType()), + Arguments.arguments(DecimalType.class.getSimpleName(), new DecimalType()), + Arguments.arguments(InstantType.class.getSimpleName(), new InstantType()), + Arguments.arguments(PositiveIntType.class.getSimpleName(), new PositiveIntType()), + Arguments.arguments(UnsignedIntType.class.getSimpleName(), new UnsignedIntType()), + Arguments.arguments(IntegerType.class.getSimpleName(), new IntegerType()), + Arguments.arguments(MarkdownType.class.getSimpleName(), new MarkdownType()), + Arguments.arguments(OidType.class.getSimpleName(), new OidType()), + Arguments.arguments(StringType.class.getSimpleName(), new StringType()), + Arguments.arguments(TimeType.class.getSimpleName(), new TimeType()), + Arguments.arguments(UuidType.class.getSimpleName(), new UuidType()), + Arguments.arguments(Base64BinaryType.class.getSimpleName(), new Base64BinaryType()), + Arguments.arguments(UriType.class.getSimpleName(), new UriType())); + } + + public static Stream r4PrimitiveTypes() { + return Stream.of( + Arguments.arguments(org.hl7.fhir.r4.model.BooleanType.class.getSimpleName(), new org.hl7.fhir.r4.model.BooleanType()), + Arguments.arguments(org.hl7.fhir.r4.model.CodeType.class.getSimpleName(), new org.hl7.fhir.r4.model.CodeType()), + Arguments.arguments(org.hl7.fhir.r4.model.DateType.class.getSimpleName(), new org.hl7.fhir.r4.model.DateType()), + Arguments.arguments(org.hl7.fhir.r4.model.DateTimeType.class.getSimpleName(), new org.hl7.fhir.r4.model.DateTimeType()), + Arguments.arguments(org.hl7.fhir.r4.model.DecimalType.class.getSimpleName(), new org.hl7.fhir.r4.model.DecimalType()), + Arguments.arguments(org.hl7.fhir.r4.model.InstantType.class.getSimpleName(), new org.hl7.fhir.r4.model.InstantType()), + Arguments.arguments(org.hl7.fhir.r4.model.PositiveIntType.class.getSimpleName(), new org.hl7.fhir.r4.model.PositiveIntType()), + Arguments.arguments(org.hl7.fhir.r4.model.UnsignedIntType.class.getSimpleName(), new org.hl7.fhir.r4.model.UnsignedIntType()), + Arguments.arguments(org.hl7.fhir.r4.model.IntegerType.class.getSimpleName(), new org.hl7.fhir.r4.model.IntegerType()), + Arguments.arguments(org.hl7.fhir.r4.model.MarkdownType.class.getSimpleName(), new org.hl7.fhir.r4.model.MarkdownType()), + Arguments.arguments(org.hl7.fhir.r4.model.OidType.class.getSimpleName(), new org.hl7.fhir.r4.model.OidType()), + Arguments.arguments(org.hl7.fhir.r4.model.StringType.class.getSimpleName(), new org.hl7.fhir.r4.model.StringType()), + Arguments.arguments(org.hl7.fhir.r4.model.TimeType.class.getSimpleName(), new org.hl7.fhir.r4.model.TimeType()), + Arguments.arguments(org.hl7.fhir.r4.model.UuidType.class.getSimpleName(), new org.hl7.fhir.r4.model.UuidType()), + Arguments.arguments(org.hl7.fhir.r4.model.Base64BinaryType.class.getSimpleName(), new org.hl7.fhir.r4.model.Base64BinaryType()), + Arguments.arguments(org.hl7.fhir.r4.model.UriType.class.getSimpleName(), new org.hl7.fhir.r4.model.UriType())); + } +} + diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType30_50Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType30_50Test.java new file mode 100644 index 000000000..385a46d10 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType30_50Test.java @@ -0,0 +1,67 @@ +package org.hl7.fhir.convertors; + +import org.hl7.fhir.dstu3.model.*; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.stream.Stream; + +public class VersionConvertorPrimitiveType30_50Test { + + @ParameterizedTest(name = "Testing dstu3 -> r5 conversion of null value {0}.") + @MethodSource("dstu3PrimitiveTypes") + public void testNullValueDstu2Primitive(String classname, T obj) { + obj.addExtension().setUrl("http://example.com/AnyValue").setValue(new StringType("A value")); + Assertions.assertNull(((org.hl7.fhir.r5.model.PrimitiveType) VersionConvertor_30_50.convertType(obj)).getValue()); + } + + @ParameterizedTest(name = "Testing r5 -> dstu3 conversion of null value {0}.") + @MethodSource("r5PrimitiveTypes") + public void testNullValueR5Primitive(String classname, T obj) { + obj.addExtension().setUrl("http://example.com/AnyValue").setValue(new org.hl7.fhir.r5.model.StringType("A value")); + Assertions.assertNull(((PrimitiveType) VersionConvertor_30_50.convertType(obj)).getValue()); + } + + public static Stream dstu3PrimitiveTypes() { + return Stream.of( + Arguments.arguments(BooleanType.class.getSimpleName(), new BooleanType()), + Arguments.arguments(CodeType.class.getSimpleName(), new CodeType()), + Arguments.arguments(DateType.class.getSimpleName(), new DateType()), + Arguments.arguments(DateTimeType.class.getSimpleName(), new DateTimeType()), + Arguments.arguments(DecimalType.class.getSimpleName(), new DecimalType()), + Arguments.arguments(InstantType.class.getSimpleName(), new InstantType()), + Arguments.arguments(PositiveIntType.class.getSimpleName(), new PositiveIntType()), + Arguments.arguments(UnsignedIntType.class.getSimpleName(), new UnsignedIntType()), + Arguments.arguments(IntegerType.class.getSimpleName(), new IntegerType()), + Arguments.arguments(MarkdownType.class.getSimpleName(), new MarkdownType()), + Arguments.arguments(OidType.class.getSimpleName(), new OidType()), + Arguments.arguments(StringType.class.getSimpleName(), new StringType()), + Arguments.arguments(TimeType.class.getSimpleName(), new TimeType()), + Arguments.arguments(UuidType.class.getSimpleName(), new UuidType()), + Arguments.arguments(Base64BinaryType.class.getSimpleName(), new Base64BinaryType()), + Arguments.arguments(UriType.class.getSimpleName(), new UriType())); + } + + public static Stream r5PrimitiveTypes() { + return Stream.of( + Arguments.arguments(org.hl7.fhir.r5.model.BooleanType.class.getSimpleName(), new org.hl7.fhir.r5.model.BooleanType()), + Arguments.arguments(org.hl7.fhir.r5.model.CodeType.class.getSimpleName(), new org.hl7.fhir.r5.model.CodeType()), + Arguments.arguments(org.hl7.fhir.r5.model.DateType.class.getSimpleName(), new org.hl7.fhir.r5.model.DateType()), + Arguments.arguments(org.hl7.fhir.r5.model.DateTimeType.class.getSimpleName(), new org.hl7.fhir.r5.model.DateTimeType()), + Arguments.arguments(org.hl7.fhir.r5.model.DecimalType.class.getSimpleName(), new org.hl7.fhir.r5.model.DecimalType()), + Arguments.arguments(org.hl7.fhir.r5.model.InstantType.class.getSimpleName(), new org.hl7.fhir.r5.model.InstantType()), + Arguments.arguments(org.hl7.fhir.r5.model.PositiveIntType.class.getSimpleName(), new org.hl7.fhir.r5.model.PositiveIntType()), + Arguments.arguments(org.hl7.fhir.r5.model.UnsignedIntType.class.getSimpleName(), new org.hl7.fhir.r5.model.UnsignedIntType()), + Arguments.arguments(org.hl7.fhir.r5.model.IntegerType.class.getSimpleName(), new org.hl7.fhir.r5.model.IntegerType()), + Arguments.arguments(org.hl7.fhir.r5.model.MarkdownType.class.getSimpleName(), new org.hl7.fhir.r5.model.MarkdownType()), + Arguments.arguments(org.hl7.fhir.r5.model.OidType.class.getSimpleName(), new org.hl7.fhir.r5.model.OidType()), + Arguments.arguments(org.hl7.fhir.r5.model.StringType.class.getSimpleName(), new org.hl7.fhir.r5.model.StringType()), + Arguments.arguments(org.hl7.fhir.r5.model.TimeType.class.getSimpleName(), new org.hl7.fhir.r5.model.TimeType()), + Arguments.arguments(org.hl7.fhir.r5.model.UuidType.class.getSimpleName(), new org.hl7.fhir.r5.model.UuidType()), + Arguments.arguments(org.hl7.fhir.r5.model.Base64BinaryType.class.getSimpleName(), new org.hl7.fhir.r5.model.Base64BinaryType()), + Arguments.arguments(org.hl7.fhir.r5.model.UriType.class.getSimpleName(), new org.hl7.fhir.r5.model.UriType())); + } +} + diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType40_50Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType40_50Test.java new file mode 100644 index 000000000..53e8a1767 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType40_50Test.java @@ -0,0 +1,67 @@ +package org.hl7.fhir.convertors; + +import org.hl7.fhir.r4.model.*; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.stream.Stream; + +public class VersionConvertorPrimitiveType40_50Test { + + @ParameterizedTest(name = "Testing r4 -> r5 conversion of null value {0}.") + @MethodSource("r4PrimitiveTypes") + public void testNullValueDstu2Primitive(String classname, T obj) { + obj.addExtension().setUrl("http://example.com/AnyValue").setValue(new StringType("A value")); + Assertions.assertNull(((org.hl7.fhir.r5.model.PrimitiveType) VersionConvertor_40_50.convertType(obj)).getValue()); + } + + @ParameterizedTest(name = "Testing r5 -> r4 conversion of null value {0}.") + @MethodSource("r5PrimitiveTypes") + public void testNullValueR5Primitive(String classname, T obj) { + obj.addExtension().setUrl("http://example.com/AnyValue").setValue(new org.hl7.fhir.r5.model.StringType("A value")); + Assertions.assertNull(((PrimitiveType) VersionConvertor_40_50.convertType(obj)).getValue()); + } + + public static Stream r4PrimitiveTypes() { + return Stream.of( + Arguments.arguments(BooleanType.class.getSimpleName(), new BooleanType()), + Arguments.arguments(CodeType.class.getSimpleName(), new CodeType()), + Arguments.arguments(DateType.class.getSimpleName(), new DateType()), + Arguments.arguments(DateTimeType.class.getSimpleName(), new DateTimeType()), + Arguments.arguments(DecimalType.class.getSimpleName(), new DecimalType()), + Arguments.arguments(InstantType.class.getSimpleName(), new InstantType()), + Arguments.arguments(PositiveIntType.class.getSimpleName(), new PositiveIntType()), + Arguments.arguments(UnsignedIntType.class.getSimpleName(), new UnsignedIntType()), + Arguments.arguments(IntegerType.class.getSimpleName(), new IntegerType()), + Arguments.arguments(MarkdownType.class.getSimpleName(), new MarkdownType()), + Arguments.arguments(OidType.class.getSimpleName(), new OidType()), + Arguments.arguments(StringType.class.getSimpleName(), new StringType()), + Arguments.arguments(TimeType.class.getSimpleName(), new TimeType()), + Arguments.arguments(UuidType.class.getSimpleName(), new UuidType()), + Arguments.arguments(Base64BinaryType.class.getSimpleName(), new Base64BinaryType()), + Arguments.arguments(UriType.class.getSimpleName(), new UriType())); + } + + public static Stream r5PrimitiveTypes() { + return Stream.of( + Arguments.arguments(org.hl7.fhir.r5.model.BooleanType.class.getSimpleName(), new org.hl7.fhir.r5.model.BooleanType()), + Arguments.arguments(org.hl7.fhir.r5.model.CodeType.class.getSimpleName(), new org.hl7.fhir.r5.model.CodeType()), + Arguments.arguments(org.hl7.fhir.r5.model.DateType.class.getSimpleName(), new org.hl7.fhir.r5.model.DateType()), + Arguments.arguments(org.hl7.fhir.r5.model.DateTimeType.class.getSimpleName(), new org.hl7.fhir.r5.model.DateTimeType()), + Arguments.arguments(org.hl7.fhir.r5.model.DecimalType.class.getSimpleName(), new org.hl7.fhir.r5.model.DecimalType()), + Arguments.arguments(org.hl7.fhir.r5.model.InstantType.class.getSimpleName(), new org.hl7.fhir.r5.model.InstantType()), + Arguments.arguments(org.hl7.fhir.r5.model.PositiveIntType.class.getSimpleName(), new org.hl7.fhir.r5.model.PositiveIntType()), + Arguments.arguments(org.hl7.fhir.r5.model.UnsignedIntType.class.getSimpleName(), new org.hl7.fhir.r5.model.UnsignedIntType()), + Arguments.arguments(org.hl7.fhir.r5.model.IntegerType.class.getSimpleName(), new org.hl7.fhir.r5.model.IntegerType()), + Arguments.arguments(org.hl7.fhir.r5.model.MarkdownType.class.getSimpleName(), new org.hl7.fhir.r5.model.MarkdownType()), + Arguments.arguments(org.hl7.fhir.r5.model.OidType.class.getSimpleName(), new org.hl7.fhir.r5.model.OidType()), + Arguments.arguments(org.hl7.fhir.r5.model.StringType.class.getSimpleName(), new org.hl7.fhir.r5.model.StringType()), + Arguments.arguments(org.hl7.fhir.r5.model.TimeType.class.getSimpleName(), new org.hl7.fhir.r5.model.TimeType()), + Arguments.arguments(org.hl7.fhir.r5.model.UuidType.class.getSimpleName(), new org.hl7.fhir.r5.model.UuidType()), + Arguments.arguments(org.hl7.fhir.r5.model.Base64BinaryType.class.getSimpleName(), new org.hl7.fhir.r5.model.Base64BinaryType()), + Arguments.arguments(org.hl7.fhir.r5.model.UriType.class.getSimpleName(), new org.hl7.fhir.r5.model.UriType())); + } +} + diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertor_10_30Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertor_10_30Test.java index f9134d1c5..f16b5a3c8 100644 --- a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertor_10_30Test.java +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertor_10_30Test.java @@ -14,15 +14,5 @@ public class VersionConvertor_10_30Test { Assertions.assertEquals(33, output.getValue().intValue()); } - @Test - @DisplayName("Test 10_30 conversion does null check on UnsignedIntType.") - public void testConvertEmptyValuedUnsignedInt() { - org.hl7.fhir.dstu2.model.UnsignedIntType input = new org.hl7.fhir.dstu2.model.UnsignedIntType(); - input.addExtension().setUrl("http://example.com/AnyValue").setValue(new org.hl7.fhir.dstu2.model.StringType("A value")); - org.hl7.fhir.dstu3.model.UnsignedIntType output; - output = (org.hl7.fhir.dstu3.model.UnsignedIntType)VersionConvertor_10_30.convertType(input); - Assertions.assertNull(output.getValue()); - } - } From e76c65e6c944dccc8b101a660070651556eacf62 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 21 Apr 2020 10:00:30 +1000 Subject: [PATCH 3/6] Fix problem expanding flat code systems --- .../fhir/r5/context/BaseWorkerContext.java | 6 ++- .../r5/terminologies/CodeSystemUtilities.java | 49 +++++++++++++++++++ .../terminologies/ValueSetExpanderSimple.java | 18 +++++-- 3 files changed, 68 insertions(+), 5 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java index d61c1134c..86208d186 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java @@ -81,6 +81,7 @@ import org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesCode import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent; import org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent; +import org.hl7.fhir.r5.terminologies.CodeSystemUtilities; import org.hl7.fhir.r5.terminologies.TerminologyClient; import org.hl7.fhir.r5.terminologies.ValueSetCheckerSimple; import org.hl7.fhir.r5.terminologies.ValueSetExpander.TerminologyServiceErrorClass; @@ -265,9 +266,10 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte structures.see(sd, packageInfo); } else if (r instanceof ValueSet) valueSets.see((ValueSet) m, packageInfo); - else if (r instanceof CodeSystem) + else if (r instanceof CodeSystem) { + CodeSystemUtilities.crossLinkCodeSystem((CodeSystem) r); codeSystems.see((CodeSystem) m, packageInfo); - else if (r instanceof ImplementationGuide) + } else if (r instanceof ImplementationGuide) guides.see((ImplementationGuide) m, packageInfo); else if (r instanceof CapabilityStatement) capstmts.see((CapabilityStatement) m, packageInfo); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/CodeSystemUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/CodeSystemUtilities.java index d07fe0af5..8b28ef2e0 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/CodeSystemUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/CodeSystemUtilities.java @@ -49,6 +49,8 @@ import org.hl7.fhir.utilities.Utilities; public class CodeSystemUtilities { + public static final String USER_DATA_CROSS_LINK = "cs.utils.cross.link"; + public static class CodeSystemNavigator { private CodeSystem cs; @@ -344,6 +346,17 @@ public class CodeSystemUtilities { return p; return null; } + + public static List getPropertyValues(ConceptDefinitionComponent concept, String code) { + List res = new ArrayList<>(); + for (ConceptPropertyComponent p : concept.getProperty()) { + if (p.getCode().equals(code)) { + res.add(p); + } + } + return res; + } + // see http://hl7.org/fhir/R4/codesystem.html#hierachy // returns additional parents not in the heirarchy @@ -416,4 +429,40 @@ public class CodeSystemUtilities { return null; } + public static void crossLinkCodeSystem(CodeSystem cs) { + String parent = getPropertyByUrl(cs, "http://hl7.org/fhir/concept-properties#parent"); + if ((parent != null)) { + crossLinkConcepts(cs.getConcept(), cs.getConcept(), parent); + } + } + + private static String getPropertyByUrl(CodeSystem cs, String url) { + for (PropertyComponent pc : cs.getProperty()) { + if (url.equals(pc.getUri())) { + return pc.getCode(); + } + } + return null; + } + + private static void crossLinkConcepts(List root, List focus, String parent) { + for (ConceptDefinitionComponent def : focus) { + List pcl = getPropertyValues(def, parent); + for (ConceptPropertyComponent pc : pcl) { + String code = pc.getValue().primitiveValue(); + ConceptDefinitionComponent tgt = findCode(root, code); + if (!tgt.hasUserData(USER_DATA_CROSS_LINK)) { + tgt.setUserData(USER_DATA_CROSS_LINK, new ArrayList<>()); + } + @SuppressWarnings("unchecked") + List children = (List) tgt.getUserData(USER_DATA_CROSS_LINK); + children.add(def); + } + if (def.hasConcept()) { + crossLinkConcepts(root, def.getConcept(), parent); + } + } + + } + } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetExpanderSimple.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetExpanderSimple.java index 8fedc48da..d6a0dc430 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetExpanderSimple.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetExpanderSimple.java @@ -116,7 +116,7 @@ public class ValueSetExpanderSimple implements ValueSetExpander { public void setMaxExpansionSize(int theMaxExpansionSize) { maxExpansionSize = theMaxExpansionSize; } - + private ValueSetExpansionContainsComponent addCode(String system, String code, String display, ValueSetExpansionContainsComponent parent, List designations, Parameters expParams, boolean isAbstract, boolean inactive, List filters) { if (filters != null && !filters.isEmpty() && !filterContainsCode(filters, system, code)) @@ -215,11 +215,23 @@ public class ValueSetExpanderSimple implements ValueSetExpander { boolean inc = CodeSystemUtilities.isInactive(cs, def); if (canBeHeirarchy || !abs) np = addCode(system, def.getCode(), def.getDisplay(), parent, def.getDesignation(), expParams, abs, inc, filters); - for (ConceptDefinitionComponent c : def.getConcept()) + for (ConceptDefinitionComponent c : def.getConcept()) { addCodeAndDescendents(cs, system, c, np, expParams, filters, exclusion); + } + if (def.hasUserData(CodeSystemUtilities.USER_DATA_CROSS_LINK)) { + List children = (List) def.getUserData(CodeSystemUtilities.USER_DATA_CROSS_LINK); + for (ConceptDefinitionComponent c : children) + addCodeAndDescendents(cs, system, c, np, expParams, filters, exclusion); + } } else { - for (ConceptDefinitionComponent c : def.getConcept()) + for (ConceptDefinitionComponent c : def.getConcept()) { addCodeAndDescendents(cs, system, c, null, expParams, filters, exclusion); + } + if (def.hasUserData(CodeSystemUtilities.USER_DATA_CROSS_LINK)) { + List children = (List) def.getUserData(CodeSystemUtilities.USER_DATA_CROSS_LINK); + for (ConceptDefinitionComponent c : children) + addCodeAndDescendents(cs, system, c, null, expParams, filters, exclusion); + } } } From d6f267781fc091d3c234e05a2d6ef69b0edb784f Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 21 Apr 2020 13:56:09 +1000 Subject: [PATCH 4/6] fix error in Accept header fetching packages --- .../hl7/fhir/utilities/cache/PackageClient.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/PackageClient.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/PackageClient.java index cfbb58e74..39525e313 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/PackageClient.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/PackageClient.java @@ -66,7 +66,7 @@ public class PackageClient { } @Override public String toString() { - return id+"#"+(version == null ? "??" : version)+(fhirVersion == null ? "": " ("+canonical+") for FHIR "+fhirVersion)+(url == null ? "" : " @"+url)+(description == null ? "" : " '"+description+"'"); + return id+"#"+(version == null ? "?pc-pi?" : version)+(fhirVersion == null ? "": " ("+canonical+") for FHIR "+fhirVersion)+(url == null ? "" : " @"+url)+(description == null ? "" : " '"+description+"'"); } } @@ -89,15 +89,15 @@ public class PackageClient { } public InputStream fetch(String id, String ver) throws IOException { - return fetchUrl(Utilities.pathURL(address, id, ver)); + return fetchUrl(Utilities.pathURL(address, id, ver), null); } public InputStream fetch(PackageInfo info) throws IOException { - return fetchUrl(Utilities.pathURL(address, info.getId(), info.getVersion())); + return fetchUrl(Utilities.pathURL(address, info.getId(), info.getVersion()), null); } public InputStream fetchNpm(String id, String ver) throws IOException { - return fetchUrl(Utilities.pathURL(address, id, "-", id+"-"+ver+".tgz")); + return fetchUrl(Utilities.pathURL(address, id, "-", id+"-"+ver+".tgz"), null); } public List getVersions(String id) throws IOException { @@ -154,20 +154,23 @@ public class PackageClient { return null; } - private InputStream fetchUrl(String source) throws IOException { + private InputStream fetchUrl(String source, String accept) throws IOException { URL url = new URL(source); URLConnection c = url.openConnection(); + if (accept != null) { + c.setRequestProperty("accept", accept); + } return c.getInputStream(); } private JsonObject fetchJson(String source) throws IOException { - String src = TextFile.streamToString(fetchUrl(source)); + String src = TextFile.streamToString(fetchUrl(source, "application/json")); //System.out.println(src); return (JsonObject) new com.google.gson.JsonParser().parse(src); } private JsonArray fetchJsonArray(String source) throws IOException { - String src = TextFile.streamToString(fetchUrl(source)); + String src = TextFile.streamToString(fetchUrl(source, "application/json")); //System.out.println(src); return (JsonArray) new com.google.gson.JsonParser().parse(src); } From 957a71dc41833558b608537c3e1efdad037e40f7 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 21 Apr 2020 13:57:41 +1000 Subject: [PATCH 5/6] better debugging of error strings --- .../CapabilityStatementUtilities.java | 4 +-- .../fhir/r5/conformance/ProfileUtilities.java | 8 ++--- .../hl7/fhir/r5/elementmodel/XmlParser.java | 4 +-- .../org/hl7/fhir/r5/model/ExpressionNode.java | 6 ++-- .../org/hl7/fhir/r5/utils/FHIRPathEngine.java | 6 ++-- .../hl7/fhir/r5/utils/NarrativeGenerator.java | 34 +++++++++---------- .../org/hl7/fhir/r5/utils/TypesUtilities.java | 2 +- .../instance/InstanceValidator.java | 2 +- pom.xml | 2 +- 9 files changed, 34 insertions(+), 34 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/CapabilityStatementUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/CapabilityStatementUtilities.java index 2720ebde4..38ebe39c5 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/CapabilityStatementUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/CapabilityStatementUtilities.java @@ -627,7 +627,7 @@ public class CapabilityStatementUtilities { return cc.getText(); if (cc.hasCoding()) return gen(cc.getCoding().get(0)); - return "??"; + return "?gen-cc?"; } private String gen(Coding coding) { @@ -635,7 +635,7 @@ public class CapabilityStatementUtilities { return coding.getDisplay(); if (coding.hasCode()) return coding.getCode(); - return "???"; + return "?gen-c?"; } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java index 607dfb950..ce2c96efb 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java @@ -3384,7 +3384,7 @@ public class ProfileUtilities extends TranslatingUtilities { extDefn = locateExtension(StructureDefinition.class, eurl); if (extDefn == null) { genCardinality(gen, element, row, hasDef, used, null); - row.getCells().add(gen.new Cell(null, null, "?? "+element.getType().get(0).getProfile(), null, null)); + row.getCells().add(gen.new Cell(null, null, "?gen-e1? "+element.getType().get(0).getProfile(), null, null)); generateDescription(gen, row, element, (ElementDefinition) element.getUserData(DERIVATION_POINTER), used.used, profile.getUrl(), eurl, profile, corePath, imagePath, root, logicalModel, allInvariants, snapshot); } else { String name = urltail(eurl); @@ -3574,7 +3574,7 @@ public class ProfileUtilities extends TranslatingUtilities { if (first) first = false; else typeCell.addPiece(gen.new Piece(null, " | ", null)); StructureDefinition psd = context.fetchResource(StructureDefinition.class, pt.getValue()); if (psd == null) - typeCell.addPiece(gen.new Piece(null, "??", null)); + typeCell.addPiece(gen.new Piece(null, "?gen-e2?", null)); else typeCell.addPiece(gen.new Piece(psd.getUserString("path"), psd.getName(), psd.present())); @@ -3932,7 +3932,7 @@ public class ProfileUtilities extends TranslatingUtilities { if (ref != null) { ref = ref.substring(0, ref.indexOf(".html"))+"-definitions.html#"; } else { - ref = "??"; + ref = "?gen-fv?"; } StructureDefinition sd = context.fetchTypeDefinition(value.fhirType()); @@ -4254,7 +4254,7 @@ public class ProfileUtilities extends TranslatingUtilities { case OPEN : return translate("sd.table", "Open"); case OPENATEND : return translate("sd.table", "Open At End"); default: - return "??"; + return "?gen-sr?"; } } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/XmlParser.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/XmlParser.java index e80c53c23..3c3be99f3 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/XmlParser.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/XmlParser.java @@ -678,12 +678,12 @@ public class XmlParser extends ParserBase { return header.substring(i+9, i+12); } } - return "??"; + return "?xml-p1?"; } catch (Exception e) { // suppress this error logError(0, 0, "XML", IssueType.INVALID, e.getMessage(), IssueSeverity.ERROR); } - return "??"; + return "?xml-p2?"; } } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/ExpressionNode.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/ExpressionNode.java index 2bfcbcc17..c5a802ee4 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/ExpressionNode.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/ExpressionNode.java @@ -217,7 +217,7 @@ public class ExpressionNode { case ConvertsToDateTime : return "convertsToDateTime"; case ConvertsToTime : return "isTime"; case ConformsTo : return "conformsTo"; - default: return "??"; + default: return "?custom?"; } } } @@ -309,7 +309,7 @@ public class ExpressionNode { case In : return "in"; case Contains : return "contains"; case MemberOf : return "memberOf"; - default: return "??"; + default: return "?custom?"; } } } @@ -534,7 +534,7 @@ public class ExpressionNode { case Constant: return uniqueId+": "+constant; case Group: return uniqueId+": (Group)"; } - return "??"; + return "?exp-kind?"; } private void write(StringBuilder b) { diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/FHIRPathEngine.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/FHIRPathEngine.java index 2e2afe214..a179880f3 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/FHIRPathEngine.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/FHIRPathEngine.java @@ -536,17 +536,17 @@ public class FHIRPathEngine { * evaluate a path and return the matching elements * * @param base - the object against which the path is being evaluated - * @param ExpressionNode - the parsed ExpressionNode statement to use + * @param expressionNode - the parsed ExpressionNode statement to use * @return * @throws FHIRException * @ */ - public List evaluate(Object appContext, Base focusResource, Base rootResource, Base base, ExpressionNode ExpressionNode) throws FHIRException { + public List evaluate(Object appContext, Base focusResource, Base rootResource, Base base, ExpressionNode expressionNode) throws FHIRException { List list = new ArrayList(); if (base != null) list.add(base); log = new StringBuilder(); - return execute(new ExecutionContext(appContext, focusResource, rootResource, base, null, base), list, ExpressionNode, true); + return execute(new ExecutionContext(appContext, focusResource, rootResource, base, null, base), list, expressionNode, true); } /** diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NarrativeGenerator.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NarrativeGenerator.java index 4750f24e9..f9fd7318b 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NarrativeGenerator.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NarrativeGenerator.java @@ -777,7 +777,7 @@ public class NarrativeGenerator implements INarrativeGenerator { } else if (wrapped.hasChild("name") && wrapped.getChildValue("name") != null) { x.tx(wrapped.getChildValue("name")); } else { - x.tx("??"); + x.tx("?ngen-1?"); } } } @@ -1734,7 +1734,7 @@ public class NarrativeGenerator implements INarrativeGenerator { } else if (e instanceof Period) { Period p = (Period) e; x.addText(name+": "); - x.addText(!p.hasStart() ? "??" : p.getStartElement().toHumanDisplay()); + x.addText(!p.hasStart() ? "?ngen-2?" : p.getStartElement().toHumanDisplay()); x.tx(" --> "); x.addText(!p.hasEnd() ? "(ongoing)" : p.getEndElement().toHumanDisplay()); return true; @@ -1744,9 +1744,9 @@ public class NarrativeGenerator implements INarrativeGenerator { x.addText(r.getDisplay()); else if (r.hasReferenceElement()) { ResourceWithReference tr = resolveReference(res, r.getReference(), rc); - x.addText(tr == null ? r.getReference() : "????"); // getDisplayForReference(tr.getReference())); + x.addText(tr == null ? r.getReference() : "?ngen-3"); // getDisplayForReference(tr.getReference())); } else - x.tx("??"); + x.tx("?ngen-4?"); return true; } else if (e instanceof Narrative) { return false; @@ -1794,7 +1794,7 @@ public class NarrativeGenerator implements INarrativeGenerator { } public static String displayPeriod(Period p) { - String s = !p.hasStart() ? "??" : p.getStartElement().toHumanDisplay(); + String s = !p.hasStart() ? "?ngen-5?" : p.getStartElement().toHumanDisplay(); s = s + " --> "; return s + (!p.hasEnd() ? "(ongoing)" : p.getEndElement().toHumanDisplay()); } @@ -2296,13 +2296,13 @@ public class NarrativeGenerator implements INarrativeGenerator { case PCM: return "after breakfast"; case PCV: return "after dinner"; case WAKE: return "after waking"; - default: return "??"; + default: return "?ngen-6?"; } } private String displayTimeUnits(UnitsOfTime units) { if (units == null) - return "??"; + return "?ngen-7?"; switch (units) { case A: return "years"; case D: return "days"; @@ -2311,7 +2311,7 @@ public class NarrativeGenerator implements INarrativeGenerator { case MO: return "months"; case S: return "seconds"; case WK: return "weeks"; - default: return "??"; + default: return "?ngen-8?"; } } @@ -2391,7 +2391,7 @@ public class NarrativeGenerator implements INarrativeGenerator { } private String displayIdentifier(Identifier ii) { - String s = Utilities.noString(ii.getValue()) ? "??" : ii.getValue(); + String s = Utilities.noString(ii.getValue()) ? "?ngen-9?" : ii.getValue(); if (ii.hasType()) { if (ii.getType().hasText()) @@ -2455,7 +2455,7 @@ public class NarrativeGenerator implements INarrativeGenerator { p.addText(Utilities.capitalize(cm.getStatus().toString())+" (not intended for production usage). "); else p.addText(Utilities.capitalize(cm.getStatus().toString())+". "); - p.tx("Published on "+(cm.hasDate() ? cm.getDateElement().toHumanDisplay() : "??")+" by "+cm.getPublisher()); + p.tx("Published on "+(cm.hasDate() ? cm.getDateElement().toHumanDisplay() : "?ngen-10?")+" by "+cm.getPublisher()); if (!cm.getContact().isEmpty()) { p.tx(" ("); boolean firsti = true; @@ -3893,7 +3893,7 @@ public class NarrativeGenerator implements INarrativeGenerator { return vc.getDisplay(); } } - return "??Lang"; + return "?ngen-lang?"; } private boolean addDefineRowToTable(XhtmlNode t, ConceptDefinitionComponent c, int level, boolean hasHierarchy, boolean hasDisplay, boolean comment, boolean version, boolean deprecated, List maps, String system, CodeSystem cs, String lang, List properties, CodeSystemNavigator csNav) throws FHIRFormatError, DefinitionException, IOException { @@ -4236,14 +4236,14 @@ public class NarrativeGenerator implements INarrativeGenerator { String ref = (String) vs.getUserData("path"); ref = adjustForPath(ref); - XhtmlNode a = li.ah(ref == null ? "??" : ref.replace("\\", "/")); + XhtmlNode a = li.ah(ref == null ? "?ngen-11?" : ref.replace("\\", "/")); a.addText(value); } else { CodeSystem cs = context.fetchCodeSystem(value); if (cs != null) { String ref = (String) cs.getUserData("path"); ref = adjustForPath(ref); - XhtmlNode a = li.ah(ref == null ? "??" : ref.replace("\\", "/")); + XhtmlNode a = li.ah(ref == null ? "?ngen-12?" : ref.replace("\\", "/")); a.addText(value); } else if (value.equals("http://snomed.info/sct") || value.equals("http://snomed.info/id")) { XhtmlNode a = li.ah(value); @@ -4397,7 +4397,7 @@ public class NarrativeGenerator implements INarrativeGenerator { case ISA: return " is-a "; case ISNOTA: return " is-not-a "; case REGEX: return " matches (by regex) "; - case NULL: return " ?? "; + case NULL: return " ?ngen-13? "; case IN: return " in "; case NOTIN: return " not in "; case DESCENDENTOF: return " descends from "; @@ -4534,7 +4534,7 @@ public class NarrativeGenerator implements INarrativeGenerator { if (ref == null) ref = (String) cs.getUserData("path"); if (ref == null) - return "??.html"; + return "?ngen-14?.html"; if (!ref.contains(".html")) ref = ref + ".html"; return ref.replace("\\", "/"); @@ -4646,7 +4646,7 @@ public class NarrativeGenerator implements INarrativeGenerator { if (ref.hasIdentifier()) { return displayIdentifier(ref.getIdentifier()); } - return "??"; + return "?ngen-15?"; } public String gen(CodeableConcept code) { @@ -4861,7 +4861,7 @@ public class NarrativeGenerator implements INarrativeGenerator { } else if (disp != null) { x.tx(disp); } else { - x.tx("??"); + x.tx("?ngen-16?"); } } return x; diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/TypesUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/TypesUtilities.java index 6a03e2553..c1416978d 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/TypesUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/TypesUtilities.java @@ -39,7 +39,7 @@ public class TypesUtilities { case PRIMITIVE: return "Primitive Type"; case SPECIAL: return "Special Type"; } - return "??"; + return "?tu-class?"; } } diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java index 4fe50dfe9..4720ed306 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java @@ -1578,7 +1578,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat } else if (ctxt.getType() == ExtensionContextType.FHIRPATH) { contexts.append("p:" + ctxt.getExpression()); // The context is all elements that match the FHIRPath query found in the expression. - List res = fpe.evaluate(hostContext, resource, hostContext.getRootResource(), container, fpe.parse(ctxt.getExpression())); + List res = fpe.evaluate(hostContext, resource, hostContext.getRootResource(), resource, fpe.parse(ctxt.getExpression())); if (res.contains(container)) { ok = true; } diff --git a/pom.xml b/pom.xml index c536acc5d..2e2b9f23b 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ 4.2.0 - 1.1.6-SNAPSHOT + 1.1.7-SNAPSHOT 5.6.2 From 175d5fa0b72dacae350f27729e63f081f70cd1d9 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 21 Apr 2020 13:58:17 +1000 Subject: [PATCH 6/6] Release new version 4.2.18 --- org.hl7.fhir.convertors/pom.xml | 2 +- org.hl7.fhir.dstu2/pom.xml | 2 +- org.hl7.fhir.dstu2016may/pom.xml | 2 +- org.hl7.fhir.dstu3/pom.xml | 2 +- org.hl7.fhir.r4/pom.xml | 2 +- org.hl7.fhir.r5/pom.xml | 2 +- .../fhir/r5/conformance/ProfileComparer.java | 82 +++++++++++++------ org.hl7.fhir.utilities/pom.xml | 2 +- org.hl7.fhir.validation.cli/pom.xml | 2 +- org.hl7.fhir.validation/pom.xml | 2 +- pom.xml | 2 +- release.bat | 4 +- 12 files changed, 71 insertions(+), 35 deletions(-) diff --git a/org.hl7.fhir.convertors/pom.xml b/org.hl7.fhir.convertors/pom.xml index 037e7ca6a..0b1b70df4 100644 --- a/org.hl7.fhir.convertors/pom.xml +++ b/org.hl7.fhir.convertors/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 4.2.17-SNAPSHOT + 4.2.18-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.dstu2/pom.xml b/org.hl7.fhir.dstu2/pom.xml index 99ce2f2cd..06212b63e 100644 --- a/org.hl7.fhir.dstu2/pom.xml +++ b/org.hl7.fhir.dstu2/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 4.2.17-SNAPSHOT + 4.2.18-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.dstu2016may/pom.xml b/org.hl7.fhir.dstu2016may/pom.xml index 2ec8e6183..ad42d3eb8 100644 --- a/org.hl7.fhir.dstu2016may/pom.xml +++ b/org.hl7.fhir.dstu2016may/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 4.2.17-SNAPSHOT + 4.2.18-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.dstu3/pom.xml b/org.hl7.fhir.dstu3/pom.xml index 2de2cf724..347bd7d87 100644 --- a/org.hl7.fhir.dstu3/pom.xml +++ b/org.hl7.fhir.dstu3/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 4.2.17-SNAPSHOT + 4.2.18-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.r4/pom.xml b/org.hl7.fhir.r4/pom.xml index 4b18e185d..1dc6f862c 100644 --- a/org.hl7.fhir.r4/pom.xml +++ b/org.hl7.fhir.r4/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 4.2.17-SNAPSHOT + 4.2.18-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.r5/pom.xml b/org.hl7.fhir.r5/pom.xml index 702c2616b..7f6796b09 100644 --- a/org.hl7.fhir.r5/pom.xml +++ b/org.hl7.fhir.r5/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 4.2.17-SNAPSHOT + 4.2.18-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileComparer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileComparer.java index 467558d52..5e01a69a7 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileComparer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileComparer.java @@ -292,6 +292,8 @@ public class ProfileComparer implements ProfileKnowledgeProvider { private List comparisons = new ArrayList(); private String id; private String title; + private String leftPrefix; + private String rightPrefix; private String leftLink; private String leftName; private String rightLink; @@ -774,22 +776,33 @@ public class ProfileComparer implements ProfileKnowledgeProvider { try { le = context.expandVS(lvs, true, false); re = context.expandVS(rvs, true, false); - if (!closed(le.getValueset()) || !closed(re.getValueset())) - throw new DefinitionException("unclosed value sets are not handled yet"); - cvs = intersectByExpansion(path, le.getValueset(), re.getValueset()); - if (!cvs.getCompose().hasInclude()) { - outcome.messages.add(new ValidationMessage(Source.ProfileComparer, ValidationMessage.IssueType.STRUCTURE, path, "The value sets "+lvs.getUrl()+" and "+rvs.getUrl()+" do not intersect", ValidationMessage.IssueSeverity.ERROR)); - status(subset, ProfileUtilities.STATUS_ERROR); - return false; + if (le.getError() != null) { + outcome.messages.add(new ValidationMessage(Source.ProfileComparer, ValidationMessage.IssueType.STRUCTURE, path, "The value set "+lvs.getUrl()+" could not be expanded", ValidationMessage.IssueSeverity.ERROR)); + } else if (re.getError() != null) { + outcome.messages.add(new ValidationMessage(Source.ProfileComparer, ValidationMessage.IssueType.STRUCTURE, path, "The value set "+rvs.getUrl()+" could not be expanded", ValidationMessage.IssueSeverity.ERROR)); + } else if (!closed(le.getValueset())) { + outcome.messages.add(new ValidationMessage(Source.ProfileComparer, ValidationMessage.IssueType.STRUCTURE, path, "The value set "+lvs.getUrl()+" is not closed, so can't be compased", ValidationMessage.IssueSeverity.ERROR)); + } else if (!closed(re.getValueset())) { + outcome.messages.add(new ValidationMessage(Source.ProfileComparer, ValidationMessage.IssueType.STRUCTURE, path, "The value set "+rvs.getUrl()+" is not closed, so can't be compased", ValidationMessage.IssueSeverity.ERROR)); + } else { + cvs = intersectByExpansion(path, le.getValueset(), re.getValueset()); + if (!cvs.getCompose().hasInclude()) { + outcome.messages.add(new ValidationMessage(Source.ProfileComparer, ValidationMessage.IssueType.STRUCTURE, path, "The value sets "+lvs.getUrl()+" and "+rvs.getUrl()+" do not intersect", ValidationMessage.IssueSeverity.ERROR)); + status(subset, ProfileUtilities.STATUS_ERROR); + return false; + } } } catch (Exception e){ outcome.messages.add(new ValidationMessage(Source.ProfileComparer, ValidationMessage.IssueType.STRUCTURE, path, "Unable to expand or process value sets "+lvs.getUrl()+" and "+rvs.getUrl()+": "+e.getMessage(), ValidationMessage.IssueSeverity.ERROR)); status(subset, ProfileUtilities.STATUS_ERROR); + e.printStackTrace(); return false; } } - subBinding.setValueSet("#"+addValueSet(cvs)); - superBinding.setValueSet("#"+addValueSet(unite(superset, outcome, path, lvs, rvs))); + if (cvs != null) { + subBinding.setValueSet("#"+addValueSet(cvs)); + superBinding.setValueSet("#"+addValueSet(unite(superset, outcome, path, lvs, rvs))); + } } } return false; @@ -1335,11 +1348,30 @@ public class ProfileComparer implements ProfileKnowledgeProvider { this.rightName = rightName; } - private String genPCLink(String leftName, String leftLink) { - if (leftLink == null) - return leftName; - else - return ""+Utilities.escapeXml(leftName)+""; + public String getLeftPrefix() { + return leftPrefix; + } + + public void setLeftPrefix(String leftPrefix) { + this.leftPrefix = leftPrefix; + } + + public String getRightPrefix() { + return rightPrefix; + } + + public void setRightPrefix(String rightPrefix) { + this.rightPrefix = rightPrefix; + } + + private String genPCLink(String name, String link, String prefix) { + if (link == null) { + return name; + } else if (!Utilities.isAbsoluteUrl(link) && !Utilities.noString(prefix)) { + return ""+Utilities.escapeXml(name)+""; + } else { + return ""+Utilities.escapeXml(name)+""; + } } private String genValueSets(String base) throws IOException { @@ -1390,8 +1422,8 @@ public class ProfileComparer implements ProfileKnowledgeProvider { for (ProfileComparison cmp : getComparisons()) { b.append(""); - b.append(" "+Utilities.escapeXml(cmp.getLeft().getName())+""); - b.append(" "+Utilities.escapeXml(cmp.getRight().getName())+""); + b.append(" "+Utilities.escapeXml(cmp.getLeft().getName())+""); + b.append(" "+Utilities.escapeXml(cmp.getRight().getName())+""); b.append(" Click Here"); b.append(" "+cmp.getErrorCount()+""); b.append(" "+cmp.getWarningCount()+""); @@ -1404,6 +1436,10 @@ public class ProfileComparer implements ProfileKnowledgeProvider { } + private String fixLink(String path, String pfx) { + return (pfx == null || Utilities.isAbsoluteUrl(path)) ? path : Utilities.pathURL(pfx, path); + } + private String genCmpMessages(ProfileComparison cmp) { StringBuilder b = new StringBuilder(); b.append("\r\n"); @@ -1443,7 +1479,7 @@ public class ProfileComparer implements ProfileKnowledgeProvider { private String genCompModel(StructureDefinition sd, String name, String base, String prefix, String dest) throws FHIRException, IOException { if (sd == null) return "

No "+name+" could be generated

\r\n"; - return new XhtmlComposer(XhtmlComposer.HTML).compose(new ProfileUtilities(context, null, this).generateTable("??", sd, false, dest, false, base, true, prefix, prefix, false, false, null, true)); + return new XhtmlComposer(XhtmlComposer.HTML).compose(new ProfileUtilities(context, null, this).generateTable("?gen-cm?", sd, false, dest, false, base, true, prefix, prefix, false, false, null, true)); } @@ -1455,8 +1491,8 @@ public class ProfileComparer implements ProfileKnowledgeProvider { // first page we produce is simply the index Map vars = new HashMap(); vars.put("title", getTitle()); - vars.put("left", genPCLink(getLeftName(), getLeftLink())); - vars.put("right", genPCLink(getRightName(), getRightLink())); + vars.put("left", genPCLink(getLeftName(), getLeftLink(), getLeftPrefix())); + vars.put("right", genPCLink(getRightName(), getRightLink(), getRightPrefix())); vars.put("table", genPCTable()); vars.put("valuesets", genValueSets(folder+"/"+getId()+"-vs")); producePage(summaryTemplate(), Utilities.path(folder, getId()+".html"), vars); @@ -1465,8 +1501,8 @@ public class ProfileComparer implements ProfileKnowledgeProvider { for (ProfileComparison cmp : getComparisons()) { vars.clear(); vars.put("title", getTitle()); - vars.put("left", genPCLink(getLeftName(), getLeftLink())); - vars.put("right", genPCLink(getRightName(), getRightLink())); + vars.put("left", genPCLink(getLeftName(), getLeftLink(), getLeftPrefix())); + vars.put("right", genPCLink(getRightName(), getRightLink(), getRightPrefix())); vars.put("messages", genCmpMessages(cmp)); vars.put("subset", genCompModel(cmp.getSubset(), "intersection", getId()+"."+cmp.getId(), "", folder)); vars.put("superset", genCompModel(cmp.getSuperset(), "union", getId()+"."+cmp.getId(), "", folder)); @@ -1488,7 +1524,7 @@ public class ProfileComparer implements ProfileKnowledgeProvider { String s1 = src.substring(0, i1); String s2 = src.substring(i1 + 2, i2).trim(); String s3 = src.substring(i2+2); - String v = vars.containsKey(s2) ? vars.get(s2) : "???"; + String v = vars.containsKey(s2) ? vars.get(s2) : "?pp??"; src = s1+v+s3; } TextFile.stringToFile(src, path); @@ -1572,7 +1608,7 @@ public class ProfileComparer implements ProfileKnowledgeProvider { @Override public String getLinkForProfile(StructureDefinition profile, String url) { StructureDefinition sd = context.fetchResource(StructureDefinition.class, url); - return sd == null ? null : sd.getUserString("path"); + return sd == null ? null : sd.getUserString("path")+"|"+sd.present(); } @Override diff --git a/org.hl7.fhir.utilities/pom.xml b/org.hl7.fhir.utilities/pom.xml index bf0d7f7f5..123bd89cd 100644 --- a/org.hl7.fhir.utilities/pom.xml +++ b/org.hl7.fhir.utilities/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 4.2.17-SNAPSHOT + 4.2.18-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.validation.cli/pom.xml b/org.hl7.fhir.validation.cli/pom.xml index 6ca616bfe..cec3d54ff 100644 --- a/org.hl7.fhir.validation.cli/pom.xml +++ b/org.hl7.fhir.validation.cli/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 4.2.17-SNAPSHOT + 4.2.18-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.validation/pom.xml b/org.hl7.fhir.validation/pom.xml index 6ca85d51f..51619f610 100644 --- a/org.hl7.fhir.validation/pom.xml +++ b/org.hl7.fhir.validation/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 4.2.17-SNAPSHOT + 4.2.18-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 2e2b9f23b..36c75c41e 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ each other. It is fine to bump the point version of this POM without affecting HAPI FHIR. --> - 4.2.17-SNAPSHOT + 4.2.18-SNAPSHOT 4.2.0 diff --git a/release.bat b/release.bat index fc95c073c..9a31c2ccb 100644 --- a/release.bat +++ b/release.bat @@ -1,7 +1,7 @@ @echo off -set oldver=4.2.16 -set newver=4.2.17 +set oldver=4.2.17 +set newver=4.2.18 echo .. echo =========================================================================