001package org.hl7.fhir.convertors.conv40_50.resources40_50; 002 003import org.hl7.fhir.convertors.context.ConversionContext30_50; 004import org.hl7.fhir.convertors.context.ConversionContext40_50; 005import org.hl7.fhir.convertors.conv30_50.datatypes30_50.Reference30_50; 006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.CodeableConcept40_50; 007import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Identifier40_50; 008import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Period40_50; 009import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.DateTime40_50; 010import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50; 011import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Narrative40_50; 012import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Reference40_50; 013import org.hl7.fhir.exceptions.FHIRException; 014import org.hl7.fhir.r5.model.RelatedArtifact; 015 016/* 017 Copyright (c) 2011+, HL7, Inc. 018 All rights reserved. 019 020 Redistribution and use in source and binary forms, with or without modification, 021 are permitted provided that the following conditions are met: 022 023 * Redistributions of source code must retain the above copyright notice, this 024 list of conditions and the following disclaimer. 025 * Redistributions in binary form must reproduce the above copyright notice, 026 this list of conditions and the following disclaimer in the documentation 027 and/or other materials provided with the distribution. 028 * Neither the name of HL7 nor the names of its contributors may be used to 029 endorse or promote products derived from this software without specific 030 prior written permission. 031 032 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 033 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 034 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 035 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 036 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 037 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 038 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 039 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 040 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 041 POSSIBILITY OF SUCH DAMAGE. 042 043*/ 044// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 045public class Composition40_50 { 046 047 public static org.hl7.fhir.r5.model.Composition convertComposition(org.hl7.fhir.r4.model.Composition src) throws FHIRException { 048 if (src == null) 049 return null; 050 org.hl7.fhir.r5.model.Composition tgt = new org.hl7.fhir.r5.model.Composition(); 051 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt); 052 if (src.hasIdentifier()) 053 tgt.setIdentifier(Identifier40_50.convertIdentifier(src.getIdentifier())); 054 if (src.hasStatus()) 055 tgt.setStatusElement(convertCompositionStatus(src.getStatusElement())); 056 if (src.hasType()) 057 tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType())); 058 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) 059 tgt.addCategory(CodeableConcept40_50.convertCodeableConcept(t)); 060 if (src.hasSubject()) 061 tgt.setSubject(Reference40_50.convertReference(src.getSubject())); 062 if (src.hasEncounter()) 063 tgt.setEncounter(Reference40_50.convertReference(src.getEncounter())); 064 if (src.hasDate()) 065 tgt.setDateElement(DateTime40_50.convertDateTime(src.getDateElement())); 066 for (org.hl7.fhir.r4.model.Reference t : src.getAuthor()) tgt.addAuthor(Reference40_50.convertReference(t)); 067 if (src.hasTitle()) 068 tgt.setTitleElement(String40_50.convertString(src.getTitleElement())); 069 if (src.hasConfidentiality()) 070 tgt.setConfidentialityElement(convertDocumentConfidentiality(src.getConfidentialityElement())); 071 for (org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent t : src.getAttester()) 072 tgt.addAttester(convertCompositionAttesterComponent(t)); 073 if (src.hasCustodian()) 074 tgt.setCustodian(Reference40_50.convertReference(src.getCustodian())); 075 for (org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent t : src.getRelatesTo()) 076 tgt.addRelatesTo(convertCompositionRelatesToComponent(t)); 077 for (org.hl7.fhir.r4.model.Composition.CompositionEventComponent t : src.getEvent()) 078 tgt.addEvent(convertCompositionEventComponent(t)); 079 for (org.hl7.fhir.r4.model.Composition.SectionComponent t : src.getSection()) 080 tgt.addSection(convertSectionComponent(t)); 081 return tgt; 082 } 083 084 public static org.hl7.fhir.r4.model.Composition convertComposition(org.hl7.fhir.r5.model.Composition src) throws FHIRException { 085 if (src == null) 086 return null; 087 org.hl7.fhir.r4.model.Composition tgt = new org.hl7.fhir.r4.model.Composition(); 088 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt); 089 if (src.hasIdentifier()) 090 tgt.setIdentifier(Identifier40_50.convertIdentifier(src.getIdentifier())); 091 if (src.hasStatus()) 092 tgt.setStatusElement(convertCompositionStatus(src.getStatusElement())); 093 if (src.hasType()) 094 tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType())); 095 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) 096 tgt.addCategory(CodeableConcept40_50.convertCodeableConcept(t)); 097 if (src.hasSubject()) 098 tgt.setSubject(Reference40_50.convertReference(src.getSubject())); 099 if (src.hasEncounter()) 100 tgt.setEncounter(Reference40_50.convertReference(src.getEncounter())); 101 if (src.hasDate()) 102 tgt.setDateElement(DateTime40_50.convertDateTime(src.getDateElement())); 103 for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) tgt.addAuthor(Reference40_50.convertReference(t)); 104 if (src.hasTitle()) 105 tgt.setTitleElement(String40_50.convertString(src.getTitleElement())); 106 if (src.hasConfidentiality()) 107 tgt.setConfidentialityElement(convertDocumentConfidentiality(src.getConfidentialityElement())); 108 for (org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent t : src.getAttester()) 109 tgt.addAttester(convertCompositionAttesterComponent(t)); 110 if (src.hasCustodian()) 111 tgt.setCustodian(Reference40_50.convertReference(src.getCustodian())); 112 for (RelatedArtifact t : src.getRelatesTo()) 113 tgt.addRelatesTo(convertCompositionRelatesToComponent(t)); 114 for (org.hl7.fhir.r5.model.Composition.CompositionEventComponent t : src.getEvent()) 115 tgt.addEvent(convertCompositionEventComponent(t)); 116 for (org.hl7.fhir.r5.model.Composition.SectionComponent t : src.getSection()) 117 tgt.addSection(convertSectionComponent(t)); 118 return tgt; 119 } 120 121 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.CompositionStatus> convertCompositionStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.CompositionStatus> src) throws FHIRException { 122 if (src == null || src.isEmpty()) 123 return null; 124 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.CompositionStatus> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.CompositionStatusEnumFactory()); 125 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 126 switch (src.getValue()) { 127 case PRELIMINARY: 128 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.CompositionStatus.PRELIMINARY); 129 break; 130 case FINAL: 131 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.CompositionStatus.FINAL); 132 break; 133 case AMENDED: 134 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.CompositionStatus.AMENDED); 135 break; 136 case ENTEREDINERROR: 137 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.CompositionStatus.ENTEREDINERROR); 138 break; 139 default: 140 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.CompositionStatus.NULL); 141 break; 142 } 143 return tgt; 144 } 145 146 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.CompositionStatus> convertCompositionStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.CompositionStatus> src) throws FHIRException { 147 if (src == null || src.isEmpty()) 148 return null; 149 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.CompositionStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Composition.CompositionStatusEnumFactory()); 150 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 151 switch (src.getValue()) { 152 case PRELIMINARY: 153 tgt.setValue(org.hl7.fhir.r4.model.Composition.CompositionStatus.PRELIMINARY); 154 break; 155 case FINAL: 156 tgt.setValue(org.hl7.fhir.r4.model.Composition.CompositionStatus.FINAL); 157 break; 158 case AMENDED: 159 tgt.setValue(org.hl7.fhir.r4.model.Composition.CompositionStatus.AMENDED); 160 break; 161 case ENTEREDINERROR: 162 tgt.setValue(org.hl7.fhir.r4.model.Composition.CompositionStatus.ENTEREDINERROR); 163 break; 164 default: 165 tgt.setValue(org.hl7.fhir.r4.model.Composition.CompositionStatus.NULL); 166 break; 167 } 168 return tgt; 169 } 170 171 static public org.hl7.fhir.r5.model.CodeType convertDocumentConfidentiality(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.DocumentConfidentiality> src) throws FHIRException { 172 if (src == null || src.isEmpty()) 173 return null; 174 org.hl7.fhir.r5.model.CodeType tgt = new org.hl7.fhir.r5.model.CodeType(); 175 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 176 tgt.setValue(src.getValue().toCode()); 177 return tgt; 178 } 179 180 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.DocumentConfidentiality> convertDocumentConfidentiality(org.hl7.fhir.r5.model.CodeType src) throws FHIRException { 181 if (src == null || src.isEmpty()) 182 return null; 183 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.DocumentConfidentiality> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Composition.DocumentConfidentialityEnumFactory()); 184 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 185 switch (src.getValue()) { 186 case "U": 187 tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.U); 188 break; 189 case "L": 190 tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.L); 191 break; 192 case "M": 193 tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.M); 194 break; 195 case "N": 196 tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.N); 197 break; 198 case "R": 199 tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.R); 200 break; 201 case "V": 202 tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.V); 203 break; 204 default: 205 tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.NULL); 206 break; 207 } 208 return tgt; 209 } 210 211 public static org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent src) throws FHIRException { 212 if (src == null) 213 return null; 214 org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent(); 215 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 216 if (src.hasMode()) 217 tgt.setMode(convertCompositionAttestationMode(src.getModeElement())); 218 if (src.hasTime()) 219 tgt.setTimeElement(DateTime40_50.convertDateTime(src.getTimeElement())); 220 if (src.hasParty()) 221 tgt.setParty(Reference40_50.convertReference(src.getParty())); 222 return tgt; 223 } 224 225 public static org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent src) throws FHIRException { 226 if (src == null) 227 return null; 228 org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent(); 229 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 230 if (src.hasMode()) 231 tgt.setModeElement(convertCompositionAttestationMode(src.getMode())); 232 if (src.hasTime()) 233 tgt.setTimeElement(DateTime40_50.convertDateTime(src.getTimeElement())); 234 if (src.hasParty()) 235 tgt.setParty(Reference40_50.convertReference(src.getParty())); 236 return tgt; 237 } 238 239 static public org.hl7.fhir.r5.model.CodeableConcept convertCompositionAttestationMode(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.CompositionAttestationMode> src) throws FHIRException { 240 if (src == null || src.isEmpty()) 241 return null; 242 org.hl7.fhir.r5.model.CodeableConcept tgt = new org.hl7.fhir.r5.model.CodeableConcept(); 243 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 244 switch (src.getValue()) { 245 case PERSONAL: 246 tgt.addCoding().setSystem("http://hl7.org/fhir/composition-attestation-mode").setCode("personal"); 247 break; 248 case PROFESSIONAL: 249 tgt.addCoding().setSystem("http://hl7.org/fhir/composition-attestation-mode").setCode("professional"); 250 break; 251 case LEGAL: 252 tgt.addCoding().setSystem("http://hl7.org/fhir/composition-attestation-mode").setCode("legal"); 253 break; 254 case OFFICIAL: 255 tgt.addCoding().setSystem("http://hl7.org/fhir/composition-attestation-mode").setCode("official"); 256 break; 257 default: 258 break; 259 } 260 return tgt; 261 } 262 263 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.CompositionAttestationMode> convertCompositionAttestationMode(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { 264 if (src == null || src.isEmpty()) 265 return null; 266 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.CompositionAttestationMode> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Composition.CompositionAttestationModeEnumFactory()); 267 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 268 switch (src.getCode("http://hl7.org/fhir/composition-attestation-mode")) { 269 case "personal": 270 tgt.setValue(org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PERSONAL); 271 break; 272 case "professional": 273 tgt.setValue(org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PROFESSIONAL); 274 break; 275 case "legal": 276 tgt.setValue(org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.LEGAL); 277 break; 278 case "official": 279 tgt.setValue(org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.OFFICIAL); 280 break; 281 default: 282 tgt.setValue(org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.NULL); 283 break; 284 } 285 return tgt; 286 } 287 288 public static org.hl7.fhir.r5.model.RelatedArtifact convertCompositionRelatesToComponent(org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent src) throws FHIRException { 289 if (src == null) 290 return null; 291 org.hl7.fhir.r5.model.RelatedArtifact tgt = new org.hl7.fhir.r5.model.RelatedArtifact(); 292 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 293 if (src.hasCode()) 294 tgt.setTypeElement(convertDocumentRelationshipType(src.getCodeElement())); 295 if (src.hasTargetReference()) 296 tgt.setResourceReference(Reference40_50.convertReference(src.getTargetReference())); 297 return tgt; 298 } 299 300 public static org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent convertCompositionRelatesToComponent(org.hl7.fhir.r5.model.RelatedArtifact src) throws FHIRException { 301 if (src == null) 302 return null; 303 org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent tgt = new org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent(); 304 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 305 if (src.hasType()) 306 tgt.setCodeElement(convertDocumentRelationshipType(src.getTypeElement())); 307 if (src.hasResourceReference()) 308 tgt.setTarget(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getResourceReference())); 309 return tgt; 310 } 311 312 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType> convertDocumentRelationshipType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.DocumentRelationshipType> src) throws FHIRException { 313 if (src == null || src.isEmpty()) 314 return null; 315 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactTypeEnumFactory()); 316 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 317 switch (src.getValue()) { 318 case REPLACES: 319 tgt.setValue(org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.REPLACES); 320 break; 321 case TRANSFORMS: 322 tgt.setValue(org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.TRANSFORMS); 323 break; 324 case SIGNS: 325 tgt.setValue(org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.SIGNS); 326 break; 327 case APPENDS: 328 tgt.setValue(org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.APPENDS); 329 break; 330 default: 331 tgt.setValue(org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.NULL); 332 break; 333 } 334 return tgt; 335 } 336 337 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.DocumentRelationshipType> convertDocumentRelationshipType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType> src) throws FHIRException { 338 if (src == null || src.isEmpty()) 339 return null; 340 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.DocumentRelationshipType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Composition.DocumentRelationshipTypeEnumFactory()); 341 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 342 switch (src.getValue()) { 343 case REPLACES: 344 tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.REPLACES); 345 break; 346 case TRANSFORMS: 347 tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.TRANSFORMS); 348 break; 349 case SIGNS: 350 tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.SIGNS); 351 break; 352 case APPENDS: 353 tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.APPENDS); 354 break; 355 default: 356 tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.NULL); 357 break; 358 } 359 return tgt; 360 } 361 362 public static org.hl7.fhir.r5.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.r4.model.Composition.CompositionEventComponent src) throws FHIRException { 363 if (src == null) 364 return null; 365 org.hl7.fhir.r5.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionEventComponent(); 366 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 367 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) 368 tgt.addCode(CodeableConcept40_50.convertCodeableConcept(t)); 369 if (src.hasPeriod()) 370 tgt.setPeriod(Period40_50.convertPeriod(src.getPeriod())); 371 for (org.hl7.fhir.r4.model.Reference t : src.getDetail()) tgt.addDetail(Reference40_50.convertReference(t)); 372 return tgt; 373 } 374 375 public static org.hl7.fhir.r4.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.r5.model.Composition.CompositionEventComponent src) throws FHIRException { 376 if (src == null) 377 return null; 378 org.hl7.fhir.r4.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.r4.model.Composition.CompositionEventComponent(); 379 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 380 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) 381 tgt.addCode(CodeableConcept40_50.convertCodeableConcept(t)); 382 if (src.hasPeriod()) 383 tgt.setPeriod(Period40_50.convertPeriod(src.getPeriod())); 384 for (org.hl7.fhir.r5.model.Reference t : src.getDetail()) tgt.addDetail(Reference40_50.convertReference(t)); 385 return tgt; 386 } 387 388 public static org.hl7.fhir.r5.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.r4.model.Composition.SectionComponent src) throws FHIRException { 389 if (src == null) 390 return null; 391 org.hl7.fhir.r5.model.Composition.SectionComponent tgt = new org.hl7.fhir.r5.model.Composition.SectionComponent(); 392 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 393 if (src.hasTitle()) 394 tgt.setTitleElement(String40_50.convertString(src.getTitleElement())); 395 if (src.hasCode()) 396 tgt.setCode(CodeableConcept40_50.convertCodeableConcept(src.getCode())); 397 for (org.hl7.fhir.r4.model.Reference t : src.getAuthor()) tgt.addAuthor(Reference40_50.convertReference(t)); 398 if (src.hasFocus()) 399 tgt.setFocus(Reference40_50.convertReference(src.getFocus())); 400 if (src.hasText()) 401 tgt.setText(Narrative40_50.convertNarrative(src.getText())); 402 if (src.hasMode()) 403 tgt.setModeElement(convertSectionMode(src.getModeElement())); 404 if (src.hasOrderedBy()) 405 tgt.setOrderedBy(CodeableConcept40_50.convertCodeableConcept(src.getOrderedBy())); 406 for (org.hl7.fhir.r4.model.Reference t : src.getEntry()) tgt.addEntry(Reference40_50.convertReference(t)); 407 if (src.hasEmptyReason()) 408 tgt.setEmptyReason(CodeableConcept40_50.convertCodeableConcept(src.getEmptyReason())); 409 for (org.hl7.fhir.r4.model.Composition.SectionComponent t : src.getSection()) 410 tgt.addSection(convertSectionComponent(t)); 411 return tgt; 412 } 413 414 public static org.hl7.fhir.r4.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.r5.model.Composition.SectionComponent src) throws FHIRException { 415 if (src == null) 416 return null; 417 org.hl7.fhir.r4.model.Composition.SectionComponent tgt = new org.hl7.fhir.r4.model.Composition.SectionComponent(); 418 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 419 if (src.hasTitle()) 420 tgt.setTitleElement(String40_50.convertString(src.getTitleElement())); 421 if (src.hasCode()) 422 tgt.setCode(CodeableConcept40_50.convertCodeableConcept(src.getCode())); 423 for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) tgt.addAuthor(Reference40_50.convertReference(t)); 424 if (src.hasFocus()) 425 tgt.setFocus(Reference40_50.convertReference(src.getFocus())); 426 if (src.hasText()) 427 tgt.setText(Narrative40_50.convertNarrative(src.getText())); 428 if (src.hasMode()) 429 tgt.setModeElement(convertSectionMode(src.getModeElement())); 430 if (src.hasOrderedBy()) 431 tgt.setOrderedBy(CodeableConcept40_50.convertCodeableConcept(src.getOrderedBy())); 432 for (org.hl7.fhir.r5.model.Reference t : src.getEntry()) tgt.addEntry(Reference40_50.convertReference(t)); 433 if (src.hasEmptyReason()) 434 tgt.setEmptyReason(CodeableConcept40_50.convertCodeableConcept(src.getEmptyReason())); 435 for (org.hl7.fhir.r5.model.Composition.SectionComponent t : src.getSection()) 436 tgt.addSection(convertSectionComponent(t)); 437 return tgt; 438 } 439 440 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ListMode> convertSectionMode(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.SectionMode> src) throws FHIRException { 441 if (src == null || src.isEmpty()) 442 return null; 443 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ListMode> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.ListModeEnumFactory()); 444 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 445 switch (src.getValue()) { 446 case WORKING: 447 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ListMode.WORKING); 448 break; 449 case SNAPSHOT: 450 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ListMode.SNAPSHOT); 451 break; 452 case CHANGES: 453 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ListMode.CHANGES); 454 break; 455 default: 456 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ListMode.NULL); 457 break; 458 } 459 return tgt; 460 } 461 462 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.SectionMode> convertSectionMode(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ListMode> src) throws FHIRException { 463 if (src == null || src.isEmpty()) 464 return null; 465 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.SectionMode> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Composition.SectionModeEnumFactory()); 466 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 467 switch (src.getValue()) { 468 case WORKING: 469 tgt.setValue(org.hl7.fhir.r4.model.Composition.SectionMode.WORKING); 470 break; 471 case SNAPSHOT: 472 tgt.setValue(org.hl7.fhir.r4.model.Composition.SectionMode.SNAPSHOT); 473 break; 474 case CHANGES: 475 tgt.setValue(org.hl7.fhir.r4.model.Composition.SectionMode.CHANGES); 476 break; 477 default: 478 tgt.setValue(org.hl7.fhir.r4.model.Composition.SectionMode.NULL); 479 break; 480 } 481 return tgt; 482 } 483}