![](/hapi-fhir/images/logos/raccoon-forwards.png)
001package org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50; 002 003import org.hl7.fhir.convertors.context.ConversionContext43_50; 004import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Base64Binary43_50; 005import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Code43_50; 006import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.DateTime43_50; 007import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50; 008import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.UnsignedInt43_50; 009import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Url43_50; 010import org.hl7.fhir.exceptions.FHIRException; 011 012public class Attachment43_50 { 013 public static org.hl7.fhir.r5.model.Attachment convertAttachment(org.hl7.fhir.r4b.model.Attachment src) throws FHIRException { 014 if (src == null) return null; 015 org.hl7.fhir.r5.model.Attachment tgt = new org.hl7.fhir.r5.model.Attachment(); 016 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 017 if (src.hasContentType()) tgt.setContentTypeElement(Code43_50.convertCode(src.getContentTypeElement())); 018 if (src.hasLanguage()) tgt.setLanguageElement(Code43_50.convertCode(src.getLanguageElement())); 019 if (src.hasData()) tgt.setDataElement(Base64Binary43_50.convertBase64Binary(src.getDataElement())); 020 if (src.hasUrl()) tgt.setUrlElement(Url43_50.convertUrl(src.getUrlElement())); 021 if (src.hasSize()) tgt.setSizeElement(UnsignedInt43_50.convertUnsignedIntToInteger64(src.getSizeElement())); 022 if (src.hasHash()) tgt.setHashElement(Base64Binary43_50.convertBase64Binary(src.getHashElement())); 023 if (src.hasTitle()) tgt.setTitleElement(String43_50.convertString(src.getTitleElement())); 024 if (src.hasCreation()) tgt.setCreationElement(DateTime43_50.convertDateTime(src.getCreationElement())); 025 return tgt; 026 } 027 028 public static org.hl7.fhir.r4b.model.Attachment convertAttachment(org.hl7.fhir.r5.model.Attachment src) throws FHIRException { 029 if (src == null) return null; 030 org.hl7.fhir.r4b.model.Attachment tgt = new org.hl7.fhir.r4b.model.Attachment(); 031 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 032 if (src.hasContentType()) tgt.setContentTypeElement(Code43_50.convertCode(src.getContentTypeElement())); 033 if (src.hasLanguage()) tgt.setLanguageElement(Code43_50.convertCode(src.getLanguageElement())); 034 if (src.hasData()) tgt.setDataElement(Base64Binary43_50.convertBase64Binary(src.getDataElement())); 035 if (src.hasUrl()) tgt.setUrlElement(Url43_50.convertUrl(src.getUrlElement())); 036 if (src.hasSize()) tgt.setSizeElement(UnsignedInt43_50.convertInteger64ToUnsignedInt(src.getSizeElement())); 037 if (src.hasHash()) tgt.setHashElement(Base64Binary43_50.convertBase64Binary(src.getHashElement())); 038 if (src.hasTitle()) tgt.setTitleElement(String43_50.convertString(src.getTitleElement())); 039 if (src.hasCreation()) tgt.setCreationElement(DateTime43_50.convertDateTime(src.getCreationElement())); 040 return tgt; 041 } 042}