
001package org.hl7.fhir.convertors.conv40_50.resources40_50; 002 003import org.hl7.fhir.convertors.context.ConversionContext40_50; 004import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Attachment40_50; 005import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.CodeableConcept40_50; 006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Coding40_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.Boolean40_50; 010import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.DateTime40_50; 011import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Reference40_50; 012import org.hl7.fhir.exceptions.FHIRException; 013import org.hl7.fhir.r5.model.Consent; 014import org.hl7.fhir.r5.model.Enumeration; 015import org.hl7.fhir.r5.model.Enumerations; 016 017/* 018 Copyright (c) 2011+, HL7, Inc. 019 All rights reserved. 020 021 Redistribution and use in source and binary forms, with or without modification, 022 are permitted provided that the following conditions are met: 023 024 * Redistributions of source code must retain the above copyright notice, this 025 list of conditions and the following disclaimer. 026 * Redistributions in binary form must reproduce the above copyright notice, 027 this list of conditions and the following disclaimer in the documentation 028 and/or other materials provided with the distribution. 029 * Neither the name of HL7 nor the names of its contributors may be used to 030 endorse or promote products derived from this software without specific 031 prior written permission. 032 033 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 034 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 035 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 036 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 037 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 038 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 039 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 040 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 041 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 042 POSSIBILITY OF SUCH DAMAGE. 043 044*/ 045// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 046public class Consent40_50 { 047 048 public static org.hl7.fhir.r5.model.Consent convertConsent(org.hl7.fhir.r4.model.Consent src) throws FHIRException { 049 if (src == null) 050 return null; 051 org.hl7.fhir.r5.model.Consent tgt = new org.hl7.fhir.r5.model.Consent(); 052 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt); 053 for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) 054 tgt.addIdentifier(Identifier40_50.convertIdentifier(t)); 055 if (src.hasStatus()) 056 tgt.setStatusElement(convertConsentState(src.getStatusElement())); 057// if (src.hasScope()) 058// tgt.setScope(CodeableConcept40_50.convertCodeableConcept(src.getScope())); 059 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) 060 tgt.addCategory(CodeableConcept40_50.convertCodeableConcept(t)); 061 if (src.hasPatient()) 062 tgt.setSubject(Reference40_50.convertReference(src.getPatient())); 063 if (src.hasDateTime()) 064 tgt.setDateElement(DateTime40_50.convertDateTimeToDate(src.getDateTimeElement())); 065 for (org.hl7.fhir.r4.model.Reference t : src.getPerformer()) tgt.addGrantee(Reference40_50.convertReference(t)); 066 for (org.hl7.fhir.r4.model.Reference t : src.getOrganization()) tgt.addManager(Reference40_50.convertReference(t)); 067 if (src.hasSourceAttachment()) 068 tgt.addSourceAttachment(Attachment40_50.convertAttachment(src.getSourceAttachment())); 069 if (src.hasSourceReference()) 070 tgt.addSourceReference(Reference40_50.convertReference(src.getSourceReference())); 071// for (org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent t : src.getPolicy()) 072// tgt.addPolicy(convertConsentPolicyComponent(t)); 073// if (src.hasPolicyRule()) 074// tgt.setPolicyRule(CodeableConcept40_50.convertCodeableConcept(src.getPolicyRule())); 075 for (org.hl7.fhir.r4.model.Consent.ConsentVerificationComponent t : src.getVerification()) 076 tgt.addVerification(convertConsentVerificationComponent(t)); 077 if (src.hasProvision()) 078 tgt.addProvision(convertprovisionComponent(src.getProvision())); 079 return tgt; 080 } 081 082 public static org.hl7.fhir.r4.model.Consent convertConsent(org.hl7.fhir.r5.model.Consent src) throws FHIRException { 083 if (src == null) 084 return null; 085 org.hl7.fhir.r4.model.Consent tgt = new org.hl7.fhir.r4.model.Consent(); 086 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt); 087 for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) 088 tgt.addIdentifier(Identifier40_50.convertIdentifier(t)); 089 if (src.hasStatus()) 090 tgt.setStatusElement(convertConsentState(src.getStatusElement())); 091// if (src.hasScope()) 092// tgt.setScope(CodeableConcept40_50.convertCodeableConcept(src.getScope())); 093 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) 094 tgt.addCategory(CodeableConcept40_50.convertCodeableConcept(t)); 095 if (src.hasSubject()) 096 tgt.setPatient(Reference40_50.convertReference(src.getSubject())); 097 if (src.hasDate()) 098 tgt.setDateTimeElement(DateTime40_50.convertDateToDateTime(src.getDateElement())); 099 for (org.hl7.fhir.r5.model.Reference t : src.getGrantee()) tgt.addPerformer(Reference40_50.convertReference(t)); 100 for (org.hl7.fhir.r5.model.Reference t : src.getManager()) tgt.addOrganization(Reference40_50.convertReference(t)); 101 for (org.hl7.fhir.r5.model.Reference t : src.getController()) 102 tgt.addOrganization(Reference40_50.convertReference(t)); 103 if (src.hasSourceAttachment()) 104 tgt.setSource(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getSourceAttachmentFirstRep())); 105 if (src.hasSourceReference()) 106 tgt.setSource(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getSourceReferenceFirstRep())); 107// for (org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent t : src.getPolicy()) 108// tgt.addPolicy(convertConsentPolicyComponent(t)); 109// if (src.hasPolicyRule()) 110// tgt.setPolicyRule(CodeableConcept40_50.convertCodeableConcept(src.getPolicyRule())); 111 for (org.hl7.fhir.r5.model.Consent.ConsentVerificationComponent t : src.getVerification()) 112 tgt.addVerification(convertConsentVerificationComponent(t)); 113 if (src.hasProvision()) 114 tgt.setProvision(convertprovisionComponent(src.getProvisionFirstRep())); 115 return tgt; 116 } 117 118 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Consent.ConsentState> convertConsentState(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Consent.ConsentState> src) throws FHIRException { 119 if (src == null || src.isEmpty()) 120 return null; 121 Enumeration<Consent.ConsentState> tgt = new Enumeration<>(new Consent.ConsentStateEnumFactory()); 122 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 123 if (src.getValue() == null) { 124 tgt.setValue(null); 125 } else { 126 switch (src.getValue()) { 127 case DRAFT: 128 tgt.setValue(Consent.ConsentState.DRAFT); 129 break; 130 case PROPOSED: 131 tgt.setValue(Consent.ConsentState.DRAFT); 132 break; 133 case ACTIVE: 134 tgt.setValue(Consent.ConsentState.ACTIVE); 135 break; 136 case REJECTED: 137 tgt.setValue(Consent.ConsentState.INACTIVE); 138 break; 139 case INACTIVE: 140 tgt.setValue(Consent.ConsentState.INACTIVE); 141 break; 142 case ENTEREDINERROR: 143 tgt.setValue(Consent.ConsentState.ENTEREDINERROR); 144 break; 145 default: 146 tgt.setValue(Consent.ConsentState.NULL); 147 break; 148 } 149 } 150 return tgt; 151 } 152 153 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Consent.ConsentState> convertConsentState(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Consent.ConsentState> src) throws FHIRException { 154 if (src == null || src.isEmpty()) 155 return null; 156 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Consent.ConsentState> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Consent.ConsentStateEnumFactory()); 157 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 158 if (src.getValue() == null) { 159 tgt.setValue(null); 160 } else { 161 switch (src.getValue()) { 162 case DRAFT: 163 tgt.setValue(org.hl7.fhir.r4.model.Consent.ConsentState.DRAFT); 164 break; 165 case ACTIVE: 166 tgt.setValue(org.hl7.fhir.r4.model.Consent.ConsentState.ACTIVE); 167 break; 168 case INACTIVE: 169 tgt.setValue(org.hl7.fhir.r4.model.Consent.ConsentState.INACTIVE); 170 break; 171 case ENTEREDINERROR: 172 tgt.setValue(org.hl7.fhir.r4.model.Consent.ConsentState.ENTEREDINERROR); 173 break; 174 default: 175 tgt.setValue(org.hl7.fhir.r4.model.Consent.ConsentState.NULL); 176 break; 177 } 178 } 179 return tgt; 180 } 181 182// public static org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent convertConsentPolicyComponent(org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent src) throws FHIRException { 183// if (src == null) 184// return null; 185// org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent tgt = new org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent(); 186// ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 187// if (src.hasAuthority()) 188// tgt.setAuthorityElement(Uri40_50.convertUri(src.getAuthorityElement())); 189// if (src.hasUri()) 190// tgt.setUriElement(Uri40_50.convertUri(src.getUriElement())); 191// return tgt; 192// } 193// 194// public static org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent convertConsentPolicyComponent(org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent src) throws FHIRException { 195// if (src == null) 196// return null; 197// org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent tgt = new org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent(); 198// ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 199// if (src.hasAuthority()) 200// tgt.setAuthorityElement(Uri40_50.convertUri(src.getAuthorityElement())); 201// if (src.hasUri()) 202// tgt.setUriElement(Uri40_50.convertUri(src.getUriElement())); 203// return tgt; 204// } 205 206 public static org.hl7.fhir.r5.model.Consent.ConsentVerificationComponent convertConsentVerificationComponent(org.hl7.fhir.r4.model.Consent.ConsentVerificationComponent src) throws FHIRException { 207 if (src == null) 208 return null; 209 org.hl7.fhir.r5.model.Consent.ConsentVerificationComponent tgt = new org.hl7.fhir.r5.model.Consent.ConsentVerificationComponent(); 210 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt); 211 if (src.hasVerified()) 212 tgt.setVerifiedElement(Boolean40_50.convertBoolean(src.getVerifiedElement())); 213 if (src.hasVerifiedWith()) 214 tgt.setVerifiedWith(Reference40_50.convertReference(src.getVerifiedWith())); 215 if (src.hasVerificationDate()) 216 tgt.getVerificationDate().add(DateTime40_50.convertDateTime(src.getVerificationDateElement())); 217 return tgt; 218 } 219 220 public static org.hl7.fhir.r4.model.Consent.ConsentVerificationComponent convertConsentVerificationComponent(org.hl7.fhir.r5.model.Consent.ConsentVerificationComponent src) throws FHIRException { 221 if (src == null) 222 return null; 223 org.hl7.fhir.r4.model.Consent.ConsentVerificationComponent tgt = new org.hl7.fhir.r4.model.Consent.ConsentVerificationComponent(); 224 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt); 225 if (src.hasVerified()) 226 tgt.setVerifiedElement(Boolean40_50.convertBoolean(src.getVerifiedElement())); 227 if (src.hasVerifiedWith()) 228 tgt.setVerifiedWith(Reference40_50.convertReference(src.getVerifiedWith())); 229 if (src.hasVerificationDate()) 230 tgt.setVerificationDateElement(DateTime40_50.convertDateTime(src.getVerificationDate().get(0))); 231 return tgt; 232 } 233 234 public static org.hl7.fhir.r5.model.Consent.ProvisionComponent convertprovisionComponent(org.hl7.fhir.r4.model.Consent.ProvisionComponent src) throws FHIRException { 235 if (src == null) 236 return null; 237 org.hl7.fhir.r5.model.Consent.ProvisionComponent tgt = new org.hl7.fhir.r5.model.Consent.ProvisionComponent(); 238 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt); 239// if (src.hasType()) 240// tgt.setTypeElement(convertConsentProvisionType(src.getTypeElement())); 241 if (src.hasPeriod()) 242 tgt.setPeriod(Period40_50.convertPeriod(src.getPeriod())); 243 for (org.hl7.fhir.r4.model.Consent.provisionActorComponent t : src.getActor()) 244 tgt.addActor(convertprovisionActorComponent(t)); 245 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAction()) 246 tgt.addAction(CodeableConcept40_50.convertCodeableConcept(t)); 247 for (org.hl7.fhir.r4.model.Coding t : src.getSecurityLabel()) tgt.addSecurityLabel(Coding40_50.convertCoding(t)); 248 for (org.hl7.fhir.r4.model.Coding t : src.getPurpose()) tgt.addPurpose(Coding40_50.convertCoding(t)); 249// for (org.hl7.fhir.r4.model.Coding t : src.getClass_()) tgt.addClass_(Coding40_50.convertCoding(t)); 250 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) 251 tgt.addCode(CodeableConcept40_50.convertCodeableConcept(t)); 252 if (src.hasDataPeriod()) 253 tgt.setDataPeriod(Period40_50.convertPeriod(src.getDataPeriod())); 254 for (org.hl7.fhir.r4.model.Consent.provisionDataComponent t : src.getData()) 255 tgt.addData(convertprovisionDataComponent(t)); 256 for (org.hl7.fhir.r4.model.Consent.ProvisionComponent t : src.getProvision()) 257 tgt.addProvision(convertprovisionComponent(t)); 258 return tgt; 259 } 260 261 public static org.hl7.fhir.r4.model.Consent.ProvisionComponent convertprovisionComponent(org.hl7.fhir.r5.model.Consent.ProvisionComponent src) throws FHIRException { 262 if (src == null) 263 return null; 264 org.hl7.fhir.r4.model.Consent.ProvisionComponent tgt = new org.hl7.fhir.r4.model.Consent.ProvisionComponent(); 265 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt); 266// if (src.hasType()) 267// tgt.setTypeElement(convertConsentProvisionType(src.getTypeElement())); 268 if (src.hasPeriod()) 269 tgt.setPeriod(Period40_50.convertPeriod(src.getPeriod())); 270 for (org.hl7.fhir.r5.model.Consent.ProvisionActorComponent t : src.getActor()) 271 tgt.addActor(convertprovisionActorComponent(t)); 272 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAction()) 273 tgt.addAction(CodeableConcept40_50.convertCodeableConcept(t)); 274 for (org.hl7.fhir.r5.model.Coding t : src.getSecurityLabel()) tgt.addSecurityLabel(Coding40_50.convertCoding(t)); 275 for (org.hl7.fhir.r5.model.Coding t : src.getPurpose()) tgt.addPurpose(Coding40_50.convertCoding(t)); 276// for (org.hl7.fhir.r5.model.Coding t : src.getClass_()) tgt.addClass_(Coding40_50.convertCoding(t)); 277 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) 278 tgt.addCode(CodeableConcept40_50.convertCodeableConcept(t)); 279 if (src.hasDataPeriod()) 280 tgt.setDataPeriod(Period40_50.convertPeriod(src.getDataPeriod())); 281 for (org.hl7.fhir.r5.model.Consent.ProvisionDataComponent t : src.getData()) 282 tgt.addData(convertprovisionDataComponent(t)); 283 for (org.hl7.fhir.r5.model.Consent.ProvisionComponent t : src.getProvision()) 284 tgt.addProvision(convertprovisionComponent(t)); 285 return tgt; 286 } 287 288 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ConsentProvisionType> convertConsentProvisionType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Consent.ConsentProvisionType> src) throws FHIRException { 289 if (src == null || src.isEmpty()) 290 return null; 291 Enumeration<Enumerations.ConsentProvisionType> tgt = new Enumeration<>(new Enumerations.ConsentProvisionTypeEnumFactory()); 292 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 293 if (src.getValue() == null) { 294 tgt.setValue(null); 295 } else { 296 switch (src.getValue()) { 297 case DENY: 298 tgt.setValue(Enumerations.ConsentProvisionType.DENY); 299 break; 300 case PERMIT: 301 tgt.setValue(Enumerations.ConsentProvisionType.PERMIT); 302 break; 303 default: 304 tgt.setValue(Enumerations.ConsentProvisionType.NULL); 305 break; 306 } 307 } 308 return tgt; 309 } 310 311 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Consent.ConsentProvisionType> convertConsentProvisionType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ConsentProvisionType> src) throws FHIRException { 312 if (src == null || src.isEmpty()) 313 return null; 314 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Consent.ConsentProvisionType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Consent.ConsentProvisionTypeEnumFactory()); 315 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 316 if (src.getValue() == null) { 317 tgt.setValue(null); 318 } else { 319 switch (src.getValue()) { 320 case DENY: 321 tgt.setValue(org.hl7.fhir.r4.model.Consent.ConsentProvisionType.DENY); 322 break; 323 case PERMIT: 324 tgt.setValue(org.hl7.fhir.r4.model.Consent.ConsentProvisionType.PERMIT); 325 break; 326 default: 327 tgt.setValue(org.hl7.fhir.r4.model.Consent.ConsentProvisionType.NULL); 328 break; 329 } 330 } 331 return tgt; 332 } 333 334 public static org.hl7.fhir.r5.model.Consent.ProvisionActorComponent convertprovisionActorComponent(org.hl7.fhir.r4.model.Consent.provisionActorComponent src) throws FHIRException { 335 if (src == null) 336 return null; 337 org.hl7.fhir.r5.model.Consent.ProvisionActorComponent tgt = new org.hl7.fhir.r5.model.Consent.ProvisionActorComponent(); 338 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt); 339 if (src.hasRole()) 340 tgt.setRole(CodeableConcept40_50.convertCodeableConcept(src.getRole())); 341 if (src.hasReference()) 342 tgt.setReference(Reference40_50.convertReference(src.getReference())); 343 return tgt; 344 } 345 346 public static org.hl7.fhir.r4.model.Consent.provisionActorComponent convertprovisionActorComponent(org.hl7.fhir.r5.model.Consent.ProvisionActorComponent src) throws FHIRException { 347 if (src == null) 348 return null; 349 org.hl7.fhir.r4.model.Consent.provisionActorComponent tgt = new org.hl7.fhir.r4.model.Consent.provisionActorComponent(); 350 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt); 351 if (src.hasRole()) 352 tgt.setRole(CodeableConcept40_50.convertCodeableConcept(src.getRole())); 353 if (src.hasReference()) 354 tgt.setReference(Reference40_50.convertReference(src.getReference())); 355 return tgt; 356 } 357 358 public static org.hl7.fhir.r5.model.Consent.ProvisionDataComponent convertprovisionDataComponent(org.hl7.fhir.r4.model.Consent.provisionDataComponent src) throws FHIRException { 359 if (src == null) 360 return null; 361 org.hl7.fhir.r5.model.Consent.ProvisionDataComponent tgt = new org.hl7.fhir.r5.model.Consent.ProvisionDataComponent(); 362 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt); 363 if (src.hasMeaning()) 364 tgt.setMeaningElement(convertConsentDataMeaning(src.getMeaningElement())); 365 if (src.hasReference()) 366 tgt.setReference(Reference40_50.convertReference(src.getReference())); 367 return tgt; 368 } 369 370 public static org.hl7.fhir.r4.model.Consent.provisionDataComponent convertprovisionDataComponent(org.hl7.fhir.r5.model.Consent.ProvisionDataComponent src) throws FHIRException { 371 if (src == null) 372 return null; 373 org.hl7.fhir.r4.model.Consent.provisionDataComponent tgt = new org.hl7.fhir.r4.model.Consent.provisionDataComponent(); 374 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt); 375 if (src.hasMeaning()) 376 tgt.setMeaningElement(convertConsentDataMeaning(src.getMeaningElement())); 377 if (src.hasReference()) 378 tgt.setReference(Reference40_50.convertReference(src.getReference())); 379 return tgt; 380 } 381 382 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ConsentDataMeaning> convertConsentDataMeaning(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Consent.ConsentDataMeaning> src) throws FHIRException { 383 if (src == null || src.isEmpty()) 384 return null; 385 Enumeration<Enumerations.ConsentDataMeaning> tgt = new Enumeration<>(new Enumerations.ConsentDataMeaningEnumFactory()); 386 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 387 if (src.getValue() == null) { 388 tgt.setValue(null); 389 } else { 390 switch (src.getValue()) { 391 case INSTANCE: 392 tgt.setValue(Enumerations.ConsentDataMeaning.INSTANCE); 393 break; 394 case RELATED: 395 tgt.setValue(Enumerations.ConsentDataMeaning.RELATED); 396 break; 397 case DEPENDENTS: 398 tgt.setValue(Enumerations.ConsentDataMeaning.DEPENDENTS); 399 break; 400 case AUTHOREDBY: 401 tgt.setValue(Enumerations.ConsentDataMeaning.AUTHOREDBY); 402 break; 403 default: 404 tgt.setValue(Enumerations.ConsentDataMeaning.NULL); 405 break; 406 } 407 } 408 return tgt; 409 } 410 411 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Consent.ConsentDataMeaning> convertConsentDataMeaning(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ConsentDataMeaning> src) throws FHIRException { 412 if (src == null || src.isEmpty()) 413 return null; 414 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Consent.ConsentDataMeaning> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Consent.ConsentDataMeaningEnumFactory()); 415 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 416 if (src.getValue() == null) { 417 tgt.setValue(null); 418 } else { 419 switch (src.getValue()) { 420 case INSTANCE: 421 tgt.setValue(org.hl7.fhir.r4.model.Consent.ConsentDataMeaning.INSTANCE); 422 break; 423 case RELATED: 424 tgt.setValue(org.hl7.fhir.r4.model.Consent.ConsentDataMeaning.RELATED); 425 break; 426 case DEPENDENTS: 427 tgt.setValue(org.hl7.fhir.r4.model.Consent.ConsentDataMeaning.DEPENDENTS); 428 break; 429 case AUTHOREDBY: 430 tgt.setValue(org.hl7.fhir.r4.model.Consent.ConsentDataMeaning.AUTHOREDBY); 431 break; 432 default: 433 tgt.setValue(org.hl7.fhir.r4.model.Consent.ConsentDataMeaning.NULL); 434 break; 435 } 436 } 437 return tgt; 438 } 439}