001package org.hl7.fhir.convertors.conv30_50.resources30_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext30_50;
004import org.hl7.fhir.convertors.conv30_50.datatypes30_50.Reference30_50;
005import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.CodeableConcept30_50;
006import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Identifier30_50;
007import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Date30_50;
008import org.hl7.fhir.exceptions.FHIRException;
009
010public class Basic30_50 {
011
012  public static org.hl7.fhir.r5.model.Basic convertBasic(org.hl7.fhir.dstu3.model.Basic src) throws FHIRException {
013    if (src == null)
014      return null;
015    org.hl7.fhir.r5.model.Basic tgt = new org.hl7.fhir.r5.model.Basic();
016    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
017    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
018      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
019    if (src.hasCode())
020      tgt.setCode(CodeableConcept30_50.convertCodeableConcept(src.getCode()));
021    if (src.hasSubject())
022      tgt.setSubject(Reference30_50.convertReference(src.getSubject()));
023    if (src.hasCreated())
024      tgt.setCreatedElement(Date30_50.convertDate(src.getCreatedElement()));
025    if (src.hasAuthor())
026      tgt.setAuthor(Reference30_50.convertReference(src.getAuthor()));
027    return tgt;
028  }
029
030  public static org.hl7.fhir.dstu3.model.Basic convertBasic(org.hl7.fhir.r5.model.Basic src) throws FHIRException {
031    if (src == null)
032      return null;
033    org.hl7.fhir.dstu3.model.Basic tgt = new org.hl7.fhir.dstu3.model.Basic();
034    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
035    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
036      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
037    if (src.hasCode())
038      tgt.setCode(CodeableConcept30_50.convertCodeableConcept(src.getCode()));
039    if (src.hasSubject())
040      tgt.setSubject(Reference30_50.convertReference(src.getSubject()));
041    if (src.hasCreated())
042      tgt.setCreatedElement(Date30_50.convertDate(src.getCreatedElement()));
043    if (src.hasAuthor())
044      tgt.setAuthor(Reference30_50.convertReference(src.getAuthor()));
045    return tgt;
046  }
047}