
001package org.hl7.fhir.convertors.conv30_50.resources30_50; 002 003import org.hl7.fhir.convertors.VersionConvertorConstants; 004import org.hl7.fhir.convertors.context.ConversionContext30_50; 005import org.hl7.fhir.convertors.conv30_50.datatypes30_50.ContactDetail30_50; 006import org.hl7.fhir.convertors.conv30_50.datatypes30_50.UsageContext30_50; 007import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.CodeableConcept30_50; 008import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Identifier30_50; 009import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Boolean30_50; 010import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Code30_50; 011import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.DateTime30_50; 012import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.MarkDown30_50; 013import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.String30_50; 014import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Uri30_50; 015import org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence; 016import org.hl7.fhir.exceptions.FHIRException; 017import org.hl7.fhir.r5.model.*; 018import org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship; 019import org.hl7.fhir.r5.utils.ToolingExtensions; 020import org.hl7.fhir.utilities.CanonicalPair; 021 022public class ConceptMap30_50 { 023 024 public static org.hl7.fhir.dstu3.model.ConceptMap convertConceptMap(org.hl7.fhir.r5.model.ConceptMap src) throws FHIRException { 025 if (src == null) 026 return null; 027 org.hl7.fhir.dstu3.model.ConceptMap tgt = new org.hl7.fhir.dstu3.model.ConceptMap(); 028 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt); 029 if (src.hasUrl()) 030 tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement())); 031 if (src.hasIdentifier()) 032 tgt.setIdentifier(Identifier30_50.convertIdentifier(src.getIdentifierFirstRep())); 033 if (src.hasVersion()) 034 tgt.setVersionElement(String30_50.convertString(src.getVersionElement())); 035 if (src.hasName()) 036 tgt.setNameElement(String30_50.convertString(src.getNameElement())); 037 if (src.hasTitle()) 038 tgt.setTitleElement(String30_50.convertString(src.getTitleElement())); 039 if (src.hasStatus()) 040 tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement())); 041 if (src.hasExperimental()) 042 tgt.setExperimentalElement(Boolean30_50.convertBoolean(src.getExperimentalElement())); 043 if (src.hasDate()) 044 tgt.setDateElement(DateTime30_50.convertDateTime(src.getDateElement())); 045 if (src.hasPublisher()) 046 tgt.setPublisherElement(String30_50.convertString(src.getPublisherElement())); 047 for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) 048 tgt.addContact(ContactDetail30_50.convertContactDetail(t)); 049 if (src.hasDescription()) 050 tgt.setDescriptionElement(MarkDown30_50.convertMarkdown(src.getDescriptionElement())); 051 for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) 052 tgt.addUseContext(UsageContext30_50.convertUsageContext(t)); 053 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) 054 tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept(t)); 055 if (src.hasPurpose()) 056 tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement())); 057 if (src.hasCopyright()) 058 tgt.setCopyrightElement(MarkDown30_50.convertMarkdown(src.getCopyrightElement())); 059 if (src.hasSourceScope()) 060 tgt.setSource(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getSourceScope())); 061 if (src.hasTargetScope()) 062 tgt.setTarget(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getTargetScope())); 063 for (org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent t : src.getGroup()) 064 tgt.addGroup(convertConceptMapGroupComponent(t, src)); 065 return tgt; 066 } 067 068 public static org.hl7.fhir.r5.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu3.model.ConceptMap src) throws FHIRException { 069 if (src == null) 070 return null; 071 org.hl7.fhir.r5.model.ConceptMap tgt = new org.hl7.fhir.r5.model.ConceptMap(); 072 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt); 073 if (src.hasUrl()) 074 tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement())); 075 if (src.hasIdentifier()) 076 tgt.addIdentifier(Identifier30_50.convertIdentifier(src.getIdentifier())); 077 if (src.hasVersion()) 078 tgt.setVersionElement(String30_50.convertString(src.getVersionElement())); 079 if (src.hasName()) 080 tgt.setNameElement(String30_50.convertString(src.getNameElement())); 081 if (src.hasTitle()) 082 tgt.setTitleElement(String30_50.convertString(src.getTitleElement())); 083 if (src.hasStatus()) 084 tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement())); 085 if (src.hasExperimental()) 086 tgt.setExperimentalElement(Boolean30_50.convertBoolean(src.getExperimentalElement())); 087 if (src.hasDate()) 088 tgt.setDateElement(DateTime30_50.convertDateTime(src.getDateElement())); 089 if (src.hasPublisher()) 090 tgt.setPublisherElement(String30_50.convertString(src.getPublisherElement())); 091 for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) 092 tgt.addContact(ContactDetail30_50.convertContactDetail(t)); 093 if (src.hasDescription()) 094 tgt.setDescriptionElement(MarkDown30_50.convertMarkdown(src.getDescriptionElement())); 095 for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) 096 tgt.addUseContext(UsageContext30_50.convertUsageContext(t)); 097 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) 098 tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept(t)); 099 if (src.hasPurpose()) 100 tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement())); 101 if (src.hasCopyright()) 102 tgt.setCopyrightElement(MarkDown30_50.convertMarkdown(src.getCopyrightElement())); 103 if (src.hasSource()) { 104 org.hl7.fhir.r5.model.DataType t = ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getSource()); 105 tgt.setSourceScope(t instanceof org.hl7.fhir.r5.model.Reference ? new org.hl7.fhir.r5.model.CanonicalType(((org.hl7.fhir.r5.model.Reference) t).getReference()) : t); 106 } 107 if (src.hasTarget()) { 108 org.hl7.fhir.r5.model.DataType t = ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getTarget()); 109 tgt.setTargetScope(t instanceof org.hl7.fhir.r5.model.Reference ? new org.hl7.fhir.r5.model.CanonicalType(((org.hl7.fhir.r5.model.Reference) t).getReference()) : t); 110 } 111 for (org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent t : src.getGroup()) 112 tgt.addGroup(convertConceptMapGroupComponent(t, tgt)); 113 return tgt; 114 } 115 116 public static org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent convertConceptMapGroupComponent(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent src, org.hl7.fhir.r5.model.ConceptMap tgtMap) throws FHIRException { 117 if (src == null) 118 return null; 119 org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent(); 120 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt); 121 if (src.hasSource() || src.hasSourceVersion()) 122 tgt.setSourceElement(convertUriAndVersionToCanonical(src.getSourceElement(), src.getSourceVersionElement())); 123 if (src.hasTarget() || src.hasTargetVersion()) 124 tgt.setTargetElement(convertUriAndVersionToCanonical(src.getTargetElement(), src.getTargetVersionElement())); 125 126 for (org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent t : src.getElement()) 127 tgt.addElement(convertSourceElementComponent(t, tgtMap)); 128 if (src.hasUnmapped()) 129 tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped())); 130 return tgt; 131 } 132 133 public static org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent convertConceptMapGroupComponent(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent src, org.hl7.fhir.r5.model.ConceptMap srcMap) throws FHIRException { 134 if (src == null) 135 return null; 136 org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent(); 137 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt); 138 if (src.hasSource()) { 139 CanonicalPair cp = new CanonicalPair(src.getSource()); 140 tgt.setSource(cp.getUrl()); 141 tgt.setSourceVersion(cp.getVersion()); 142 } 143 if (src.hasTarget()) { 144 CanonicalPair cp = new CanonicalPair(src.getTarget()); 145 tgt.setTarget(cp.getUrl()); 146 tgt.setTargetVersion(cp.getVersion()); 147 } 148 for (org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent t : src.getElement()) 149 tgt.addElement(convertSourceElementComponent(t, srcMap)); 150 if (src.hasUnmapped()) 151 tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped())); 152 return tgt; 153 } 154 155 private static CanonicalType convertUriAndVersionToCanonical(org.hl7.fhir.dstu3.model.UriType srcUri, org.hl7.fhir.dstu3.model.StringType srcVersion) { 156 if (srcUri == null && srcVersion == null) 157 return null; 158 org.hl7.fhir.r5.model.CanonicalType tgt = new org.hl7.fhir.r5.model.CanonicalType(); 159 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(srcUri == null ? srcVersion : srcUri, tgt); 160 if (srcUri.hasValue()) { 161 if (srcVersion.hasValue()) { 162 tgt.setValue(srcUri.getValue() + "|" + srcVersion.getValue()); 163 } else { 164 tgt.setValue(srcUri.getValue()); 165 } 166 } 167 return tgt; 168 } 169 170 171 public static org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent convertConceptMapGroupUnmappedComponent(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent src) throws FHIRException { 172 if (src == null) 173 return null; 174 org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent(); 175 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt); 176 if (src.hasMode()) 177 tgt.setModeElement(convertConceptMapGroupUnmappedMode(src.getModeElement())); 178 if (src.hasCode()) 179 tgt.setCodeElement(Code30_50.convertCode(src.getCodeElement())); 180 if (src.hasDisplay()) 181 tgt.setDisplayElement(String30_50.convertString(src.getDisplayElement())); 182 if (src.hasUrl()) 183 tgt.setOtherMap(src.getUrl()); 184 return tgt; 185 } 186 187 public static org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent convertConceptMapGroupUnmappedComponent(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent src) throws FHIRException { 188 if (src == null) 189 return null; 190 org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent(); 191 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt); 192 if (src.hasMode()) 193 tgt.setModeElement(convertConceptMapGroupUnmappedMode(src.getModeElement())); 194 if (src.hasCode()) 195 tgt.setCodeElement(Code30_50.convertCode(src.getCodeElement())); 196 if (src.hasDisplay()) 197 tgt.setDisplayElement(String30_50.convertString(src.getDisplayElement())); 198 if (src.hasOtherMap()) 199 tgt.setUrl(src.getOtherMap()); 200 return tgt; 201 } 202 203 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode> convertConceptMapGroupUnmappedMode(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode> src) throws FHIRException { 204 if (src == null || src.isEmpty()) 205 return null; 206 Enumeration<ConceptMap.ConceptMapGroupUnmappedMode> tgt = new Enumeration<>(new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory()); 207 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 208 if (src.getValue() == null) { 209 tgt.setValue(null); 210 } else { 211 switch (src.getValue()) { 212 case PROVIDED: 213 tgt.setValue(ConceptMap.ConceptMapGroupUnmappedMode.USESOURCECODE); 214 break; 215 case FIXED: 216 tgt.setValue(ConceptMap.ConceptMapGroupUnmappedMode.FIXED); 217 break; 218 case OTHERMAP: 219 tgt.setValue(ConceptMap.ConceptMapGroupUnmappedMode.OTHERMAP); 220 break; 221 default: 222 tgt.setValue(ConceptMap.ConceptMapGroupUnmappedMode.NULL); 223 break; 224 } 225 } 226 return tgt; 227 } 228 229 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode> convertConceptMapGroupUnmappedMode(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode> src) throws FHIRException { 230 if (src == null || src.isEmpty()) 231 return null; 232 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedModeEnumFactory()); 233 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 234 if (src.getValue() == null) { 235 tgt.setValue(null); 236 } else { 237 switch (src.getValue()) { 238 case USESOURCECODE: 239 tgt.setValue(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.PROVIDED); 240 break; 241 case FIXED: 242 tgt.setValue(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.FIXED); 243 break; 244 case OTHERMAP: 245 tgt.setValue(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.OTHERMAP); 246 break; 247 default: 248 tgt.setValue(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.NULL); 249 break; 250 } 251 } 252 return tgt; 253 } 254 255 public static org.hl7.fhir.dstu3.model.Enumeration<ConceptMapEquivalence> convertConceptMapEquivalence(Enumeration<ConceptMapRelationship> src, org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent ccm) throws FHIRException { 256 if (src == null || src.isEmpty()) 257 return null; 258 org.hl7.fhir.dstu3.model.Enumeration<ConceptMapEquivalence> tgt = new org.hl7.fhir.dstu3.model.Enumeration<ConceptMapEquivalence>(new org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalenceEnumFactory()); 259 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 260 if (ccm.hasExtension(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) { 261 tgt.setValueAsString(ccm.getExtensionString(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE)); 262 } else { 263 if (src.getValue() == null) { 264 tgt.setValue(null); 265 } else { 266 switch (src.getValue()) { 267 case EQUIVALENT: 268 tgt.setValue(ConceptMapEquivalence.EQUIVALENT); 269 break; 270 case SOURCEISNARROWERTHANTARGET: 271 tgt.setValue(ConceptMapEquivalence.WIDER); 272 break; 273 case SOURCEISBROADERTHANTARGET: 274 tgt.setValue(ConceptMapEquivalence.NARROWER); 275 break; 276 case NOTRELATEDTO: 277 tgt.setValue(ConceptMapEquivalence.DISJOINT); 278 break; 279 case RELATEDTO: 280 tgt.setValue(ConceptMapEquivalence.RELATEDTO); 281 break; 282 default: 283 tgt.setValue(ConceptMapEquivalence.NULL); 284 break; 285 } 286 } 287 } 288 return tgt; 289 } 290 291 public static Enumeration<ConceptMapRelationship> convertConceptMapRelationship(org.hl7.fhir.dstu3.model.Enumeration<ConceptMapEquivalence> src, org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent tgtCtxt) throws FHIRException { 292 if (src == null || src.isEmpty()) 293 return null; 294 Enumeration<ConceptMapRelationship> tgt = new Enumeration<ConceptMapRelationship>(new Enumerations.ConceptMapRelationshipEnumFactory()); 295 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 296 ToolingExtensions.setCodeExtensionMod(tgtCtxt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE, src.getValueAsString()); 297 if (src.getValue() == null) { 298 tgt.setValue(null); 299 } else { 300 switch (src.getValue()) { 301 case EQUIVALENT: 302 tgt.setValue(ConceptMapRelationship.EQUIVALENT); 303 break; 304 case EQUAL: 305 tgt.setValue(ConceptMapRelationship.EQUIVALENT); 306 break; 307 case WIDER: 308 tgt.setValue(ConceptMapRelationship.SOURCEISNARROWERTHANTARGET); 309 break; 310 case SUBSUMES: 311 tgt.setValue(ConceptMapRelationship.SOURCEISNARROWERTHANTARGET); 312 break; 313 case NARROWER: 314 tgt.setValue(ConceptMapRelationship.SOURCEISBROADERTHANTARGET); 315 break; 316 case SPECIALIZES: 317 tgt.setValue(ConceptMapRelationship.SOURCEISBROADERTHANTARGET); 318 break; 319 case INEXACT: 320 tgt.setValue(ConceptMapRelationship.RELATEDTO); 321 break; 322 case UNMATCHED: 323 tgt.setValue(ConceptMapRelationship.NULL); 324 break; 325 case DISJOINT: 326 tgt.setValue(ConceptMapRelationship.NOTRELATEDTO); 327 break; 328 case RELATEDTO: 329 tgt.setValue(ConceptMapRelationship.RELATEDTO); 330 break; 331 default: 332 tgt.setValue(ConceptMapRelationship.NULL); 333 break; 334 } 335 } 336 return tgt; 337 } 338 339 public static org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent src, org.hl7.fhir.r5.model.ConceptMap tgtMap) throws FHIRException { 340 if (src == null) 341 return null; 342 org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent(); 343 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt); 344 if (src.hasProperty()) 345 tgt.setAttribute(tgtMap.registerAttribute(src.getProperty())); 346 347 if (src.hasSystem()) { 348 tgt.setValue(new Coding().setSystem(src.getSystem()).setCode(src.getCode()).setDisplay(src.getDisplay())); 349 } else if (src.hasCodeElement()) { 350 tgt.setValue(String30_50.convertString(src.getCodeElement())); 351 } 352 return tgt; 353 } 354 355 public static org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent src, org.hl7.fhir.r5.model.ConceptMap srcMap) throws FHIRException { 356 if (src == null) 357 return null; 358 org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent(); 359 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt); 360 if (src.hasAttribute()) 361 tgt.setProperty(srcMap.getAttributeUri(src.getAttribute())); 362 if (src.hasValueCoding()) { 363 tgt.setSystem(src.getValueCoding().getSystem()); 364 tgt.setCode(src.getValueCoding().getCode()); 365 tgt.setDisplay(src.getValueCoding().getDisplay()); 366 } else if (src.hasValue()) { 367 tgt.setCode(src.getValue().primitiveValue()); 368 } 369 return tgt; 370 } 371 372 public static org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.r5.model.ConceptMap srcMap) throws FHIRException { 373 if (src == null) 374 return null; 375 org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent(); 376 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt); 377 if (src.hasCode()) 378 tgt.setCodeElement(Code30_50.convertCode(src.getCodeElement())); 379 if (src.hasDisplay()) 380 tgt.setDisplayElement(String30_50.convertString(src.getDisplayElement())); 381 if (src.hasNoMap() && src.getNoMap() == true) { 382 tgt.addTarget(new org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent().setEquivalence(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.UNMATCHED)); 383 } else { 384 for (org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent t : src.getTarget()) 385 tgt.addTarget(convertTargetElementComponent(t, srcMap)); 386 } 387 return tgt; 388 } 389 390 public static org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.r5.model.ConceptMap tgtMap) throws FHIRException { 391 if (src == null) 392 return null; 393 org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent(); 394 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt); 395 if (src.hasCode()) 396 tgt.setCodeElement(Code30_50.convertCode(src.getCodeElement())); 397 if (src.hasDisplay()) 398 tgt.setDisplayElement(String30_50.convertString(src.getDisplayElement())); 399 for (org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent t : src.getTarget()) 400 if (t.getEquivalence() == org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.UNMATCHED) { 401 tgt.setNoMap(true); 402 } else { 403 tgt.addTarget(convertTargetElementComponent(t, tgtMap)); 404 } 405 return tgt; 406 } 407 408 public static org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.r5.model.ConceptMap tgtMap) throws FHIRException { 409 if (src == null) 410 return null; 411 org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent(); 412 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt); 413 if (src.hasCode()) 414 tgt.setCodeElement(Code30_50.convertCode(src.getCodeElement())); 415 if (src.hasDisplay()) 416 tgt.setDisplayElement(String30_50.convertString(src.getDisplayElement())); 417 if (src.hasEquivalence()) 418 tgt.setRelationshipElement(convertConceptMapRelationship(src.getEquivalenceElement(), tgt)); 419 if (src.hasComment()) 420 tgt.setCommentElement(String30_50.convertString(src.getCommentElement())); 421 for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) 422 tgt.addDependsOn(convertOtherElementComponent(t, tgtMap)); 423 for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getProduct()) 424 tgt.addProduct(convertOtherElementComponent(t, tgtMap)); 425 return tgt; 426 } 427 428 public static org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.r5.model.ConceptMap srcMap) throws FHIRException { 429 if (src == null) 430 return null; 431 org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent(); 432 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE); 433 if (src.hasCode()) 434 tgt.setCodeElement(Code30_50.convertCode(src.getCodeElement())); 435 if (src.hasDisplay()) 436 tgt.setDisplayElement(String30_50.convertString(src.getDisplayElement())); 437 if (src.hasRelationship()) 438 tgt.setEquivalenceElement(convertConceptMapEquivalence(src.getRelationshipElement(), src)); 439 if (src.hasComment()) 440 tgt.setCommentElement(String30_50.convertString(src.getCommentElement())); 441 for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) 442 tgt.addDependsOn(convertOtherElementComponent(t, srcMap)); 443 for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getProduct()) 444 tgt.addProduct(convertOtherElementComponent(t, srcMap)); 445 return tgt; 446 } 447}