001package org.hl7.fhir.convertors.conv10_30.resources10_30;
002
003import org.hl7.fhir.convertors.context.ConversionContext10_30;
004import org.hl7.fhir.convertors.conv10_30.datatypes10_30.primitivetypes10_30.Base64Binary10_30;
005import org.hl7.fhir.convertors.conv10_30.datatypes10_30.primitivetypes10_30.Code10_30;
006import org.hl7.fhir.exceptions.FHIRException;
007
008public class Binary10_30 {
009
010  public static org.hl7.fhir.dstu2.model.Binary convertBinary(org.hl7.fhir.dstu3.model.Binary src) throws FHIRException {
011    if (src == null || src.isEmpty())
012      return null;
013    org.hl7.fhir.dstu2.model.Binary tgt = new org.hl7.fhir.dstu2.model.Binary();
014    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyResource(src, tgt);
015    if (src.hasContentTypeElement())
016      tgt.setContentTypeElement(Code10_30.convertCode(src.getContentTypeElement()));
017    if (src.hasContentElement())
018      tgt.setContentElement(Base64Binary10_30.convertBase64Binary(src.getContentElement()));
019    return tgt;
020  }
021
022  public static org.hl7.fhir.dstu3.model.Binary convertBinary(org.hl7.fhir.dstu2.model.Binary src) throws FHIRException {
023    if (src == null || src.isEmpty())
024      return null;
025    org.hl7.fhir.dstu3.model.Binary tgt = new org.hl7.fhir.dstu3.model.Binary();
026    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyResource(src, tgt);
027    if (src.hasContentTypeElement())
028      tgt.setContentTypeElement(Code10_30.convertCode(src.getContentTypeElement()));
029    if (src.hasContentElement())
030      tgt.setContentElement(Base64Binary10_30.convertBase64Binary(src.getContentElement()));
031    return tgt;
032  }
033}