001package org.hl7.fhir.convertors.conv10_40.resources10_40; 002 003import org.hl7.fhir.convertors.context.ConversionContext10_40; 004import org.hl7.fhir.convertors.conv10_40.datatypes10_40.Reference10_40; 005import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.CodeableConcept10_40; 006import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.Identifier10_40; 007import org.hl7.fhir.convertors.conv10_40.datatypes10_40.primitivetypes10_40.Date10_40; 008import org.hl7.fhir.exceptions.FHIRException; 009 010public class Basic10_40 { 011 012 public static org.hl7.fhir.r4.model.Basic convertBasic(org.hl7.fhir.dstu2.model.Basic src) throws FHIRException { 013 if (src == null || src.isEmpty()) 014 return null; 015 org.hl7.fhir.r4.model.Basic tgt = new org.hl7.fhir.r4.model.Basic(); 016 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyDomainResource(src, tgt); 017 for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) 018 tgt.addIdentifier(Identifier10_40.convertIdentifier(t)); 019 if (src.hasCode()) 020 tgt.setCode(CodeableConcept10_40.convertCodeableConcept(src.getCode())); 021 if (src.hasSubject()) 022 tgt.setSubject(Reference10_40.convertReference(src.getSubject())); 023 if (src.hasCreatedElement()) 024 tgt.setCreatedElement(Date10_40.convertDate(src.getCreatedElement())); 025 if (src.hasAuthor()) 026 tgt.setAuthor(Reference10_40.convertReference(src.getAuthor())); 027 return tgt; 028 } 029 030 public static org.hl7.fhir.dstu2.model.Basic convertBasic(org.hl7.fhir.r4.model.Basic src) throws FHIRException { 031 if (src == null || src.isEmpty()) 032 return null; 033 org.hl7.fhir.dstu2.model.Basic tgt = new org.hl7.fhir.dstu2.model.Basic(); 034 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyDomainResource(src, tgt); 035 for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) 036 tgt.addIdentifier(Identifier10_40.convertIdentifier(t)); 037 if (src.hasCode()) 038 tgt.setCode(CodeableConcept10_40.convertCodeableConcept(src.getCode())); 039 if (src.hasSubject()) 040 tgt.setSubject(Reference10_40.convertReference(src.getSubject())); 041 if (src.hasCreatedElement()) 042 tgt.setCreatedElement(Date10_40.convertDate(src.getCreatedElement())); 043 if (src.hasAuthor()) 044 tgt.setAuthor(Reference10_40.convertReference(src.getAuthor())); 045 return tgt; 046 } 047}