001package org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50; 002 003import org.hl7.fhir.convertors.context.ConversionContext43_50; 004import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Identifier43_50; 005import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50; 006import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50; 007import org.hl7.fhir.exceptions.FHIRException; 008import org.hl7.fhir.r4b.model.Reference; 009import org.hl7.fhir.r5.model.CanonicalType; 010import org.hl7.fhir.r5.model.CodeableReference; 011 012public class Reference43_50 { 013 public static org.hl7.fhir.r5.model.Reference convertReference(org.hl7.fhir.r4b.model.Reference src) throws FHIRException { 014 if (src == null) return null; 015 org.hl7.fhir.r5.model.Reference tgt = new org.hl7.fhir.r5.model.Reference(); 016 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 017 if (src.hasReference()) tgt.setReferenceElement(String43_50.convertString(src.getReferenceElement_())); 018 if (src.hasType()) tgt.setTypeElement(Uri43_50.convertUri(src.getTypeElement())); 019 if (src.hasIdentifier()) tgt.setIdentifier(Identifier43_50.convertIdentifier(src.getIdentifier())); 020 if (src.hasDisplay()) tgt.setDisplayElement(String43_50.convertString(src.getDisplayElement())); 021 return tgt; 022 } 023 024 public static org.hl7.fhir.r4b.model.Reference convertReference(org.hl7.fhir.r5.model.Reference src) throws FHIRException { 025 if (src == null) return null; 026 org.hl7.fhir.r4b.model.Reference tgt = new org.hl7.fhir.r4b.model.Reference(); 027 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 028 if (src.hasReference()) tgt.setReferenceElement(String43_50.convertString(src.getReferenceElement_())); 029 if (src.hasType()) tgt.setTypeElement(Uri43_50.convertUri(src.getTypeElement())); 030 if (src.hasIdentifier()) tgt.setIdentifier(Identifier43_50.convertIdentifier(src.getIdentifier())); 031 if (src.hasDisplay()) tgt.setDisplayElement(String43_50.convertString(src.getDisplayElement())); 032 return tgt; 033 } 034 035 public static CodeableReference convertReferenceToCodeableReference(org.hl7.fhir.r4b.model.Reference src) { 036 CodeableReference tgt = new CodeableReference(); 037 tgt.setReference(convertReference(src)); 038 return tgt; 039 } 040 041 public static org.hl7.fhir.r5.model.CanonicalType convertReferenceToCanonical(org.hl7.fhir.r4b.model.Reference src) { 042 if (src == null) return null; 043 org.hl7.fhir.r5.model.CanonicalType tgt = new org.hl7.fhir.r5.model.CanonicalType(); 044 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 045 if (src.hasReference()) tgt.setValue(src.getReference()); 046 return tgt; 047 } 048 049 public static org.hl7.fhir.r4b.model.Reference convertReferenceToCanonical(org.hl7.fhir.r5.model.CanonicalType src) { 050 if (src == null) return null; 051 org.hl7.fhir.r4b.model.Reference tgt = new org.hl7.fhir.r4b.model.Reference(); 052 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 053 if (src.hasValue()) tgt.setReference(src.getValue()); 054 return tgt; 055 } 056 057 058 static public org.hl7.fhir.r4b.model.Reference convertCodeableReferenceToReference(org.hl7.fhir.r5.model.CodeableReference src) { 059 org.hl7.fhir.r4b.model.Reference tgt = new org.hl7.fhir.r4b.model.Reference(); 060 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 061 tgt.setReference(src.getReference().getReference()); 062 return tgt; 063 } 064 065 public static Reference convertCanonicalToReference(CanonicalType src) { 066 org.hl7.fhir.r4b.model.Reference dst = new org.hl7.fhir.r4b.model.Reference(src.getValue()); 067 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, dst); 068 return dst; 069 070 } 071 072 073}