001package org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30; 002 003import org.hl7.fhir.convertors.context.ConversionContext14_30; 004import org.hl7.fhir.exceptions.FHIRException; 005 006public class Code14_30 { 007 public static org.hl7.fhir.dstu3.model.CodeType convertCode(org.hl7.fhir.dstu2016may.model.CodeType src) throws FHIRException { 008 org.hl7.fhir.dstu3.model.CodeType tgt = new org.hl7.fhir.dstu3.model.CodeType(); 009 if (src.hasValue()) tgt.setValue(src.getValue()); 010 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 011 return tgt; 012 } 013 014 public static org.hl7.fhir.dstu2016may.model.CodeType convertCode(org.hl7.fhir.dstu3.model.CodeType src) throws FHIRException { 015 org.hl7.fhir.dstu2016may.model.CodeType tgt = new org.hl7.fhir.dstu2016may.model.CodeType(); 016 if (src.hasValue()) tgt.setValue(src.getValue()); 017 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 018 return tgt; 019 } 020 021 public static org.hl7.fhir.dstu3.model.Coding convertCoding(org.hl7.fhir.dstu2016may.model.Coding src) throws FHIRException { 022 if (src == null || src.isEmpty()) return null; 023 org.hl7.fhir.dstu3.model.Coding tgt = new org.hl7.fhir.dstu3.model.Coding(); 024 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 025 if (src.hasSystem()) tgt.setSystemElement(Uri14_30.convertUri(src.getSystemElement())); 026 if (src.hasVersion()) tgt.setVersionElement(String14_30.convertString(src.getVersionElement())); 027 if (src.hasCode()) tgt.setCodeElement(convertCode(src.getCodeElement())); 028 if (src.hasDisplay()) tgt.setDisplayElement(String14_30.convertString(src.getDisplayElement())); 029 if (src.hasUserSelected()) tgt.setUserSelectedElement(Boolean14_30.convertBoolean(src.getUserSelectedElement())); 030 return tgt; 031 } 032 033 public static org.hl7.fhir.dstu2016may.model.Coding convertCoding(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { 034 if (src == null || src.isEmpty()) return null; 035 org.hl7.fhir.dstu2016may.model.Coding tgt = new org.hl7.fhir.dstu2016may.model.Coding(); 036 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 037 if (src.hasSystem()) tgt.setSystemElement(Uri14_30.convertUri(src.getSystemElement())); 038 if (src.hasVersion()) tgt.setVersionElement(String14_30.convertString(src.getVersionElement())); 039 if (src.hasCode()) tgt.setCodeElement(convertCode(src.getCodeElement())); 040 if (src.hasDisplay()) tgt.setDisplayElement(String14_30.convertString(src.getDisplayElement())); 041 if (src.hasUserSelected()) tgt.setUserSelectedElement(Boolean14_30.convertBoolean(src.getUserSelectedElement())); 042 return tgt; 043 } 044}