001package org.hl7.fhir.convertors.conv43_50.resources43_50; 002 003import org.hl7.fhir.convertors.VersionConvertorConstants; 004import org.hl7.fhir.convertors.context.ConversionContext43_50; 005import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.CodeableConcept43_50; 006import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Identifier43_50; 007import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.ContactDetail43_50; 008import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.UsageContext43_50; 009import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Boolean43_50; 010import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Canonical43_50; 011import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Code43_50; 012import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.DateTime43_50; 013import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.MarkDown43_50; 014import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50; 015import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50; 016import org.hl7.fhir.exceptions.FHIRException; 017import org.hl7.fhir.r5.model.CanonicalType; 018import org.hl7.fhir.r5.model.Coding; 019import org.hl7.fhir.r5.model.Enumeration; 020import org.hl7.fhir.r5.model.Enumerations; 021import org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship; 022import org.hl7.fhir.r5.utils.ToolingExtensions; 023import org.hl7.fhir.utilities.CanonicalPair; 024 025/* 026 Copyright (c) 2011+, HL7, Inc. 027 All rights reserved. 028 029 Redistribution and use in source and binary forms, with or without modification, 030 are permitted provided that the following conditions are met: 031 032 * Redistributions of source code must retain the above copyright notice, this 033 list of conditions and the following disclaimer. 034 * Redistributions in binary form must reproduce the above copyright notice, 035 this list of conditions and the following disclaimer in the documentation 036 and/or other materials provided with the distribution. 037 * Neither the name of HL7 nor the names of its contributors may be used to 038 endorse or promote products derived from this software without specific 039 prior written permission. 040 041 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 042 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 043 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 044 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 045 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 046 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 047 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 048 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 049 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 050 POSSIBILITY OF SUCH DAMAGE. 051 052*/ 053// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 054public class ConceptMap43_50 { 055 056 public static org.hl7.fhir.r5.model.ConceptMap convertConceptMap(org.hl7.fhir.r4b.model.ConceptMap src) throws FHIRException { 057 if (src == null) 058 return null; 059 org.hl7.fhir.r5.model.ConceptMap tgt = new org.hl7.fhir.r5.model.ConceptMap(); 060 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt); 061 if (src.hasUrl()) 062 tgt.setUrlElement(Uri43_50.convertUri(src.getUrlElement())); 063 if (src.hasIdentifier()) 064 tgt.addIdentifier(Identifier43_50.convertIdentifier(src.getIdentifierFirstRep())); 065 if (src.hasVersion()) 066 tgt.setVersionElement(String43_50.convertString(src.getVersionElement())); 067 if (src.hasName()) 068 tgt.setNameElement(String43_50.convertString(src.getNameElement())); 069 if (src.hasTitle()) 070 tgt.setTitleElement(String43_50.convertString(src.getTitleElement())); 071 if (src.hasStatus()) 072 tgt.setStatusElement(Enumerations43_50.convertPublicationStatus(src.getStatusElement())); 073 if (src.hasExperimental()) 074 tgt.setExperimentalElement(Boolean43_50.convertBoolean(src.getExperimentalElement())); 075 if (src.hasDate()) 076 tgt.setDateElement(DateTime43_50.convertDateTime(src.getDateElement())); 077 if (src.hasPublisher()) 078 tgt.setPublisherElement(String43_50.convertString(src.getPublisherElement())); 079 for (org.hl7.fhir.r4b.model.ContactDetail t : src.getContact()) 080 tgt.addContact(ContactDetail43_50.convertContactDetail(t)); 081 if (src.hasDescription()) 082 tgt.setDescriptionElement(MarkDown43_50.convertMarkdown(src.getDescriptionElement())); 083 for (org.hl7.fhir.r4b.model.UsageContext t : src.getUseContext()) 084 tgt.addUseContext(UsageContext43_50.convertUsageContext(t)); 085 for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getJurisdiction()) 086 tgt.addJurisdiction(CodeableConcept43_50.convertCodeableConcept(t)); 087 if (src.hasPurpose()) 088 tgt.setPurposeElement(MarkDown43_50.convertMarkdown(src.getPurposeElement())); 089 if (src.hasCopyright()) 090 tgt.setCopyrightElement(MarkDown43_50.convertMarkdown(src.getCopyrightElement())); 091 if (src.hasSource()) 092 tgt.setSourceScope(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getSource())); 093 if (src.hasTarget()) 094 tgt.setTargetScope(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getTarget())); 095 for (org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupComponent t : src.getGroup()) 096 tgt.addGroup(convertConceptMapGroupComponent(t, tgt)); 097 return tgt; 098 } 099 100 public static org.hl7.fhir.r4b.model.ConceptMap convertConceptMap(org.hl7.fhir.r5.model.ConceptMap src) throws FHIRException { 101 if (src == null) 102 return null; 103 org.hl7.fhir.r4b.model.ConceptMap tgt = new org.hl7.fhir.r4b.model.ConceptMap(); 104 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt); 105 if (src.hasUrl()) 106 tgt.setUrlElement(Uri43_50.convertUri(src.getUrlElement())); 107 if (src.hasIdentifier()) 108 tgt.addIdentifier(Identifier43_50.convertIdentifier(src.getIdentifierFirstRep())); 109 if (src.hasVersion()) 110 tgt.setVersionElement(String43_50.convertString(src.getVersionElement())); 111 if (src.hasName()) 112 tgt.setNameElement(String43_50.convertString(src.getNameElement())); 113 if (src.hasTitle()) 114 tgt.setTitleElement(String43_50.convertString(src.getTitleElement())); 115 if (src.hasStatus()) 116 tgt.setStatusElement(Enumerations43_50.convertPublicationStatus(src.getStatusElement())); 117 if (src.hasExperimental()) 118 tgt.setExperimentalElement(Boolean43_50.convertBoolean(src.getExperimentalElement())); 119 if (src.hasDate()) 120 tgt.setDateElement(DateTime43_50.convertDateTime(src.getDateElement())); 121 if (src.hasPublisher()) 122 tgt.setPublisherElement(String43_50.convertString(src.getPublisherElement())); 123 for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) 124 tgt.addContact(ContactDetail43_50.convertContactDetail(t)); 125 if (src.hasDescription()) 126 tgt.setDescriptionElement(MarkDown43_50.convertMarkdown(src.getDescriptionElement())); 127 for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) 128 tgt.addUseContext(UsageContext43_50.convertUsageContext(t)); 129 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) 130 tgt.addJurisdiction(CodeableConcept43_50.convertCodeableConcept(t)); 131 if (src.hasPurpose()) 132 tgt.setPurposeElement(MarkDown43_50.convertMarkdown(src.getPurposeElement())); 133 if (src.hasCopyright()) 134 tgt.setCopyrightElement(MarkDown43_50.convertMarkdown(src.getCopyrightElement())); 135 if (src.hasSourceScope()) 136 tgt.setSource(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getSourceScope())); 137 if (src.hasTargetScope()) 138 tgt.setTarget(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getTargetScope())); 139 for (org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent t : src.getGroup()) 140 tgt.addGroup(convertConceptMapGroupComponent(t, src)); 141 return tgt; 142 } 143 144 public static org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent convertConceptMapGroupComponent(org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupComponent src, org.hl7.fhir.r5.model.ConceptMap tgtMap) throws FHIRException { 145 if (src == null) 146 return null; 147 org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent(); 148 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 149 if (src.hasSource() || src.hasSourceVersion()) 150 tgt.setSourceElement(convertUriAndVersionToCanonical(src.getSourceElement(), src.getSourceVersionElement())); 151 if (src.hasTarget() || src.hasTargetVersion()) 152 tgt.setTargetElement(convertUriAndVersionToCanonical(src.getTargetElement(), src.getTargetVersionElement())); 153 for (org.hl7.fhir.r4b.model.ConceptMap.SourceElementComponent t : src.getElement()) 154 tgt.addElement(convertSourceElementComponent(t, tgtMap)); 155 if (src.hasUnmapped()) 156 tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped())); 157 return tgt; 158 } 159 160 private static CanonicalType convertUriAndVersionToCanonical(org.hl7.fhir.r4b.model.UriType srcUri, org.hl7.fhir.r4b.model.StringType srcVersion) { 161 if (srcUri == null && srcVersion == null) 162 return null; 163 org.hl7.fhir.r5.model.CanonicalType tgt = new org.hl7.fhir.r5.model.CanonicalType(); 164 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(srcUri == null ? srcVersion : srcUri, tgt); 165 if (srcUri.hasValue()) { 166 if (srcVersion.hasValue()) { 167 tgt.setValue(srcUri.getValue() + "|" + srcVersion.getValue()); 168 } else { 169 tgt.setValue(srcUri.getValue()); 170 } 171 } 172 return tgt; 173 } 174 175 public static org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupComponent convertConceptMapGroupComponent(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent src, org.hl7.fhir.r5.model.ConceptMap srcMap) throws FHIRException { 176 if (src == null) 177 return null; 178 org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupComponent(); 179 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 180 if (src.hasSource()) { 181 CanonicalPair cp = new CanonicalPair(src.getSource()); 182 tgt.setSource(cp.getUrl()); 183 tgt.setSourceVersion(cp.getVersion()); 184 } 185 if (src.hasTarget()) { 186 CanonicalPair cp = new CanonicalPair(src.getTarget()); 187 tgt.setTarget(cp.getUrl()); 188 tgt.setTargetVersion(cp.getVersion()); 189 } 190 for (org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent t : src.getElement()) 191 tgt.addElement(convertSourceElementComponent(t, srcMap)); 192 if (src.hasUnmapped()) 193 tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped())); 194 return tgt; 195 } 196 197 public static org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r4b.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.r5.model.ConceptMap tgtMap) throws FHIRException { 198 if (src == null) 199 return null; 200 org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent(); 201 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 202 if (src.hasCode()) 203 tgt.setCodeElement(Code43_50.convertCode(src.getCodeElement())); 204 if (src.hasDisplay()) 205 tgt.setDisplayElement(String43_50.convertString(src.getDisplayElement())); 206 for (org.hl7.fhir.r4b.model.ConceptMap.TargetElementComponent t : src.getTarget()) { 207 if (t.getEquivalence() == org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence.UNMATCHED) { 208 tgt.setNoMap(true); 209 } else { 210 tgt.addTarget(convertTargetElementComponent(t, tgtMap)); 211 } 212 } 213 return tgt; 214 } 215 216 public static org.hl7.fhir.r4b.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.r5.model.ConceptMap srcMap) throws FHIRException { 217 if (src == null) 218 return null; 219 org.hl7.fhir.r4b.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r4b.model.ConceptMap.SourceElementComponent(); 220 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 221 if (src.hasCode()) 222 tgt.setCodeElement(Code43_50.convertCode(src.getCodeElement())); 223 if (src.hasDisplay()) 224 tgt.setDisplayElement(String43_50.convertString(src.getDisplayElement())); 225 if (src.hasNoMap() && src.getNoMap() == true) { 226 tgt.addTarget(new org.hl7.fhir.r4b.model.ConceptMap.TargetElementComponent().setEquivalence(org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence.UNMATCHED)); 227 } else { 228 for (org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent t : src.getTarget()) 229 tgt.addTarget(convertTargetElementComponent(t, srcMap)); 230 } 231 return tgt; 232 } 233 234 public static org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r4b.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.r5.model.ConceptMap tgtMap) throws FHIRException { 235 if (src == null) 236 return null; 237 org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent(); 238 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 239 if (src.hasCode()) 240 tgt.setCodeElement(Code43_50.convertCode(src.getCodeElement())); 241 if (src.hasDisplay()) 242 tgt.setDisplayElement(String43_50.convertString(src.getDisplayElement())); 243 if (src.hasEquivalence()) 244 tgt.setRelationshipElement(convertConceptMapRelationship(src.getEquivalenceElement(), tgt)); 245 if (src.hasComment()) 246 tgt.setCommentElement(String43_50.convertString(src.getCommentElement())); 247 for (org.hl7.fhir.r4b.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) 248 tgt.addDependsOn(convertOtherElementComponent(t, tgtMap)); 249 for (org.hl7.fhir.r4b.model.ConceptMap.OtherElementComponent t : src.getProduct()) 250 tgt.addProduct(convertOtherElementComponent(t, tgtMap)); 251 return tgt; 252 } 253 254 public static org.hl7.fhir.r4b.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.r5.model.ConceptMap srcMap) throws FHIRException { 255 if (src == null) 256 return null; 257 org.hl7.fhir.r4b.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r4b.model.ConceptMap.TargetElementComponent(); 258 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE); 259 if (src.hasCode()) 260 tgt.setCodeElement(Code43_50.convertCode(src.getCodeElement())); 261 if (src.hasDisplay()) 262 tgt.setDisplayElement(String43_50.convertString(src.getDisplayElement())); 263 if (src.hasRelationship()) 264 tgt.setEquivalenceElement(convertConceptMapEquivalence(src.getRelationshipElement(), src)); 265 else 266 tgt.setEquivalence(org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence.RELATEDTO); 267 if (src.hasComment()) 268 tgt.setCommentElement(String43_50.convertString(src.getCommentElement())); 269 for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) 270 tgt.addDependsOn(convertOtherElementComponent(t, srcMap)); 271 for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getProduct()) 272 tgt.addProduct(convertOtherElementComponent(t, srcMap)); 273 return tgt; 274 } 275 276 public static org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence> convertConceptMapEquivalence(Enumeration<ConceptMapRelationship> src, org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent ccm) throws FHIRException { 277 if (src == null || src.isEmpty()) 278 return null; 279 org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence> tgt = new org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence>(new org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalenceEnumFactory()); 280 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 281 if (ccm.hasExtension(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) { 282 tgt.setValueAsString(ccm.getExtensionString(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE)); 283 } else { 284 switch (src.getValue()) { 285 case RELATEDTO: 286 tgt.setValue(org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence.RELATEDTO); 287 break; 288 case EQUIVALENT: 289 tgt.setValue(org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence.EQUIVALENT); 290 break; 291 case SOURCEISNARROWERTHANTARGET: 292 tgt.setValue(org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence.WIDER); 293 break; 294 case SOURCEISBROADERTHANTARGET: 295 tgt.setValue(org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence.NARROWER); 296 break; 297 case NOTRELATEDTO: 298 tgt.setValue(org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence.DISJOINT); 299 break; 300 default: 301 tgt.setValue(org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence.NULL); 302 break; 303 } 304 } 305 return tgt; 306 } 307 308 public static Enumeration<ConceptMapRelationship> convertConceptMapRelationship(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence> src, org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent tgtCtxt) throws FHIRException { 309 if (src == null || src.isEmpty()) 310 return null; 311 Enumeration<ConceptMapRelationship> tgt = new Enumeration<ConceptMapRelationship>(new Enumerations.ConceptMapRelationshipEnumFactory()); 312 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 313 ToolingExtensions.setCodeExtensionMod(tgtCtxt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE, src.getValueAsString()); 314 switch (src.getValue()) { 315 case EQUIVALENT: 316 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.EQUIVALENT); 317 break; 318 case EQUAL: 319 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.EQUIVALENT); 320 break; 321 case WIDER: 322 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.SOURCEISNARROWERTHANTARGET); 323 break; 324 case SUBSUMES: 325 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.SOURCEISNARROWERTHANTARGET); 326 break; 327 case NARROWER: 328 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.SOURCEISBROADERTHANTARGET); 329 break; 330 case SPECIALIZES: 331 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.SOURCEISBROADERTHANTARGET); 332 break; 333 case RELATEDTO: 334 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.RELATEDTO); 335 break; 336 case INEXACT: 337 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.RELATEDTO); 338 break; 339 case UNMATCHED: 340 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NULL); 341 break; 342 case DISJOINT: 343 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NOTRELATEDTO); 344 break; 345 default: 346 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NULL); 347 break; 348 } 349 return tgt; 350 } 351 352 public static org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r4b.model.ConceptMap.OtherElementComponent src, org.hl7.fhir.r5.model.ConceptMap tgtMap) throws FHIRException { 353 if (src == null) 354 return null; 355 org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent(); 356 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 357 if (src.hasProperty()) 358 tgt.setAttribute(tgtMap.registerAttribute(src.getProperty())); 359 if (src.hasSystem()) { 360 tgt.setValue(new Coding().setSystem(src.getSystem()).setCode(src.getValue()).setDisplay(src.getDisplay())); 361 } else if (src.hasValueElement()) { 362 tgt.setValue(String43_50.convertString(src.getValueElement())); 363 } 364 return tgt; 365 } 366 367 public static org.hl7.fhir.r4b.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent src, org.hl7.fhir.r5.model.ConceptMap srcMap) throws FHIRException { 368 if (src == null) 369 return null; 370 org.hl7.fhir.r4b.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r4b.model.ConceptMap.OtherElementComponent(); 371 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 372 if (src.hasAttribute()) 373 tgt.setProperty(srcMap.getAttributeUri(src.getAttribute())); 374 375 if (src.hasValueCoding()) { 376 tgt.setSystem(src.getValueCoding().getSystem()); 377 tgt.setValue(src.getValueCoding().getCode()); 378 tgt.setDisplay(src.getValueCoding().getDisplay()); 379 } else if (src.hasValue()) { 380 tgt.setValue(src.getValue().primitiveValue()); 381 } 382 383 return tgt; 384 } 385 386 public static org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent convertConceptMapGroupUnmappedComponent(org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupUnmappedComponent src) throws FHIRException { 387 if (src == null) 388 return null; 389 org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent(); 390 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 391 if (src.hasMode()) 392 tgt.setModeElement(convertConceptMapGroupUnmappedMode(src.getModeElement())); 393 if (src.hasCode()) 394 tgt.setCodeElement(Code43_50.convertCode(src.getCodeElement())); 395 if (src.hasDisplay()) 396 tgt.setDisplayElement(String43_50.convertString(src.getDisplayElement())); 397 if (src.hasUrl()) 398 tgt.setOtherMapElement(Canonical43_50.convertCanonical(src.getUrlElement())); 399 return tgt; 400 } 401 402 public static org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupUnmappedComponent convertConceptMapGroupUnmappedComponent(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent src) throws FHIRException { 403 if (src == null) 404 return null; 405 org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupUnmappedComponent tgt = new org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupUnmappedComponent(); 406 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 407 if (src.hasMode()) 408 tgt.setModeElement(convertConceptMapGroupUnmappedMode(src.getModeElement())); 409 if (src.hasCode()) 410 tgt.setCodeElement(Code43_50.convertCode(src.getCodeElement())); 411 if (src.hasDisplay()) 412 tgt.setDisplayElement(String43_50.convertString(src.getDisplayElement())); 413 if (src.hasOtherMap()) 414 tgt.setUrlElement(Canonical43_50.convertCanonical(src.getOtherMapElement())); 415 return tgt; 416 } 417 418 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode> convertConceptMapGroupUnmappedMode(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupUnmappedMode> src) throws FHIRException { 419 if (src == null || src.isEmpty()) 420 return null; 421 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedModeEnumFactory()); 422 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 423 switch (src.getValue()) { 424 case PROVIDED: 425 tgt.setValue(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.USESOURCECODE); 426 break; 427 case FIXED: 428 tgt.setValue(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.FIXED); 429 break; 430 case OTHERMAP: 431 tgt.setValue(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.OTHERMAP); 432 break; 433 default: 434 tgt.setValue(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.NULL); 435 break; 436 } 437 return tgt; 438 } 439 440 static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupUnmappedMode> convertConceptMapGroupUnmappedMode(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode> src) throws FHIRException { 441 if (src == null || src.isEmpty()) 442 return null; 443 org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupUnmappedMode> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupUnmappedModeEnumFactory()); 444 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 445 switch (src.getValue()) { 446 case USESOURCECODE: 447 tgt.setValue(org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupUnmappedMode.PROVIDED); 448 break; 449 case FIXED: 450 tgt.setValue(org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupUnmappedMode.FIXED); 451 break; 452 case OTHERMAP: 453 tgt.setValue(org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupUnmappedMode.OTHERMAP); 454 break; 455 default: 456 tgt.setValue(org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupUnmappedMode.NULL); 457 break; 458 } 459 return tgt; 460 } 461}