
001package org.hl7.fhir.convertors.conv43_50.resources43_50; 002 003import org.hl7.fhir.convertors.context.ConversionContext43_50; 004import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.CodeableConcept43_50; 005import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Identifier43_50; 006import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Period43_50; 007import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Code43_50; 008import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.DateTime43_50; 009import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50; 010import org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50.Narrative43_50; 011import org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50.Reference43_50; 012import org.hl7.fhir.exceptions.FHIRException; 013import org.hl7.fhir.r5.model.CodeableReference; 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 Composition43_50 { 046 047 public static org.hl7.fhir.r5.model.Composition convertComposition(org.hl7.fhir.r4b.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 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt); 052 if (src.hasIdentifier()) 053 tgt.addIdentifier(Identifier43_50.convertIdentifier(src.getIdentifier())); 054 if (src.hasStatus()) 055 tgt.setStatusElement(convertCompositionStatus(src.getStatusElement())); 056 if (src.hasType()) 057 tgt.setType(CodeableConcept43_50.convertCodeableConcept(src.getType())); 058 for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getCategory()) 059 tgt.addCategory(CodeableConcept43_50.convertCodeableConcept(t)); 060 if (src.hasSubject()) 061 tgt.addSubject(Reference43_50.convertReference(src.getSubject())); 062 if (src.hasEncounter()) 063 tgt.setEncounter(Reference43_50.convertReference(src.getEncounter())); 064 if (src.hasDate()) 065 tgt.setDateElement(DateTime43_50.convertDateTime(src.getDateElement())); 066 for (org.hl7.fhir.r4b.model.Reference t : src.getAuthor()) tgt.addAuthor(Reference43_50.convertReference(t)); 067 if (src.hasTitle()) 068 tgt.setTitleElement(String43_50.convertString(src.getTitleElement())); 069 if (src.hasConfidentiality()) 070 tgt.getMeta().addSecurity().setCodeElement(Code43_50.convertCode(src.getConfidentialityElement())); 071 for (org.hl7.fhir.r4b.model.Composition.CompositionAttesterComponent t : src.getAttester()) 072 tgt.addAttester(convertCompositionAttesterComponent(t)); 073 if (src.hasCustodian()) 074 tgt.setCustodian(Reference43_50.convertReference(src.getCustodian())); 075 for (org.hl7.fhir.r4b.model.Composition.CompositionRelatesToComponent t : src.getRelatesTo()) 076 tgt.addRelatesTo(convertCompositionRelatesToComponent(t)); 077 for (org.hl7.fhir.r4b.model.Composition.CompositionEventComponent t : src.getEvent()) 078 tgt.addEvent(convertCompositionEventComponent(t)); 079 for (org.hl7.fhir.r4b.model.Composition.SectionComponent t : src.getSection()) 080 tgt.addSection(convertSectionComponent(t)); 081 return tgt; 082 } 083 084 public static org.hl7.fhir.r4b.model.Composition convertComposition(org.hl7.fhir.r5.model.Composition src) throws FHIRException { 085 if (src == null) 086 return null; 087 org.hl7.fhir.r4b.model.Composition tgt = new org.hl7.fhir.r4b.model.Composition(); 088 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt); 089 if (src.hasIdentifier()) 090 tgt.setIdentifier(Identifier43_50.convertIdentifier(src.getIdentifierFirstRep())); 091 if (src.hasStatus()) 092 tgt.setStatusElement(convertCompositionStatus(src.getStatusElement())); 093 if (src.hasType()) 094 tgt.setType(CodeableConcept43_50.convertCodeableConcept(src.getType())); 095 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) 096 tgt.addCategory(CodeableConcept43_50.convertCodeableConcept(t)); 097 if (src.hasSubject()) 098 tgt.setSubject(Reference43_50.convertReference(src.getSubjectFirstRep())); 099 if (src.hasEncounter()) 100 tgt.setEncounter(Reference43_50.convertReference(src.getEncounter())); 101 if (src.hasDate()) 102 tgt.setDateElement(DateTime43_50.convertDateTime(src.getDateElement())); 103 for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) tgt.addAuthor(Reference43_50.convertReference(t)); 104 if (src.hasTitle()) 105 tgt.setTitleElement(String43_50.convertString(src.getTitleElement())); 106 if (src.getMeta().hasSecurity()) 107 tgt.setConfidentialityElement(Code43_50.convertCode(src.getMeta().getSecurityFirstRep().getCodeElement())); 108 for (org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent t : src.getAttester()) 109 tgt.addAttester(convertCompositionAttesterComponent(t)); 110 if (src.hasCustodian()) 111 tgt.setCustodian(Reference43_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.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.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 ConversionContext43_50.INSTANCE.getVersionConvertor_43_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.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.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.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.CompositionStatus> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Enumerations.CompositionStatusEnumFactory()); 150 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 151 switch (src.getValue()) { 152 case PRELIMINARY: 153 tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.CompositionStatus.PRELIMINARY); 154 break; 155 case FINAL: 156 tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.CompositionStatus.FINAL); 157 break; 158 case AMENDED: 159 tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.CompositionStatus.AMENDED); 160 break; 161 case ENTEREDINERROR: 162 tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.CompositionStatus.ENTEREDINERROR); 163 break; 164 default: 165 tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.CompositionStatus.NULL); 166 break; 167 } 168 return tgt; 169 } 170 171 public static org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.r4b.model.Composition.CompositionAttesterComponent src) throws FHIRException { 172 if (src == null) 173 return null; 174 org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent(); 175 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 176 if (src.hasMode()) 177 tgt.setMode(convertCompositionAttestationMode(src.getModeElement())); 178 if (src.hasTime()) 179 tgt.setTimeElement(DateTime43_50.convertDateTime(src.getTimeElement())); 180 if (src.hasParty()) 181 tgt.setParty(Reference43_50.convertReference(src.getParty())); 182 return tgt; 183 } 184 185 public static org.hl7.fhir.r4b.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent src) throws FHIRException { 186 if (src == null) 187 return null; 188 org.hl7.fhir.r4b.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.r4b.model.Composition.CompositionAttesterComponent(); 189 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 190 if (src.hasMode()) 191 tgt.setModeElement(convertCompositionAttestationMode(src.getMode())); 192 if (src.hasTime()) 193 tgt.setTimeElement(DateTime43_50.convertDateTime(src.getTimeElement())); 194 if (src.hasParty()) 195 tgt.setParty(Reference43_50.convertReference(src.getParty())); 196 return tgt; 197 } 198 199 static public org.hl7.fhir.r5.model.CodeableConcept convertCompositionAttestationMode(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Composition.CompositionAttestationMode> src) throws FHIRException { 200 if (src == null || src.isEmpty()) 201 return null; 202 org.hl7.fhir.r5.model.CodeableConcept tgt = new org.hl7.fhir.r5.model.CodeableConcept(); 203 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 204 switch (src.getValue()) { 205 case PERSONAL: 206 tgt.addCoding().setSystem("http://hl7.org/fhir/composition-attestation-mode").setCode("personal"); 207 break; 208 case PROFESSIONAL: 209 tgt.addCoding().setSystem("http://hl7.org/fhir/composition-attestation-mode").setCode("professional"); 210 break; 211 case LEGAL: 212 tgt.addCoding().setSystem("http://hl7.org/fhir/composition-attestation-mode").setCode("legal"); 213 break; 214 case OFFICIAL: 215 tgt.addCoding().setSystem("http://hl7.org/fhir/composition-attestation-mode").setCode("official"); 216 break; 217 default: 218 break; 219 } 220 return tgt; 221 } 222 223 static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Composition.CompositionAttestationMode> convertCompositionAttestationMode(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { 224 if (src == null || src.isEmpty()) 225 return null; 226 org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Composition.CompositionAttestationMode> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Composition.CompositionAttestationModeEnumFactory()); 227 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 228 switch (src.getCode("http://hl7.org/fhir/composition-attestation-mode")) { 229 case "personal": 230 tgt.setValue(org.hl7.fhir.r4b.model.Composition.CompositionAttestationMode.PERSONAL); 231 break; 232 case "professional": 233 tgt.setValue(org.hl7.fhir.r4b.model.Composition.CompositionAttestationMode.PROFESSIONAL); 234 break; 235 case "legal": 236 tgt.setValue(org.hl7.fhir.r4b.model.Composition.CompositionAttestationMode.LEGAL); 237 break; 238 case "official": 239 tgt.setValue(org.hl7.fhir.r4b.model.Composition.CompositionAttestationMode.OFFICIAL); 240 break; 241 default: 242 tgt.setValue(org.hl7.fhir.r4b.model.Composition.CompositionAttestationMode.NULL); 243 break; 244 } 245 return tgt; 246 } 247 248 public static org.hl7.fhir.r5.model.RelatedArtifact convertCompositionRelatesToComponent(org.hl7.fhir.r4b.model.Composition.CompositionRelatesToComponent src) throws FHIRException { 249 if (src == null) 250 return null; 251 org.hl7.fhir.r5.model.RelatedArtifact tgt = new org.hl7.fhir.r5.model.RelatedArtifact(); 252 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 253 if (src.hasCode()) 254 tgt.setTypeElement(convertDocumentRelationshipType(src.getCodeElement())); 255 if (src.hasTargetReference()) 256 tgt.setResourceReference(Reference43_50.convertReference(src.getTargetReference())); 257 return tgt; 258 } 259 260 public static org.hl7.fhir.r4b.model.Composition.CompositionRelatesToComponent convertCompositionRelatesToComponent(org.hl7.fhir.r5.model.RelatedArtifact src) throws FHIRException { 261 if (src == null) 262 return null; 263 org.hl7.fhir.r4b.model.Composition.CompositionRelatesToComponent tgt = new org.hl7.fhir.r4b.model.Composition.CompositionRelatesToComponent(); 264 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 265 if (src.hasType()) 266 tgt.setCodeElement(convertDocumentRelationshipType(src.getTypeElement())); 267 if (src.hasResourceReference()) 268 tgt.setTarget(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getResourceReference())); 269 return tgt; 270 } 271 272 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType> convertDocumentRelationshipType(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.DocumentRelationshipType> src) throws FHIRException { 273 if (src == null || src.isEmpty()) 274 return null; 275 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()); 276 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 277 switch (src.getValue()) { 278 case REPLACES: 279 tgt.setValue(org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.REPLACES); 280 break; 281 case TRANSFORMS: 282 tgt.setValue(org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.TRANSFORMS); 283 break; 284 case SIGNS: 285 tgt.setValue(org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.SIGNS); 286 break; 287 case APPENDS: 288 tgt.setValue(org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.APPENDS); 289 break; 290 default: 291 tgt.setValue(org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.NULL); 292 break; 293 } 294 return tgt; 295 } 296 297 static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.DocumentRelationshipType> convertDocumentRelationshipType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType> src) throws FHIRException { 298 if (src == null || src.isEmpty()) 299 return null; 300 org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.DocumentRelationshipType> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Enumerations.DocumentRelationshipTypeEnumFactory()); 301 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 302 switch (src.getValue()) { 303 case REPLACES: 304 tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.DocumentRelationshipType.REPLACES); 305 break; 306 case TRANSFORMS: 307 tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.DocumentRelationshipType.TRANSFORMS); 308 break; 309 case SIGNS: 310 tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.DocumentRelationshipType.SIGNS); 311 break; 312 case APPENDS: 313 tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.DocumentRelationshipType.APPENDS); 314 break; 315 default: 316 tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.DocumentRelationshipType.NULL); 317 break; 318 } 319 return tgt; 320 } 321 322 public static org.hl7.fhir.r5.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.r4b.model.Composition.CompositionEventComponent src) throws FHIRException { 323 if (src == null) 324 return null; 325 org.hl7.fhir.r5.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionEventComponent(); 326 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 327 for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getCode()) 328 tgt.addDetail().setConcept(CodeableConcept43_50.convertCodeableConcept(t)); 329 if (src.hasPeriod()) 330 tgt.setPeriod(Period43_50.convertPeriod(src.getPeriod())); 331 for (org.hl7.fhir.r4b.model.Reference t : src.getDetail()) tgt.addDetail().setReference(Reference43_50.convertReference(t)); 332 return tgt; 333 } 334 335 public static org.hl7.fhir.r4b.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.r5.model.Composition.CompositionEventComponent src) throws FHIRException { 336 if (src == null) 337 return null; 338 org.hl7.fhir.r4b.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.r4b.model.Composition.CompositionEventComponent(); 339 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 340 if (src.hasPeriod()) 341 tgt.setPeriod(Period43_50.convertPeriod(src.getPeriod())); 342 for (CodeableReference t : src.getDetail()) { 343 if (t.hasConcept()) { 344 tgt.addCode(CodeableConcept43_50.convertCodeableConcept(t.getConcept())); 345 } 346 if (t.hasReference()) { 347 tgt.addDetail(Reference43_50.convertReference(t.getReference())); 348 } 349 } 350 return tgt; 351 } 352 353 public static org.hl7.fhir.r5.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.r4b.model.Composition.SectionComponent src) throws FHIRException { 354 if (src == null) 355 return null; 356 org.hl7.fhir.r5.model.Composition.SectionComponent tgt = new org.hl7.fhir.r5.model.Composition.SectionComponent(); 357 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 358 if (src.hasTitle()) 359 tgt.setTitleElement(String43_50.convertString(src.getTitleElement())); 360 if (src.hasCode()) 361 tgt.setCode(CodeableConcept43_50.convertCodeableConcept(src.getCode())); 362 for (org.hl7.fhir.r4b.model.Reference t : src.getAuthor()) tgt.addAuthor(Reference43_50.convertReference(t)); 363 if (src.hasFocus()) 364 tgt.setFocus(Reference43_50.convertReference(src.getFocus())); 365 if (src.hasText()) 366 tgt.setText(Narrative43_50.convertNarrative(src.getText())); 367// if (src.hasMode()) 368// tgt.setModeElement(convertSectionMode(src.getModeElement())); 369 if (src.hasOrderedBy()) 370 tgt.setOrderedBy(CodeableConcept43_50.convertCodeableConcept(src.getOrderedBy())); 371 for (org.hl7.fhir.r4b.model.Reference t : src.getEntry()) tgt.addEntry(Reference43_50.convertReference(t)); 372 if (src.hasEmptyReason()) 373 tgt.setEmptyReason(CodeableConcept43_50.convertCodeableConcept(src.getEmptyReason())); 374 for (org.hl7.fhir.r4b.model.Composition.SectionComponent t : src.getSection()) 375 tgt.addSection(convertSectionComponent(t)); 376 return tgt; 377 } 378 379 public static org.hl7.fhir.r4b.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.r5.model.Composition.SectionComponent src) throws FHIRException { 380 if (src == null) 381 return null; 382 org.hl7.fhir.r4b.model.Composition.SectionComponent tgt = new org.hl7.fhir.r4b.model.Composition.SectionComponent(); 383 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 384 if (src.hasTitle()) 385 tgt.setTitleElement(String43_50.convertString(src.getTitleElement())); 386 if (src.hasCode()) 387 tgt.setCode(CodeableConcept43_50.convertCodeableConcept(src.getCode())); 388 for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) tgt.addAuthor(Reference43_50.convertReference(t)); 389 if (src.hasFocus()) 390 tgt.setFocus(Reference43_50.convertReference(src.getFocus())); 391 if (src.hasText()) 392 tgt.setText(Narrative43_50.convertNarrative(src.getText())); 393// if (src.hasMode()) 394// tgt.setModeElement(convertSectionMode(src.getModeElement())); 395 if (src.hasOrderedBy()) 396 tgt.setOrderedBy(CodeableConcept43_50.convertCodeableConcept(src.getOrderedBy())); 397 for (org.hl7.fhir.r5.model.Reference t : src.getEntry()) tgt.addEntry(Reference43_50.convertReference(t)); 398 if (src.hasEmptyReason()) 399 tgt.setEmptyReason(CodeableConcept43_50.convertCodeableConcept(src.getEmptyReason())); 400 for (org.hl7.fhir.r5.model.Composition.SectionComponent t : src.getSection()) 401 tgt.addSection(convertSectionComponent(t)); 402 return tgt; 403 } 404 405 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ListMode> convertSectionMode(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ListMode> src) throws FHIRException { 406 if (src == null || src.isEmpty()) 407 return null; 408 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()); 409 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 410 switch (src.getValue()) { 411 case WORKING: 412 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ListMode.WORKING); 413 break; 414 case SNAPSHOT: 415 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ListMode.SNAPSHOT); 416 break; 417 case CHANGES: 418 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ListMode.CHANGES); 419 break; 420 default: 421 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ListMode.NULL); 422 break; 423 } 424 return tgt; 425 } 426 427 static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ListMode> convertSectionMode(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ListMode> src) throws FHIRException { 428 if (src == null || src.isEmpty()) 429 return null; 430 org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ListMode> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Enumerations.ListModeEnumFactory()); 431 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 432 switch (src.getValue()) { 433 case WORKING: 434 tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ListMode.WORKING); 435 break; 436 case SNAPSHOT: 437 tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ListMode.SNAPSHOT); 438 break; 439 case CHANGES: 440 tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ListMode.CHANGES); 441 break; 442 default: 443 tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ListMode.NULL); 444 break; 445 } 446 return tgt; 447 } 448}