001package org.hl7.fhir.convertors.conv14_30.resources14_30;
002
003import org.hl7.fhir.convertors.context.ConversionContext14_30;
004import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.Base64Binary14_30;
005import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.Code14_30;
006import org.hl7.fhir.exceptions.FHIRException;
007
008public class Binary14_30 {
009  public static org.hl7.fhir.dstu3.model.Binary convertBinary(org.hl7.fhir.dstu2016may.model.Binary src) throws FHIRException {
010    if (src == null || src.isEmpty()) return null;
011    org.hl7.fhir.dstu3.model.Binary tgt = new org.hl7.fhir.dstu3.model.Binary();
012    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyResource(src, tgt);
013    if (src.hasContentTypeElement()) tgt.setContentTypeElement(Code14_30.convertCode(src.getContentTypeElement()));
014    if (src.hasContentElement()) tgt.setContentElement(Base64Binary14_30.convertBase64Binary(src.getContentElement()));
015    return tgt;
016  }
017
018  public static org.hl7.fhir.dstu2016may.model.Binary convertBinary(org.hl7.fhir.dstu3.model.Binary src) throws FHIRException {
019    if (src == null || src.isEmpty()) return null;
020    org.hl7.fhir.dstu2016may.model.Binary tgt = new org.hl7.fhir.dstu2016may.model.Binary();
021    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyResource(src, tgt);
022    if (src.hasContentTypeElement()) tgt.setContentTypeElement(Code14_30.convertCode(src.getContentTypeElement()));
023    if (src.hasContentElement()) tgt.setContentElement(Base64Binary14_30.convertBase64Binary(src.getContentElement()));
024    return tgt;
025  }
026}