001package org.hl7.fhir.convertors.conv30_50.datatypes30_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext30_50;
004import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.CodeableConcept30_50;
005import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Identifier30_50;
006import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.String30_50;
007import org.hl7.fhir.exceptions.FHIRException;
008import org.hl7.fhir.r5.model.CodeableReference;
009
010public class Reference30_50 {
011  public static org.hl7.fhir.r5.model.Reference convertReference(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException {
012    if (src == null) return null;
013    org.hl7.fhir.r5.model.Reference tgt = new org.hl7.fhir.r5.model.Reference();
014    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
015    if (src.hasReference()) tgt.setReference(src.getReference());
016    if (src.hasIdentifier()) tgt.setIdentifier(Identifier30_50.convertIdentifier(src.getIdentifier()));
017    if (src.hasDisplay()) tgt.setDisplayElement(String30_50.convertString(src.getDisplayElement()));
018    return tgt;
019  }
020
021  public static org.hl7.fhir.dstu3.model.Reference convertReference(org.hl7.fhir.r5.model.Reference src) throws FHIRException {
022    if (src == null) return null;
023    org.hl7.fhir.dstu3.model.Reference tgt = new org.hl7.fhir.dstu3.model.Reference();
024    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
025    if (src.hasReference()) tgt.setReference(src.getReference());
026    if (src.hasIdentifier()) tgt.setIdentifier(Identifier30_50.convertIdentifier(src.getIdentifier()));
027    if (src.hasDisplay()) tgt.setDisplayElement(String30_50.convertString(src.getDisplayElement()));
028    return tgt;
029  }
030
031  static public CodeableReference convertReferenceToCodableReference(org.hl7.fhir.dstu3.model.Reference src) {
032    CodeableReference tgt = new CodeableReference();
033    tgt.setReference(convertReference(src));
034    return tgt;
035  }
036
037  static public CodeableReference convertCodeableConceptToCodableReference(org.hl7.fhir.dstu3.model.CodeableConcept src) {
038    CodeableReference tgt = new CodeableReference();
039    tgt.setConcept(CodeableConcept30_50.convertCodeableConcept(src));
040    return tgt;
041  }
042
043  static public org.hl7.fhir.r5.model.CanonicalType convertReferenceToCanonical(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException {
044    org.hl7.fhir.r5.model.CanonicalType dst = new org.hl7.fhir.r5.model.CanonicalType(src.getReference());
045    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, dst);
046    return dst;
047  }
048
049  static public org.hl7.fhir.dstu3.model.Reference convertCanonicalToReference(org.hl7.fhir.r5.model.CanonicalType src) throws FHIRException {
050    org.hl7.fhir.dstu3.model.Reference dst = new org.hl7.fhir.dstu3.model.Reference(src.getValue());
051    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, dst);
052    return dst;
053  }
054}