
001package org.hl7.fhir.convertors.conv40_50; 002 003 004import org.hl7.fhir.convertors.VersionConvertor_40_50; 005import org.hl7.fhir.exceptions.FHIRException; 006 007/* 008 Copyright (c) 2011+, HL7, Inc. 009 All rights reserved. 010 011 Redistribution and use in source and binary forms, with or without modification, 012 are permitted provided that the following conditions are met: 013 014 * Redistributions of source code must retain the above copyright notice, this 015 list of conditions and the following disclaimer. 016 * Redistributions in binary form must reproduce the above copyright notice, 017 this list of conditions and the following disclaimer in the documentation 018 and/or other materials provided with the distribution. 019 * Neither the name of HL7 nor the names of its contributors may be used to 020 endorse or promote products derived from this software without specific 021 prior written permission. 022 023 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 024 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 025 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 026 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 027 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 028 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 029 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 030 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 031 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 032 POSSIBILITY OF SUCH DAMAGE. 033 034*/ 035// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 036public class InsurancePlan40_50 extends VersionConvertor_40_50 { 037 038 public static org.hl7.fhir.r5.model.InsurancePlan convertInsurancePlan(org.hl7.fhir.r4.model.InsurancePlan src) throws FHIRException { 039 if (src == null) 040 return null; 041 org.hl7.fhir.r5.model.InsurancePlan tgt = new org.hl7.fhir.r5.model.InsurancePlan(); 042 copyDomainResource(src, tgt); 043 for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t)); 044 if (src.hasStatus()) 045 tgt.setStatusElement(Enumerations40_50.convertPublicationStatus(src.getStatusElement())); 046 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) tgt.addType(convertCodeableConcept(t)); 047 if (src.hasName()) 048 tgt.setNameElement(convertString(src.getNameElement())); 049 for (org.hl7.fhir.r4.model.StringType t : src.getAlias()) tgt.getAlias().add(convertString(t)); 050 if (src.hasPeriod()) 051 tgt.setPeriod(convertPeriod(src.getPeriod())); 052 if (src.hasOwnedBy()) 053 tgt.setOwnedBy(convertReference(src.getOwnedBy())); 054 if (src.hasAdministeredBy()) 055 tgt.setAdministeredBy(convertReference(src.getAdministeredBy())); 056 for (org.hl7.fhir.r4.model.Reference t : src.getCoverageArea()) tgt.addCoverageArea(convertReference(t)); 057 for (org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanContactComponent t : src.getContact()) tgt.addContact(convertInsurancePlanContactComponent(t)); 058 for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) tgt.addEndpoint(convertReference(t)); 059 for (org.hl7.fhir.r4.model.Reference t : src.getNetwork()) tgt.addNetwork(convertReference(t)); 060 for (org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanCoverageComponent t : src.getCoverage()) tgt.addCoverage(convertInsurancePlanCoverageComponent(t)); 061 for (org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanComponent t : src.getPlan()) tgt.addPlan(convertInsurancePlanPlanComponent(t)); 062 return tgt; 063 } 064 065 public static org.hl7.fhir.r4.model.InsurancePlan convertInsurancePlan(org.hl7.fhir.r5.model.InsurancePlan src) throws FHIRException { 066 if (src == null) 067 return null; 068 org.hl7.fhir.r4.model.InsurancePlan tgt = new org.hl7.fhir.r4.model.InsurancePlan(); 069 copyDomainResource(src, tgt); 070 for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t)); 071 if (src.hasStatus()) 072 tgt.setStatusElement(Enumerations40_50.convertPublicationStatus(src.getStatusElement())); 073 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) tgt.addType(convertCodeableConcept(t)); 074 if (src.hasName()) 075 tgt.setNameElement(convertString(src.getNameElement())); 076 for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) tgt.getAlias().add(convertString(t)); 077 if (src.hasPeriod()) 078 tgt.setPeriod(convertPeriod(src.getPeriod())); 079 if (src.hasOwnedBy()) 080 tgt.setOwnedBy(convertReference(src.getOwnedBy())); 081 if (src.hasAdministeredBy()) 082 tgt.setAdministeredBy(convertReference(src.getAdministeredBy())); 083 for (org.hl7.fhir.r5.model.Reference t : src.getCoverageArea()) tgt.addCoverageArea(convertReference(t)); 084 for (org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanContactComponent t : src.getContact()) tgt.addContact(convertInsurancePlanContactComponent(t)); 085 for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) tgt.addEndpoint(convertReference(t)); 086 for (org.hl7.fhir.r5.model.Reference t : src.getNetwork()) tgt.addNetwork(convertReference(t)); 087 for (org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanCoverageComponent t : src.getCoverage()) tgt.addCoverage(convertInsurancePlanCoverageComponent(t)); 088 for (org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanComponent t : src.getPlan()) tgt.addPlan(convertInsurancePlanPlanComponent(t)); 089 return tgt; 090 } 091 092 public static org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanContactComponent convertInsurancePlanContactComponent(org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanContactComponent src) throws FHIRException { 093 if (src == null) 094 return null; 095 org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanContactComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanContactComponent(); 096 copyElement(src, tgt); 097 if (src.hasPurpose()) 098 tgt.setPurpose(convertCodeableConcept(src.getPurpose())); 099 if (src.hasName()) 100 tgt.setName(convertHumanName(src.getName())); 101 for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(convertContactPoint(t)); 102 if (src.hasAddress()) 103 tgt.setAddress(convertAddress(src.getAddress())); 104 return tgt; 105 } 106 107 public static org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanContactComponent convertInsurancePlanContactComponent(org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanContactComponent src) throws FHIRException { 108 if (src == null) 109 return null; 110 org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanContactComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanContactComponent(); 111 copyElement(src, tgt); 112 if (src.hasPurpose()) 113 tgt.setPurpose(convertCodeableConcept(src.getPurpose())); 114 if (src.hasName()) 115 tgt.setName(convertHumanName(src.getName())); 116 for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(convertContactPoint(t)); 117 if (src.hasAddress()) 118 tgt.setAddress(convertAddress(src.getAddress())); 119 return tgt; 120 } 121 122 public static org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanCoverageComponent convertInsurancePlanCoverageComponent(org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanCoverageComponent src) throws FHIRException { 123 if (src == null) 124 return null; 125 org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanCoverageComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanCoverageComponent(); 126 copyElement(src, tgt); 127 if (src.hasType()) 128 tgt.setType(convertCodeableConcept(src.getType())); 129 for (org.hl7.fhir.r4.model.Reference t : src.getNetwork()) tgt.addNetwork(convertReference(t)); 130 for (org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitComponent t : src.getBenefit()) tgt.addBenefit(convertCoverageBenefitComponent(t)); 131 return tgt; 132 } 133 134 public static org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanCoverageComponent convertInsurancePlanCoverageComponent(org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanCoverageComponent src) throws FHIRException { 135 if (src == null) 136 return null; 137 org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanCoverageComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanCoverageComponent(); 138 copyElement(src, tgt); 139 if (src.hasType()) 140 tgt.setType(convertCodeableConcept(src.getType())); 141 for (org.hl7.fhir.r5.model.Reference t : src.getNetwork()) tgt.addNetwork(convertReference(t)); 142 for (org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitComponent t : src.getBenefit()) tgt.addBenefit(convertCoverageBenefitComponent(t)); 143 return tgt; 144 } 145 146 public static org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitComponent convertCoverageBenefitComponent(org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitComponent src) throws FHIRException { 147 if (src == null) 148 return null; 149 org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitComponent(); 150 copyElement(src, tgt); 151 if (src.hasType()) 152 tgt.setType(convertCodeableConcept(src.getType())); 153 if (src.hasRequirement()) 154 tgt.setRequirementElement(convertString(src.getRequirementElement())); 155 for (org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitLimitComponent t : src.getLimit()) tgt.addLimit(convertCoverageBenefitLimitComponent(t)); 156 return tgt; 157 } 158 159 public static org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitComponent convertCoverageBenefitComponent(org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitComponent src) throws FHIRException { 160 if (src == null) 161 return null; 162 org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitComponent(); 163 copyElement(src, tgt); 164 if (src.hasType()) 165 tgt.setType(convertCodeableConcept(src.getType())); 166 if (src.hasRequirement()) 167 tgt.setRequirementElement(convertString(src.getRequirementElement())); 168 for (org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitLimitComponent t : src.getLimit()) tgt.addLimit(convertCoverageBenefitLimitComponent(t)); 169 return tgt; 170 } 171 172 public static org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitLimitComponent convertCoverageBenefitLimitComponent(org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitLimitComponent src) throws FHIRException { 173 if (src == null) 174 return null; 175 org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitLimitComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitLimitComponent(); 176 copyElement(src, tgt); 177 if (src.hasValue()) 178 tgt.setValue(convertQuantity(src.getValue())); 179 if (src.hasCode()) 180 tgt.setCode(convertCodeableConcept(src.getCode())); 181 return tgt; 182 } 183 184 public static org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitLimitComponent convertCoverageBenefitLimitComponent(org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitLimitComponent src) throws FHIRException { 185 if (src == null) 186 return null; 187 org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitLimitComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitLimitComponent(); 188 copyElement(src, tgt); 189 if (src.hasValue()) 190 tgt.setValue(convertQuantity(src.getValue())); 191 if (src.hasCode()) 192 tgt.setCode(convertCodeableConcept(src.getCode())); 193 return tgt; 194 } 195 196 public static org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanComponent convertInsurancePlanPlanComponent(org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanComponent src) throws FHIRException { 197 if (src == null) 198 return null; 199 org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanComponent(); 200 copyElement(src, tgt); 201 for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t)); 202 if (src.hasType()) 203 tgt.setType(convertCodeableConcept(src.getType())); 204 for (org.hl7.fhir.r4.model.Reference t : src.getCoverageArea()) tgt.addCoverageArea(convertReference(t)); 205 for (org.hl7.fhir.r4.model.Reference t : src.getNetwork()) tgt.addNetwork(convertReference(t)); 206 for (org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent t : src.getGeneralCost()) tgt.addGeneralCost(convertInsurancePlanPlanGeneralCostComponent(t)); 207 for (org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent t : src.getSpecificCost()) tgt.addSpecificCost(convertInsurancePlanPlanSpecificCostComponent(t)); 208 return tgt; 209 } 210 211 public static org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanComponent convertInsurancePlanPlanComponent(org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanComponent src) throws FHIRException { 212 if (src == null) 213 return null; 214 org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanComponent(); 215 copyElement(src, tgt); 216 for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t)); 217 if (src.hasType()) 218 tgt.setType(convertCodeableConcept(src.getType())); 219 for (org.hl7.fhir.r5.model.Reference t : src.getCoverageArea()) tgt.addCoverageArea(convertReference(t)); 220 for (org.hl7.fhir.r5.model.Reference t : src.getNetwork()) tgt.addNetwork(convertReference(t)); 221 for (org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent t : src.getGeneralCost()) tgt.addGeneralCost(convertInsurancePlanPlanGeneralCostComponent(t)); 222 for (org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent t : src.getSpecificCost()) tgt.addSpecificCost(convertInsurancePlanPlanSpecificCostComponent(t)); 223 return tgt; 224 } 225 226 public static org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent convertInsurancePlanPlanGeneralCostComponent(org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent src) throws FHIRException { 227 if (src == null) 228 return null; 229 org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent(); 230 copyElement(src, tgt); 231 if (src.hasType()) 232 tgt.setType(convertCodeableConcept(src.getType())); 233 if (src.hasGroupSize()) 234 tgt.setGroupSizeElement(convertPositiveInt(src.getGroupSizeElement())); 235 if (src.hasCost()) 236 tgt.setCost(convertMoney(src.getCost())); 237 if (src.hasComment()) 238 tgt.setCommentElement(convertString(src.getCommentElement())); 239 return tgt; 240 } 241 242 public static org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent convertInsurancePlanPlanGeneralCostComponent(org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent src) throws FHIRException { 243 if (src == null) 244 return null; 245 org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent(); 246 copyElement(src, tgt); 247 if (src.hasType()) 248 tgt.setType(convertCodeableConcept(src.getType())); 249 if (src.hasGroupSize()) 250 tgt.setGroupSizeElement(convertPositiveInt(src.getGroupSizeElement())); 251 if (src.hasCost()) 252 tgt.setCost(convertMoney(src.getCost())); 253 if (src.hasComment()) 254 tgt.setCommentElement(convertString(src.getCommentElement())); 255 return tgt; 256 } 257 258 public static org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent convertInsurancePlanPlanSpecificCostComponent(org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent src) throws FHIRException { 259 if (src == null) 260 return null; 261 org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent(); 262 copyElement(src, tgt); 263 if (src.hasCategory()) 264 tgt.setCategory(convertCodeableConcept(src.getCategory())); 265 for (org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitComponent t : src.getBenefit()) tgt.addBenefit(convertPlanBenefitComponent(t)); 266 return tgt; 267 } 268 269 public static org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent convertInsurancePlanPlanSpecificCostComponent(org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent src) throws FHIRException { 270 if (src == null) 271 return null; 272 org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent(); 273 copyElement(src, tgt); 274 if (src.hasCategory()) 275 tgt.setCategory(convertCodeableConcept(src.getCategory())); 276 for (org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitComponent t : src.getBenefit()) tgt.addBenefit(convertPlanBenefitComponent(t)); 277 return tgt; 278 } 279 280 public static org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitComponent convertPlanBenefitComponent(org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitComponent src) throws FHIRException { 281 if (src == null) 282 return null; 283 org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitComponent(); 284 copyElement(src, tgt); 285 if (src.hasType()) 286 tgt.setType(convertCodeableConcept(src.getType())); 287 for (org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitCostComponent t : src.getCost()) tgt.addCost(convertPlanBenefitCostComponent(t)); 288 return tgt; 289 } 290 291 public static org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitComponent convertPlanBenefitComponent(org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitComponent src) throws FHIRException { 292 if (src == null) 293 return null; 294 org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitComponent(); 295 copyElement(src, tgt); 296 if (src.hasType()) 297 tgt.setType(convertCodeableConcept(src.getType())); 298 for (org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitCostComponent t : src.getCost()) tgt.addCost(convertPlanBenefitCostComponent(t)); 299 return tgt; 300 } 301 302 public static org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitCostComponent convertPlanBenefitCostComponent(org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitCostComponent src) throws FHIRException { 303 if (src == null) 304 return null; 305 org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitCostComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitCostComponent(); 306 copyElement(src, tgt); 307 if (src.hasType()) 308 tgt.setType(convertCodeableConcept(src.getType())); 309 if (src.hasApplicability()) 310 tgt.setApplicability(convertCodeableConcept(src.getApplicability())); 311 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getQualifiers()) tgt.addQualifiers(convertCodeableConcept(t)); 312 if (src.hasValue()) 313 tgt.setValue(convertQuantity(src.getValue())); 314 return tgt; 315 } 316 317 public static org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitCostComponent convertPlanBenefitCostComponent(org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitCostComponent src) throws FHIRException { 318 if (src == null) 319 return null; 320 org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitCostComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitCostComponent(); 321 copyElement(src, tgt); 322 if (src.hasType()) 323 tgt.setType(convertCodeableConcept(src.getType())); 324 if (src.hasApplicability()) 325 tgt.setApplicability(convertCodeableConcept(src.getApplicability())); 326 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getQualifiers()) tgt.addQualifiers(convertCodeableConcept(t)); 327 if (src.hasValue()) 328 tgt.setValue(convertQuantity(src.getValue())); 329 return tgt; 330 } 331}