001package org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50; 002 003import org.hl7.fhir.convertors.context.ConversionContext43_50; 004import org.hl7.fhir.exceptions.FHIRException; 005 006public class Narrative43_50 { 007 public static org.hl7.fhir.r5.model.Narrative convertNarrative(org.hl7.fhir.r4b.model.Narrative src) throws FHIRException { 008 if (src == null) return null; 009 org.hl7.fhir.r5.model.Narrative tgt = new org.hl7.fhir.r5.model.Narrative(); 010 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 011 if (src.hasStatus()) tgt.setStatusElement(convertNarrativeStatus(src.getStatusElement())); 012 if (src.hasDiv()) tgt.setDiv(xhtml43_50.convertXhtml(src.getDiv())); 013 return tgt; 014 } 015 016 public static org.hl7.fhir.r4b.model.Narrative convertNarrative(org.hl7.fhir.r5.model.Narrative src) throws FHIRException { 017 if (src == null) return null; 018 org.hl7.fhir.r4b.model.Narrative tgt = new org.hl7.fhir.r4b.model.Narrative(); 019 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 020 if (src.hasStatus()) tgt.setStatusElement(convertNarrativeStatus(src.getStatusElement())); 021 if (src.hasDiv()) tgt.setDiv(xhtml43_50.convertXhtml(src.getDiv())); 022 return tgt; 023 } 024 025 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Narrative.NarrativeStatus> convertNarrativeStatus(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Narrative.NarrativeStatus> src) throws FHIRException { 026 if (src == null || src.isEmpty()) return null; 027 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Narrative.NarrativeStatus> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Narrative.NarrativeStatusEnumFactory()); 028 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 029 if (src.getValue() == null) { 030 tgt.setValue(org.hl7.fhir.r5.model.Narrative.NarrativeStatus.NULL); 031 } else { 032 switch (src.getValue()) { 033 case GENERATED: 034 tgt.setValue(org.hl7.fhir.r5.model.Narrative.NarrativeStatus.GENERATED); 035 break; 036 case EXTENSIONS: 037 tgt.setValue(org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EXTENSIONS); 038 break; 039 case ADDITIONAL: 040 tgt.setValue(org.hl7.fhir.r5.model.Narrative.NarrativeStatus.ADDITIONAL); 041 break; 042 case EMPTY: 043 tgt.setValue(org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EMPTY); 044 break; 045 default: 046 tgt.setValue(org.hl7.fhir.r5.model.Narrative.NarrativeStatus.NULL); 047 break; 048 } 049 } 050 return tgt; 051 } 052 053 static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Narrative.NarrativeStatus> convertNarrativeStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Narrative.NarrativeStatus> src) throws FHIRException { 054 if (src == null || src.isEmpty()) return null; 055 org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Narrative.NarrativeStatus> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Narrative.NarrativeStatusEnumFactory()); 056 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 057 if (src.getValue() == null) { 058 tgt.setValue(org.hl7.fhir.r4b.model.Narrative.NarrativeStatus.NULL); 059 } else { 060 switch (src.getValue()) { 061 case GENERATED: 062 tgt.setValue(org.hl7.fhir.r4b.model.Narrative.NarrativeStatus.GENERATED); 063 break; 064 case EXTENSIONS: 065 tgt.setValue(org.hl7.fhir.r4b.model.Narrative.NarrativeStatus.EXTENSIONS); 066 break; 067 case ADDITIONAL: 068 tgt.setValue(org.hl7.fhir.r4b.model.Narrative.NarrativeStatus.ADDITIONAL); 069 break; 070 case EMPTY: 071 tgt.setValue(org.hl7.fhir.r4b.model.Narrative.NarrativeStatus.EMPTY); 072 break; 073 default: 074 tgt.setValue(org.hl7.fhir.r4b.model.Narrative.NarrativeStatus.NULL); 075 break; 076 } 077 } 078 return tgt; 079 } 080}