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.Attachment30_50;
006import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Identifier30_50;
007import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Boolean30_50;
008import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.String30_50;
009import org.hl7.fhir.exceptions.FHIRException;
010
011public class BodySite30_50 {
012
013  public static org.hl7.fhir.r5.model.BodyStructure convertBodySite(org.hl7.fhir.dstu3.model.BodySite src) throws FHIRException {
014    if (src == null)
015      return null;
016    org.hl7.fhir.r5.model.BodyStructure tgt = new org.hl7.fhir.r5.model.BodyStructure();
017    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
018    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
019      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
020    if (src.hasActive())
021      tgt.setActiveElement(Boolean30_50.convertBoolean(src.getActiveElement()));
022    if (src.hasDescription())
023      tgt.setDescriptionElement(String30_50.convertStringToMarkdown(src.getDescriptionElement()));
024    for (org.hl7.fhir.dstu3.model.Attachment t : src.getImage()) tgt.addImage(Attachment30_50.convertAttachment(t));
025    if (src.hasPatient())
026      tgt.setPatient(Reference30_50.convertReference(src.getPatient()));
027    return tgt;
028  }
029
030  public static org.hl7.fhir.dstu3.model.BodySite convertBodySite(org.hl7.fhir.r5.model.BodyStructure src) throws FHIRException {
031    if (src == null)
032      return null;
033    org.hl7.fhir.dstu3.model.BodySite tgt = new org.hl7.fhir.dstu3.model.BodySite();
034    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
035    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
036      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
037    if (src.hasActive())
038      tgt.setActiveElement(Boolean30_50.convertBoolean(src.getActiveElement()));
039    if (src.hasDescription())
040      tgt.setDescriptionElement(String30_50.convertString(src.getDescriptionElement()));
041    for (org.hl7.fhir.r5.model.Attachment t : src.getImage()) tgt.addImage(Attachment30_50.convertAttachment(t));
042    if (src.hasPatient())
043      tgt.setPatient(Reference30_50.convertReference(src.getPatient()));
044    return tgt;
045  }
046}