
001package org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50; 002 003import org.hl7.fhir.convertors.context.ConversionContext43_50; 004import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50; 005import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50; 006import org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50.Reference43_50; 007import org.hl7.fhir.exceptions.FHIRException; 008 009public class Identifier43_50 { 010 public static org.hl7.fhir.r5.model.Identifier convertIdentifier(org.hl7.fhir.r4b.model.Identifier src) throws FHIRException { 011 if (src == null) return null; 012 org.hl7.fhir.r5.model.Identifier tgt = new org.hl7.fhir.r5.model.Identifier(); 013 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 014 if (src.hasUse()) tgt.setUseElement(convertIdentifierUse(src.getUseElement())); 015 if (src.hasType()) tgt.setType(CodeableConcept43_50.convertCodeableConcept(src.getType())); 016 if (src.hasSystem()) tgt.setSystemElement(Uri43_50.convertUri(src.getSystemElement())); 017 if (src.hasValue()) tgt.setValueElement(String43_50.convertString(src.getValueElement())); 018 if (src.hasPeriod()) tgt.setPeriod(Period43_50.convertPeriod(src.getPeriod())); 019 if (src.hasAssigner()) tgt.setAssigner(Reference43_50.convertReference(src.getAssigner())); 020 return tgt; 021 } 022 023 public static org.hl7.fhir.r4b.model.Identifier convertIdentifier(org.hl7.fhir.r5.model.Identifier src) throws FHIRException { 024 if (src == null) return null; 025 org.hl7.fhir.r4b.model.Identifier tgt = new org.hl7.fhir.r4b.model.Identifier(); 026 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 027 if (src.hasUse()) tgt.setUseElement(convertIdentifierUse(src.getUseElement())); 028 if (src.hasType()) tgt.setType(CodeableConcept43_50.convertCodeableConcept(src.getType())); 029 if (src.hasSystem()) tgt.setSystemElement(Uri43_50.convertUri(src.getSystemElement())); 030 if (src.hasValue()) tgt.setValueElement(String43_50.convertString(src.getValueElement())); 031 if (src.hasPeriod()) tgt.setPeriod(Period43_50.convertPeriod(src.getPeriod())); 032 if (src.hasAssigner()) tgt.setAssigner(Reference43_50.convertReference(src.getAssigner())); 033 return tgt; 034 } 035 036 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Identifier.IdentifierUse> convertIdentifierUse(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Identifier.IdentifierUse> src) throws FHIRException { 037 if (src == null || src.isEmpty()) return null; 038 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Identifier.IdentifierUse> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Identifier.IdentifierUseEnumFactory()); 039 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 040 if (src.getValue() == null) { 041 tgt.setValue(org.hl7.fhir.r5.model.Identifier.IdentifierUse.NULL); 042 } else { 043 switch (src.getValue()) { 044 case USUAL: 045 tgt.setValue(org.hl7.fhir.r5.model.Identifier.IdentifierUse.USUAL); 046 break; 047 case OFFICIAL: 048 tgt.setValue(org.hl7.fhir.r5.model.Identifier.IdentifierUse.OFFICIAL); 049 break; 050 case TEMP: 051 tgt.setValue(org.hl7.fhir.r5.model.Identifier.IdentifierUse.TEMP); 052 break; 053 case SECONDARY: 054 tgt.setValue(org.hl7.fhir.r5.model.Identifier.IdentifierUse.SECONDARY); 055 break; 056 case OLD: 057 tgt.setValue(org.hl7.fhir.r5.model.Identifier.IdentifierUse.OLD); 058 break; 059 default: 060 tgt.setValue(org.hl7.fhir.r5.model.Identifier.IdentifierUse.NULL); 061 break; 062 } 063 } 064 return tgt; 065 } 066 067 static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Identifier.IdentifierUse> convertIdentifierUse(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Identifier.IdentifierUse> src) throws FHIRException { 068 if (src == null || src.isEmpty()) return null; 069 org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Identifier.IdentifierUse> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Identifier.IdentifierUseEnumFactory()); 070 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 071 if (src.getValue() == null) { 072 tgt.setValue(org.hl7.fhir.r4b.model.Identifier.IdentifierUse.NULL); 073 } else { 074 switch (src.getValue()) { 075 case USUAL: 076 tgt.setValue(org.hl7.fhir.r4b.model.Identifier.IdentifierUse.USUAL); 077 break; 078 case OFFICIAL: 079 tgt.setValue(org.hl7.fhir.r4b.model.Identifier.IdentifierUse.OFFICIAL); 080 break; 081 case TEMP: 082 tgt.setValue(org.hl7.fhir.r4b.model.Identifier.IdentifierUse.TEMP); 083 break; 084 case SECONDARY: 085 tgt.setValue(org.hl7.fhir.r4b.model.Identifier.IdentifierUse.SECONDARY); 086 break; 087 case OLD: 088 tgt.setValue(org.hl7.fhir.r4b.model.Identifier.IdentifierUse.OLD); 089 break; 090 default: 091 tgt.setValue(org.hl7.fhir.r4b.model.Identifier.IdentifierUse.NULL); 092 break; 093 } 094 } 095 return tgt; 096 } 097}