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.*; 005import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Boolean40_50; 006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50; 007import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Reference40_50; 008import org.hl7.fhir.exceptions.FHIRException; 009 010/* 011 Copyright (c) 2011+, HL7, Inc. 012 All rights reserved. 013 014 Redistribution and use in source and binary forms, with or without modification, 015 are permitted provided that the following conditions are met: 016 017 * Redistributions of source code must retain the above copyright notice, this 018 list of conditions and the following disclaimer. 019 * Redistributions in binary form must reproduce the above copyright notice, 020 this list of conditions and the following disclaimer in the documentation 021 and/or other materials provided with the distribution. 022 * Neither the name of HL7 nor the names of its contributors may be used to 023 endorse or promote products derived from this software without specific 024 prior written permission. 025 026 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 027 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 028 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 029 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 030 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 031 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 032 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 033 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 034 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 035 POSSIBILITY OF SUCH DAMAGE. 036 037*/ 038// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 039public class Organization40_50 { 040 041 public static org.hl7.fhir.r5.model.Organization convertOrganization(org.hl7.fhir.r4.model.Organization src) throws FHIRException { 042 if (src == null) 043 return null; 044 org.hl7.fhir.r5.model.Organization tgt = new org.hl7.fhir.r5.model.Organization(); 045 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt); 046 for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) 047 tgt.addIdentifier(Identifier40_50.convertIdentifier(t)); 048 if (src.hasActive()) 049 tgt.setActiveElement(Boolean40_50.convertBoolean(src.getActiveElement())); 050 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) 051 tgt.addType(CodeableConcept40_50.convertCodeableConcept(t)); 052 if (src.hasName()) 053 tgt.setNameElement(String40_50.convertString(src.getNameElement())); 054 for (org.hl7.fhir.r4.model.StringType t : src.getAlias()) tgt.getAlias().add(String40_50.convertString(t)); 055 for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) 056 tgt.addTelecom(ContactPoint40_50.convertContactPoint(t)); 057 for (org.hl7.fhir.r4.model.Address t : src.getAddress()) tgt.addAddress(Address40_50.convertAddress(t)); 058 if (src.hasPartOf()) 059 tgt.setPartOf(Reference40_50.convertReference(src.getPartOf())); 060 for (org.hl7.fhir.r4.model.Organization.OrganizationContactComponent t : src.getContact()) 061 tgt.addContact(convertOrganizationContactComponent(t)); 062 for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) tgt.addEndpoint(Reference40_50.convertReference(t)); 063 return tgt; 064 } 065 066 public static org.hl7.fhir.r4.model.Organization convertOrganization(org.hl7.fhir.r5.model.Organization src) throws FHIRException { 067 if (src == null) 068 return null; 069 org.hl7.fhir.r4.model.Organization tgt = new org.hl7.fhir.r4.model.Organization(); 070 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt); 071 for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) 072 tgt.addIdentifier(Identifier40_50.convertIdentifier(t)); 073 if (src.hasActive()) 074 tgt.setActiveElement(Boolean40_50.convertBoolean(src.getActiveElement())); 075 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) 076 tgt.addType(CodeableConcept40_50.convertCodeableConcept(t)); 077 if (src.hasName()) 078 tgt.setNameElement(String40_50.convertString(src.getNameElement())); 079 for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) tgt.getAlias().add(String40_50.convertString(t)); 080 for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) 081 tgt.addTelecom(ContactPoint40_50.convertContactPoint(t)); 082 for (org.hl7.fhir.r5.model.Address t : src.getAddress()) tgt.addAddress(Address40_50.convertAddress(t)); 083 if (src.hasPartOf()) 084 tgt.setPartOf(Reference40_50.convertReference(src.getPartOf())); 085 for (org.hl7.fhir.r5.model.Organization.OrganizationContactComponent t : src.getContact()) 086 tgt.addContact(convertOrganizationContactComponent(t)); 087 for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) tgt.addEndpoint(Reference40_50.convertReference(t)); 088 return tgt; 089 } 090 091 public static org.hl7.fhir.r5.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.r4.model.Organization.OrganizationContactComponent src) throws FHIRException { 092 if (src == null) 093 return null; 094 org.hl7.fhir.r5.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.r5.model.Organization.OrganizationContactComponent(); 095 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 096 if (src.hasPurpose()) 097 tgt.setPurpose(CodeableConcept40_50.convertCodeableConcept(src.getPurpose())); 098 if (src.hasName()) 099 tgt.setName(HumanName40_50.convertHumanName(src.getName())); 100 for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) 101 tgt.addTelecom(ContactPoint40_50.convertContactPoint(t)); 102 if (src.hasAddress()) 103 tgt.setAddress(Address40_50.convertAddress(src.getAddress())); 104 return tgt; 105 } 106 107 public static org.hl7.fhir.r4.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.r5.model.Organization.OrganizationContactComponent src) throws FHIRException { 108 if (src == null) 109 return null; 110 org.hl7.fhir.r4.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.r4.model.Organization.OrganizationContactComponent(); 111 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 112 if (src.hasPurpose()) 113 tgt.setPurpose(CodeableConcept40_50.convertCodeableConcept(src.getPurpose())); 114 if (src.hasName()) 115 tgt.setName(HumanName40_50.convertHumanName(src.getName())); 116 for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) 117 tgt.addTelecom(ContactPoint40_50.convertContactPoint(t)); 118 if (src.hasAddress()) 119 tgt.setAddress(Address40_50.convertAddress(src.getAddress())); 120 return tgt; 121 } 122}