001package org.hl7.fhir.convertors.conv30_50.resources30_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext30_50;
004import org.hl7.fhir.convertors.conv30_50.datatypes30_50.Reference30_50;
005import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.*;
006import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Boolean30_50;
007import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.String30_50;
008import org.hl7.fhir.exceptions.FHIRException;
009
010public class Organization30_50 {
011
012  public static org.hl7.fhir.r5.model.Organization convertOrganization(org.hl7.fhir.dstu3.model.Organization src) throws FHIRException {
013    if (src == null)
014      return null;
015    org.hl7.fhir.r5.model.Organization tgt = new org.hl7.fhir.r5.model.Organization();
016    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
017    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
018      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
019    if (src.hasActive())
020      tgt.setActiveElement(Boolean30_50.convertBoolean(src.getActiveElement()));
021    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType())
022      tgt.addType(CodeableConcept30_50.convertCodeableConcept(t));
023    if (src.hasName())
024      tgt.setNameElement(String30_50.convertString(src.getNameElement()));
025    for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue());
026    for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom())
027      tgt.addTelecom(ContactPoint30_50.convertContactPoint(t));
028    for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) tgt.addAddress(Address30_50.convertAddress(t));
029    if (src.hasPartOf())
030      tgt.setPartOf(Reference30_50.convertReference(src.getPartOf()));
031    for (org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent t : src.getContact())
032      tgt.addContact(convertOrganizationContactComponent(t));
033    for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) tgt.addEndpoint(Reference30_50.convertReference(t));
034    return tgt;
035  }
036
037  public static org.hl7.fhir.dstu3.model.Organization convertOrganization(org.hl7.fhir.r5.model.Organization src) throws FHIRException {
038    if (src == null)
039      return null;
040    org.hl7.fhir.dstu3.model.Organization tgt = new org.hl7.fhir.dstu3.model.Organization();
041    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
042    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
043      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
044    if (src.hasActive())
045      tgt.setActiveElement(Boolean30_50.convertBoolean(src.getActiveElement()));
046    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType())
047      tgt.addType(CodeableConcept30_50.convertCodeableConcept(t));
048    if (src.hasName())
049      tgt.setNameElement(String30_50.convertString(src.getNameElement()));
050    for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue());
051    for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom())
052      tgt.addTelecom(ContactPoint30_50.convertContactPoint(t));
053    for (org.hl7.fhir.r5.model.Address t : src.getAddress()) tgt.addAddress(Address30_50.convertAddress(t));
054    if (src.hasPartOf())
055      tgt.setPartOf(Reference30_50.convertReference(src.getPartOf()));
056    for (org.hl7.fhir.r5.model.Organization.OrganizationContactComponent t : src.getContact())
057      tgt.addContact(convertOrganizationContactComponent(t));
058    for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) tgt.addEndpoint(Reference30_50.convertReference(t));
059    return tgt;
060  }
061
062  public static org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.r5.model.Organization.OrganizationContactComponent src) throws FHIRException {
063    if (src == null)
064      return null;
065    org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent();
066    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
067    if (src.hasPurpose())
068      tgt.setPurpose(CodeableConcept30_50.convertCodeableConcept(src.getPurpose()));
069    if (src.hasName())
070      tgt.setName(HumanName30_50.convertHumanName(src.getName()));
071    for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom())
072      tgt.addTelecom(ContactPoint30_50.convertContactPoint(t));
073    if (src.hasAddress())
074      tgt.setAddress(Address30_50.convertAddress(src.getAddress()));
075    return tgt;
076  }
077
078  public static org.hl7.fhir.r5.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent src) throws FHIRException {
079    if (src == null)
080      return null;
081    org.hl7.fhir.r5.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.r5.model.Organization.OrganizationContactComponent();
082    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
083    if (src.hasPurpose())
084      tgt.setPurpose(CodeableConcept30_50.convertCodeableConcept(src.getPurpose()));
085    if (src.hasName())
086      tgt.setName(HumanName30_50.convertHumanName(src.getName()));
087    for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom())
088      tgt.addTelecom(ContactPoint30_50.convertContactPoint(t));
089    if (src.hasAddress())
090      tgt.setAddress(Address30_50.convertAddress(src.getAddress()));
091    return tgt;
092  }
093}