001package org.hl7.fhir.convertors.conv30_40.resources30_40;
002
003import org.hl7.fhir.convertors.context.ConversionContext30_40;
004import org.hl7.fhir.convertors.conv30_40.datatypes30_40.Reference30_40;
005import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Base64Binary30_40;
006import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Code30_40;
007import org.hl7.fhir.exceptions.FHIRException;
008
009public class Binary30_40 {
010
011  public static org.hl7.fhir.dstu3.model.Binary convertBinary(org.hl7.fhir.r4.model.Binary src) throws FHIRException {
012    if (src == null)
013      return null;
014    org.hl7.fhir.dstu3.model.Binary tgt = new org.hl7.fhir.dstu3.model.Binary();
015    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyResource(src, tgt);
016    if (src.hasContentType())
017      tgt.setContentTypeElement(Code30_40.convertCode(src.getContentTypeElement()));
018    if (src.hasSecurityContext())
019      tgt.setSecurityContext(Reference30_40.convertReference(src.getSecurityContext()));
020    if (src.hasData())
021      tgt.setContentElement(Base64Binary30_40.convertBase64Binary(src.getDataElement()));
022    return tgt;
023  }
024
025  public static org.hl7.fhir.r4.model.Binary convertBinary(org.hl7.fhir.dstu3.model.Binary src) throws FHIRException {
026    if (src == null)
027      return null;
028    org.hl7.fhir.r4.model.Binary tgt = new org.hl7.fhir.r4.model.Binary();
029    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyResource(src, tgt);
030    if (src.hasContentType())
031      tgt.setContentTypeElement(Code30_40.convertCode(src.getContentTypeElement()));
032    if (src.hasSecurityContext())
033      tgt.setSecurityContext(Reference30_40.convertReference(src.getSecurityContext()));
034    if (src.hasContent())
035      tgt.setDataElement(Base64Binary30_40.convertBase64Binary(src.getContentElement()));
036    return tgt;
037  }
038}