001package org.hl7.fhir.convertors.conv10_40.resources10_40; 002 003import org.hl7.fhir.convertors.context.ConversionContext10_40; 004import org.hl7.fhir.convertors.conv10_40.datatypes10_40.Reference10_40; 005import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.*; 006import org.hl7.fhir.convertors.conv10_40.datatypes10_40.primitivetypes10_40.Boolean10_40; 007import org.hl7.fhir.convertors.conv10_40.datatypes10_40.primitivetypes10_40.String10_40; 008import org.hl7.fhir.exceptions.FHIRException; 009 010public class Organization10_40 { 011 012 public static org.hl7.fhir.r4.model.Organization convertOrganization(org.hl7.fhir.dstu2.model.Organization src) throws FHIRException { 013 if (src == null || src.isEmpty()) 014 return null; 015 org.hl7.fhir.r4.model.Organization tgt = new org.hl7.fhir.r4.model.Organization(); 016 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyDomainResource(src, tgt); 017 for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) 018 tgt.addIdentifier(Identifier10_40.convertIdentifier(t)); 019 if (src.hasActiveElement()) 020 tgt.setActiveElement(Boolean10_40.convertBoolean(src.getActiveElement())); 021 if (src.hasType()) 022 tgt.addType(CodeableConcept10_40.convertCodeableConcept(src.getType())); 023 if (src.hasNameElement()) 024 tgt.setNameElement(String10_40.convertString(src.getNameElement())); 025 for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) 026 tgt.addTelecom(ContactPoint10_40.convertContactPoint(t)); 027 for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) tgt.addAddress(Address10_40.convertAddress(t)); 028 if (src.hasPartOf()) 029 tgt.setPartOf(Reference10_40.convertReference(src.getPartOf())); 030 for (org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent t : src.getContact()) 031 tgt.addContact(convertOrganizationContactComponent(t)); 032 return tgt; 033 } 034 035 public static org.hl7.fhir.dstu2.model.Organization convertOrganization(org.hl7.fhir.r4.model.Organization src) throws FHIRException { 036 if (src == null || src.isEmpty()) 037 return null; 038 org.hl7.fhir.dstu2.model.Organization tgt = new org.hl7.fhir.dstu2.model.Organization(); 039 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyDomainResource(src, tgt); 040 for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) 041 tgt.addIdentifier(Identifier10_40.convertIdentifier(t)); 042 if (src.hasActiveElement()) 043 tgt.setActiveElement(Boolean10_40.convertBoolean(src.getActiveElement())); 044 if (src.hasType()) 045 tgt.setType(CodeableConcept10_40.convertCodeableConcept(src.getTypeFirstRep())); 046 if (src.hasNameElement()) 047 tgt.setNameElement(String10_40.convertString(src.getNameElement())); 048 for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) 049 tgt.addTelecom(ContactPoint10_40.convertContactPoint(t)); 050 for (org.hl7.fhir.r4.model.Address t : src.getAddress()) tgt.addAddress(Address10_40.convertAddress(t)); 051 if (src.hasPartOf()) 052 tgt.setPartOf(Reference10_40.convertReference(src.getPartOf())); 053 for (org.hl7.fhir.r4.model.Organization.OrganizationContactComponent t : src.getContact()) 054 tgt.addContact(convertOrganizationContactComponent(t)); 055 return tgt; 056 } 057 058 public static org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.r4.model.Organization.OrganizationContactComponent src) throws FHIRException { 059 if (src == null || src.isEmpty()) 060 return null; 061 org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent(); 062 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 063 if (src.hasPurpose()) 064 tgt.setPurpose(CodeableConcept10_40.convertCodeableConcept(src.getPurpose())); 065 if (src.hasName()) 066 tgt.setName(HumanName10_40.convertHumanName(src.getName())); 067 for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) 068 tgt.addTelecom(ContactPoint10_40.convertContactPoint(t)); 069 if (src.hasAddress()) 070 tgt.setAddress(Address10_40.convertAddress(src.getAddress())); 071 return tgt; 072 } 073 074 public static org.hl7.fhir.r4.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent src) throws FHIRException { 075 if (src == null || src.isEmpty()) 076 return null; 077 org.hl7.fhir.r4.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.r4.model.Organization.OrganizationContactComponent(); 078 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 079 if (src.hasPurpose()) 080 tgt.setPurpose(CodeableConcept10_40.convertCodeableConcept(src.getPurpose())); 081 if (src.hasName()) 082 tgt.setName(HumanName10_40.convertHumanName(src.getName())); 083 for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) 084 tgt.addTelecom(ContactPoint10_40.convertContactPoint(t)); 085 if (src.hasAddress()) 086 tgt.setAddress(Address10_40.convertAddress(src.getAddress())); 087 return tgt; 088 } 089}