001package org.hl7.fhir.convertors.conv10_30.datatypes10_30.complextypes10_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.convertors.conv10_30.datatypes10_30.primitivetypes10_30.DateTime10_30; 007import org.hl7.fhir.convertors.conv10_30.datatypes10_30.primitivetypes10_30.String10_30; 008import org.hl7.fhir.convertors.conv10_30.datatypes10_30.primitivetypes10_30.UnsignedInt10_30; 009import org.hl7.fhir.convertors.conv10_30.datatypes10_30.primitivetypes10_30.Uri10_30; 010import org.hl7.fhir.exceptions.FHIRException; 011 012public class Attachment10_30 { 013 public static org.hl7.fhir.dstu3.model.Attachment convertAttachment(org.hl7.fhir.dstu2.model.Attachment src) throws FHIRException { 014 if (src == null || src.isEmpty()) return null; 015 org.hl7.fhir.dstu3.model.Attachment tgt = new org.hl7.fhir.dstu3.model.Attachment(); 016 ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyElement(src, tgt); 017 if (src.hasContentTypeElement()) tgt.setContentTypeElement(Code10_30.convertCode(src.getContentTypeElement())); 018 if (src.hasLanguageElement()) tgt.setLanguageElement(Code10_30.convertCode(src.getLanguageElement())); 019 if (src.hasDataElement()) tgt.setDataElement(Base64Binary10_30.convertBase64Binary(src.getDataElement())); 020 if (src.hasUrlElement()) tgt.setUrlElement(Uri10_30.convertUri(src.getUrlElement())); 021 if (src.hasSizeElement()) tgt.setSizeElement(UnsignedInt10_30.convertUnsignedInt(src.getSizeElement())); 022 if (src.hasHashElement()) tgt.setHashElement(Base64Binary10_30.convertBase64Binary(src.getHashElement())); 023 if (src.hasTitleElement()) tgt.setTitleElement(String10_30.convertString(src.getTitleElement())); 024 if (src.hasCreationElement()) tgt.setCreationElement(DateTime10_30.convertDateTime(src.getCreationElement())); 025 return tgt; 026 } 027 028 public static org.hl7.fhir.dstu2.model.Attachment convertAttachment(org.hl7.fhir.dstu3.model.Attachment src) throws FHIRException { 029 if (src == null || src.isEmpty()) return null; 030 org.hl7.fhir.dstu2.model.Attachment tgt = new org.hl7.fhir.dstu2.model.Attachment(); 031 ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyElement(src, tgt); 032 if (src.hasContentTypeElement()) tgt.setContentTypeElement(Code10_30.convertCode(src.getContentTypeElement())); 033 if (src.hasLanguageElement()) tgt.setLanguageElement(Code10_30.convertCode(src.getLanguageElement())); 034 if (src.hasDataElement()) tgt.setDataElement(Base64Binary10_30.convertBase64Binary(src.getDataElement())); 035 if (src.hasUrlElement()) tgt.setUrlElement(Uri10_30.convertUri(src.getUrlElement())); 036 if (src.hasSizeElement()) tgt.setSizeElement(UnsignedInt10_30.convertUnsignedInt(src.getSizeElement())); 037 if (src.hasHashElement()) tgt.setHashElement(Base64Binary10_30.convertBase64Binary(src.getHashElement())); 038 if (src.hasTitleElement()) tgt.setTitleElement(String10_30.convertString(src.getTitleElement())); 039 if (src.hasCreationElement()) tgt.setCreationElement(DateTime10_30.convertDateTime(src.getCreationElement())); 040 return tgt; 041 } 042}