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