001package org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50; 002 003import java.util.stream.Collectors; 004 005import org.hl7.fhir.convertors.context.ConversionContext40_50; 006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.BackboneElement40_50; 007import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Coding40_50; 008import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Boolean40_50; 009import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Canonical40_50; 010import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Code40_50; 011import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Id40_50; 012import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Integer40_50; 013import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.MarkDown40_50; 014import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50; 015import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.UnsignedInt40_50; 016import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50; 017import org.hl7.fhir.convertors.conv40_50.resources40_50.Enumerations40_50; 018import org.hl7.fhir.exceptions.FHIRException; 019 020public class ElementDefinition40_50 { 021 public static org.hl7.fhir.r5.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r4.model.ElementDefinition src) throws FHIRException { 022 if (src == null) return null; 023 org.hl7.fhir.r5.model.ElementDefinition tgt = new org.hl7.fhir.r5.model.ElementDefinition(); 024 BackboneElement40_50.copyBackboneElement(src, tgt, "http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue", "http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.valueAlternatives"); 025 if (src.hasPath()) tgt.setPathElement(String40_50.convertString(src.getPathElement())); 026 tgt.setRepresentation(src.getRepresentation().stream().map(ElementDefinition40_50::convertPropertyRepresentation).collect(Collectors.toList())); 027 if (src.hasSliceName()) tgt.setSliceNameElement(String40_50.convertString(src.getSliceNameElement())); 028 if (src.hasSliceIsConstraining()) 029 tgt.setSliceIsConstrainingElement(Boolean40_50.convertBoolean(src.getSliceIsConstrainingElement())); 030 if (src.hasLabel()) tgt.setLabelElement(String40_50.convertString(src.getLabelElement())); 031 for (org.hl7.fhir.r4.model.Coding t : src.getCode()) tgt.addCode(Coding40_50.convertCoding(t)); 032 if (src.hasSlicing()) tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); 033 if (src.hasShort()) tgt.setShortElement(String40_50.convertString(src.getShortElement())); 034 if (src.hasDefinition()) tgt.setDefinitionElement(MarkDown40_50.convertMarkdown(src.getDefinitionElement())); 035 if (src.hasComment()) tgt.setCommentElement(MarkDown40_50.convertMarkdown(src.getCommentElement())); 036 if (src.hasRequirements()) tgt.setRequirementsElement(MarkDown40_50.convertMarkdown(src.getRequirementsElement())); 037 for (org.hl7.fhir.r4.model.StringType t : src.getAlias()) tgt.getAlias().add(String40_50.convertString(t)); 038 if (src.hasMin()) tgt.setMinElement(UnsignedInt40_50.convertUnsignedInt(src.getMinElement())); 039 if (src.hasMax()) tgt.setMaxElement(String40_50.convertString(src.getMaxElement())); 040 if (src.hasBase()) tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); 041 if (src.hasContentReference()) 042 tgt.setContentReferenceElement(Uri40_50.convertUri(src.getContentReferenceElement())); 043 for (org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent t : src.getType()) 044 tgt.addType(convertTypeRefComponent(t)); 045 if (src.hasDefaultValue()) 046 tgt.setDefaultValue(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getDefaultValue())); 047 if (src.hasMeaningWhenMissing()) 048 tgt.setMeaningWhenMissingElement(MarkDown40_50.convertMarkdown(src.getMeaningWhenMissingElement())); 049 if (src.hasOrderMeaning()) tgt.setOrderMeaningElement(String40_50.convertString(src.getOrderMeaningElement())); 050 if (src.hasFixed()) 051 tgt.setFixed(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getFixed())); 052 if (src.hasPattern()) 053 tgt.setPattern(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getPattern())); 054 for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionExampleComponent t : src.getExample()) 055 tgt.addExample(convertElementDefinitionExampleComponent(t)); 056 if (src.hasMinValue()) 057 tgt.setMinValue(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getMinValue())); 058 if (src.hasMaxValue()) 059 tgt.setMaxValue(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getMaxValue())); 060 if (src.hasMaxLength()) tgt.setMaxLengthElement(Integer40_50.convertInteger(src.getMaxLengthElement())); 061 for (org.hl7.fhir.r4.model.IdType t : src.getCondition()) tgt.getCondition().add(Id40_50.convertId(t)); 062 for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) 063 tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); 064 if (src.hasMustSupport()) tgt.setMustSupportElement(Boolean40_50.convertBoolean(src.getMustSupportElement())); 065 if (src.hasIsModifier()) tgt.setIsModifierElement(Boolean40_50.convertBoolean(src.getIsModifierElement())); 066 if (src.hasIsModifierReason()) 067 tgt.setIsModifierReasonElement(String40_50.convertString(src.getIsModifierReasonElement())); 068 if (src.hasIsSummary()) tgt.setIsSummaryElement(Boolean40_50.convertBoolean(src.getIsSummaryElement())); 069 if (src.hasBinding()) tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); 070 for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) 071 tgt.addMapping(convertElementDefinitionMappingComponent(t)); 072 073 if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue")) { 074 tgt.setMustHaveValueElement(Boolean40_50.convertBoolean((org.hl7.fhir.r4.model.BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue").getValueAsPrimitive())); 075 } 076 for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.valueAlternatives")) { 077 tgt.addValueAlternative(Canonical40_50.convertCanonical((org.hl7.fhir.r4.model.CanonicalType)ext.getValue())); 078 } 079 080 return tgt; 081 } 082 083 public static org.hl7.fhir.r4.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r5.model.ElementDefinition src) throws FHIRException { 084 if (src == null) return null; 085 org.hl7.fhir.r4.model.ElementDefinition tgt = new org.hl7.fhir.r4.model.ElementDefinition(); 086 BackboneElement40_50.copyBackboneElement(src, tgt); 087 if (src.hasPath()) tgt.setPathElement(String40_50.convertString(src.getPathElement())); 088 tgt.setRepresentation(src.getRepresentation().stream().map(ElementDefinition40_50::convertPropertyRepresentation).collect(Collectors.toList())); 089 if (src.hasSliceName()) tgt.setSliceNameElement(String40_50.convertString(src.getSliceNameElement())); 090 if (src.hasSliceIsConstraining()) 091 tgt.setSliceIsConstrainingElement(Boolean40_50.convertBoolean(src.getSliceIsConstrainingElement())); 092 if (src.hasLabel()) tgt.setLabelElement(String40_50.convertString(src.getLabelElement())); 093 for (org.hl7.fhir.r5.model.Coding t : src.getCode()) tgt.addCode(Coding40_50.convertCoding(t)); 094 if (src.hasSlicing()) tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); 095 if (src.hasShort()) tgt.setShortElement(String40_50.convertString(src.getShortElement())); 096 if (src.hasDefinition()) tgt.setDefinitionElement(MarkDown40_50.convertMarkdown(src.getDefinitionElement())); 097 if (src.hasComment()) tgt.setCommentElement(MarkDown40_50.convertMarkdown(src.getCommentElement())); 098 if (src.hasRequirements()) tgt.setRequirementsElement(MarkDown40_50.convertMarkdown(src.getRequirementsElement())); 099 for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) tgt.getAlias().add(String40_50.convertString(t)); 100 if (src.hasMin()) tgt.setMinElement(UnsignedInt40_50.convertUnsignedInt(src.getMinElement())); 101 if (src.hasMax()) tgt.setMaxElement(String40_50.convertString(src.getMaxElement())); 102 if (src.hasBase()) tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); 103 if (src.hasContentReference()) 104 tgt.setContentReferenceElement(Uri40_50.convertUri(src.getContentReferenceElement())); 105 for (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent t : src.getType()) 106 tgt.addType(convertTypeRefComponent(t)); 107 if (src.hasDefaultValue()) 108 tgt.setDefaultValue(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getDefaultValue())); 109 if (src.hasMeaningWhenMissing()) 110 tgt.setMeaningWhenMissingElement(MarkDown40_50.convertMarkdown(src.getMeaningWhenMissingElement())); 111 if (src.hasOrderMeaning()) tgt.setOrderMeaningElement(String40_50.convertString(src.getOrderMeaningElement())); 112 if (src.hasFixed()) 113 tgt.setFixed(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getFixed())); 114 if (src.hasPattern()) 115 tgt.setPattern(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getPattern())); 116 for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent t : src.getExample()) 117 tgt.addExample(convertElementDefinitionExampleComponent(t)); 118 if (src.hasMinValue()) 119 tgt.setMinValue(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getMinValue())); 120 if (src.hasMaxValue()) 121 tgt.setMaxValue(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getMaxValue())); 122 if (src.hasMaxLength()) tgt.setMaxLengthElement(Integer40_50.convertInteger(src.getMaxLengthElement())); 123 for (org.hl7.fhir.r5.model.IdType t : src.getCondition()) tgt.getCondition().add(Id40_50.convertId(t)); 124 for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) 125 tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); 126 if (src.hasMustSupport()) tgt.setMustSupportElement(Boolean40_50.convertBoolean(src.getMustSupportElement())); 127 if (src.hasIsModifier()) tgt.setIsModifierElement(Boolean40_50.convertBoolean(src.getIsModifierElement())); 128 if (src.hasIsModifierReason()) 129 tgt.setIsModifierReasonElement(String40_50.convertString(src.getIsModifierReasonElement())); 130 if (src.hasIsSummary()) tgt.setIsSummaryElement(Boolean40_50.convertBoolean(src.getIsSummaryElement())); 131 if (src.hasBinding()) tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); 132 for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) 133 tgt.addMapping(convertElementDefinitionMappingComponent(t)); 134 if (src.hasMustHaveValue()) { 135 tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue", Boolean40_50.convertBoolean(src.getMustHaveValueElement())); 136 } 137 for (org.hl7.fhir.r5.model.CanonicalType ct : src.getValueAlternatives()) { 138 tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.valueAlternatives", Canonical40_50.convertCanonical(ct)); 139 } 140 141 return tgt; 142 } 143 144 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation> convertPropertyRepresentation(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation> src) throws FHIRException { 145 if (src == null || src.isEmpty()) return null; 146 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentationEnumFactory()); 147 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 148 if (src.getValue() == null) { 149 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.NULL); 150 } else { 151 switch (src.getValue()) { 152 case XMLATTR: 153 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XMLATTR); 154 break; 155 case XMLTEXT: 156 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XMLTEXT); 157 break; 158 case TYPEATTR: 159 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.TYPEATTR); 160 break; 161 case CDATEXT: 162 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.CDATEXT); 163 break; 164 case XHTML: 165 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XHTML); 166 break; 167 default: 168 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.NULL); 169 break; 170 } 171 } 172 return tgt; 173 } 174 175 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation> convertPropertyRepresentation(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation> src) throws FHIRException { 176 if (src == null || src.isEmpty()) return null; 177 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentationEnumFactory()); 178 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 179 if (src.getValue() == null) { 180 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.NULL); 181 } else { 182 switch (src.getValue()) { 183 case XMLATTR: 184 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XMLATTR); 185 break; 186 case XMLTEXT: 187 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XMLTEXT); 188 break; 189 case TYPEATTR: 190 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.TYPEATTR); 191 break; 192 case CDATEXT: 193 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.CDATEXT); 194 break; 195 case XHTML: 196 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XHTML); 197 break; 198 default: 199 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.NULL); 200 break; 201 } 202 } 203 return tgt; 204 } 205 206 public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { 207 if (src == null) return null; 208 org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent(); 209 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 210 for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) 211 tgt.addDiscriminator(convertElementDefinitionSlicingDiscriminatorComponent(t)); 212 if (src.hasDescription()) tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement())); 213 if (src.hasOrdered()) tgt.setOrderedElement(Boolean40_50.convertBoolean(src.getOrderedElement())); 214 if (src.hasRules()) tgt.setRulesElement(convertSlicingRules(src.getRulesElement())); 215 return tgt; 216 } 217 218 public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { 219 if (src == null) return null; 220 org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent(); 221 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 222 for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) 223 tgt.addDiscriminator(convertElementDefinitionSlicingDiscriminatorComponent(t)); 224 if (src.hasDescription()) tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement())); 225 if (src.hasOrdered()) tgt.setOrderedElement(Boolean40_50.convertBoolean(src.getOrderedElement())); 226 if (src.hasRules()) tgt.setRulesElement(convertSlicingRules(src.getRulesElement())); 227 return tgt; 228 } 229 230 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ElementDefinition.SlicingRules> convertSlicingRules(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ElementDefinition.SlicingRules> src) throws FHIRException { 231 if (src == null || src.isEmpty()) return null; 232 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ElementDefinition.SlicingRules> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.ElementDefinition.SlicingRulesEnumFactory()); 233 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 234 if (src.getValue() == null) { 235 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.NULL); 236 } else { 237 switch (src.getValue()) { 238 case CLOSED: 239 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.CLOSED); 240 break; 241 case OPEN: 242 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPEN); 243 break; 244 case OPENATEND: 245 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPENATEND); 246 break; 247 default: 248 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.NULL); 249 break; 250 } 251 } 252 return tgt; 253 } 254 255 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ElementDefinition.SlicingRules> convertSlicingRules(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ElementDefinition.SlicingRules> src) throws FHIRException { 256 if (src == null || src.isEmpty()) return null; 257 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ElementDefinition.SlicingRules> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.ElementDefinition.SlicingRulesEnumFactory()); 258 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 259 if (src.getValue() == null) { 260 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.NULL); 261 } else { 262 switch (src.getValue()) { 263 case CLOSED: 264 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.CLOSED); 265 break; 266 case OPEN: 267 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPEN); 268 break; 269 case OPENATEND: 270 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPENATEND); 271 break; 272 default: 273 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.NULL); 274 break; 275 } 276 } 277 return tgt; 278 } 279 280 public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent convertElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent src) throws FHIRException { 281 if (src == null) return null; 282 org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent(); 283 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 284 if (src.hasType()) tgt.setTypeElement(convertDiscriminatorType(src.getTypeElement())); 285 if (src.hasPath()) tgt.setPathElement(String40_50.convertString(src.getPathElement())); 286 return tgt; 287 } 288 289 public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent convertElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent src) throws FHIRException { 290 if (src == null) return null; 291 org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent(); 292 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 293 if (src.hasType()) tgt.setTypeElement(convertDiscriminatorType(src.getTypeElement())); 294 if (src.hasPath()) tgt.setPathElement(String40_50.convertString(src.getPathElement())); 295 return tgt; 296 } 297 298 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType> convertDiscriminatorType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType> src) throws FHIRException { 299 if (src == null || src.isEmpty()) return null; 300 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorTypeEnumFactory()); 301 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 302 if (src.getValue() == null) { 303 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.NULL); 304 } else { 305 switch (src.getValue()) { 306 case VALUE: 307 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.VALUE); 308 break; 309 case EXISTS: 310 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.EXISTS); 311 break; 312 case PATTERN: 313 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.PATTERN); 314 break; 315 case TYPE: 316 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.TYPE); 317 break; 318 case PROFILE: 319 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.PROFILE); 320 break; 321 default: 322 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.NULL); 323 break; 324 } 325 } 326 return tgt; 327 } 328 329 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType> convertDiscriminatorType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType> src) throws FHIRException { 330 if (src == null || src.isEmpty()) return null; 331 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorTypeEnumFactory()); 332 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 333 if (src.getValue() == null) { 334 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.NULL); 335 } else { 336 switch (src.getValue()) { 337 case VALUE: 338 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.VALUE); 339 break; 340 case EXISTS: 341 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.EXISTS); 342 break; 343 case PATTERN: 344 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.PATTERN); 345 break; 346 case TYPE: 347 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.TYPE); 348 break; 349 case PROFILE: 350 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.PROFILE); 351 break; 352 default: 353 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.NULL); 354 break; 355 } 356 } 357 return tgt; 358 } 359 360 public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { 361 if (src == null) return null; 362 org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent(); 363 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 364 if (src.hasPath()) tgt.setPathElement(String40_50.convertString(src.getPathElement())); 365 if (src.hasMin()) tgt.setMinElement(UnsignedInt40_50.convertUnsignedInt(src.getMinElement())); 366 if (src.hasMax()) tgt.setMaxElement(String40_50.convertString(src.getMaxElement())); 367 return tgt; 368 } 369 370 public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { 371 if (src == null) return null; 372 org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent(); 373 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 374 if (src.hasPath()) tgt.setPathElement(String40_50.convertString(src.getPathElement())); 375 if (src.hasMin()) tgt.setMinElement(UnsignedInt40_50.convertUnsignedInt(src.getMinElement())); 376 if (src.hasMax()) tgt.setMaxElement(String40_50.convertString(src.getMaxElement())); 377 return tgt; 378 } 379 380 public static org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent convertTypeRefComponent(org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent src) throws FHIRException { 381 if (src == null) return null; 382 org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent(); 383 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 384 if (src.hasCode()) tgt.setCodeElement(Uri40_50.convertUri(src.getCodeElement())); 385 for (org.hl7.fhir.r4.model.CanonicalType t : src.getProfile()) 386 tgt.getProfile().add(Canonical40_50.convertCanonical(t)); 387 for (org.hl7.fhir.r4.model.CanonicalType t : src.getTargetProfile()) 388 tgt.getTargetProfile().add(Canonical40_50.convertCanonical(t)); 389 tgt.setAggregation(src.getAggregation().stream().map(ElementDefinition40_50::convertAggregationMode).collect(Collectors.toList())); 390 if (src.hasVersioning()) tgt.setVersioningElement(convertReferenceVersionRules(src.getVersioningElement())); 391 return tgt; 392 } 393 394 public static org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent convertTypeRefComponent(org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent src) throws FHIRException { 395 if (src == null) return null; 396 org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent(); 397 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 398 if (src.hasCode()) tgt.setCodeElement(Uri40_50.convertUri(src.getCodeElement())); 399 for (org.hl7.fhir.r5.model.CanonicalType t : src.getProfile()) 400 tgt.getProfile().add(Canonical40_50.convertCanonical(t)); 401 for (org.hl7.fhir.r5.model.CanonicalType t : src.getTargetProfile()) 402 tgt.getTargetProfile().add(Canonical40_50.convertCanonical(t)); 403 tgt.setAggregation(src.getAggregation().stream().map(ElementDefinition40_50::convertAggregationMode).collect(Collectors.toList())); 404 if (src.hasVersioning()) tgt.setVersioningElement(convertReferenceVersionRules(src.getVersioningElement())); 405 return tgt; 406 } 407 408 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ElementDefinition.AggregationMode> convertAggregationMode(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ElementDefinition.AggregationMode> src) throws FHIRException { 409 if (src == null || src.isEmpty()) return null; 410 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ElementDefinition.AggregationMode> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.ElementDefinition.AggregationModeEnumFactory()); 411 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 412 if (src.getValue() == null) { 413 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.NULL); 414 } else { 415 switch (src.getValue()) { 416 case CONTAINED: 417 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.CONTAINED); 418 break; 419 case REFERENCED: 420 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.REFERENCED); 421 break; 422 case BUNDLED: 423 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.BUNDLED); 424 break; 425 default: 426 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.NULL); 427 break; 428 } 429 } 430 return tgt; 431 } 432 433 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ElementDefinition.AggregationMode> convertAggregationMode(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ElementDefinition.AggregationMode> src) throws FHIRException { 434 if (src == null || src.isEmpty()) return null; 435 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ElementDefinition.AggregationMode> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.ElementDefinition.AggregationModeEnumFactory()); 436 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 437 if (src.getValue() == null) { 438 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.NULL); 439 } else { 440 switch (src.getValue()) { 441 case CONTAINED: 442 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.CONTAINED); 443 break; 444 case REFERENCED: 445 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.REFERENCED); 446 break; 447 case BUNDLED: 448 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.BUNDLED); 449 break; 450 default: 451 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.NULL); 452 break; 453 } 454 } 455 return tgt; 456 } 457 458 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules> convertReferenceVersionRules(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules> src) throws FHIRException { 459 if (src == null || src.isEmpty()) return null; 460 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRulesEnumFactory()); 461 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 462 if (src.getValue() == null) { 463 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.NULL); 464 } else { 465 switch (src.getValue()) { 466 case EITHER: 467 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.EITHER); 468 break; 469 case INDEPENDENT: 470 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT); 471 break; 472 case SPECIFIC: 473 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.SPECIFIC); 474 break; 475 default: 476 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.NULL); 477 break; 478 } 479 } 480 return tgt; 481 } 482 483 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules> convertReferenceVersionRules(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules> src) throws FHIRException { 484 if (src == null || src.isEmpty()) return null; 485 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRulesEnumFactory()); 486 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 487 if (src.getValue() == null) { 488 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.NULL); 489 } else { 490 switch (src.getValue()) { 491 case EITHER: 492 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.EITHER); 493 break; 494 case INDEPENDENT: 495 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT); 496 break; 497 case SPECIFIC: 498 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.SPECIFIC); 499 break; 500 default: 501 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.NULL); 502 break; 503 } 504 } 505 return tgt; 506 } 507 508 public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent convertElementDefinitionExampleComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionExampleComponent src) throws FHIRException { 509 if (src == null) return null; 510 org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent(); 511 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 512 if (src.hasLabel()) tgt.setLabelElement(String40_50.convertString(src.getLabelElement())); 513 if (src.hasValue()) 514 tgt.setValue(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getValue())); 515 return tgt; 516 } 517 518 public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionExampleComponent convertElementDefinitionExampleComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent src) throws FHIRException { 519 if (src == null) return null; 520 org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionExampleComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionExampleComponent(); 521 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 522 if (src.hasLabel()) tgt.setLabelElement(String40_50.convertString(src.getLabelElement())); 523 if (src.hasValue()) 524 tgt.setValue(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getValue())); 525 return tgt; 526 } 527 528 public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { 529 if (src == null) return null; 530 org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent(); 531 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 532 if (src.hasKey()) tgt.setKeyElement(Id40_50.convertId(src.getKeyElement())); 533 if (src.hasRequirements()) tgt.setRequirementsElement(String40_50.convertStringToMarkdown(src.getRequirementsElement())); 534 if (src.hasSeverity()) tgt.setSeverityElement(convertConstraintSeverity(src.getSeverityElement())); 535 if (src.hasHuman()) tgt.setHumanElement(String40_50.convertString(src.getHumanElement())); 536 if (src.hasExpression()) tgt.setExpressionElement(String40_50.convertString(src.getExpressionElement())); 537 if (src.hasXpath()) { 538 tgt.addExtension(new org.hl7.fhir.r5.model.Extension(org.hl7.fhir.r5.utils.ToolingExtensions.EXT_XPATH_CONSTRAINT, new org.hl7.fhir.r5.model.StringType(src.getXpath()))); 539 } 540 if (src.hasSource()) tgt.setSourceElement(Canonical40_50.convertCanonical(src.getSourceElement())); 541 return tgt; 542 } 543 544 public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { 545 if (src == null) return null; 546 org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent(); 547 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt, org.hl7.fhir.r5.utils.ToolingExtensions.EXT_XPATH_CONSTRAINT); 548 if (src.hasKey()) tgt.setKeyElement(Id40_50.convertId(src.getKeyElement())); 549 if (src.hasRequirements()) tgt.setRequirementsElement(String40_50.convertString(src.getRequirementsElement())); 550 if (src.hasSeverity()) tgt.setSeverityElement(convertConstraintSeverity(src.getSeverityElement())); 551 if (src.hasHuman()) tgt.setHumanElement(String40_50.convertString(src.getHumanElement())); 552 if (src.hasExpression()) tgt.setExpressionElement(String40_50.convertString(src.getExpressionElement())); 553 if (org.hl7.fhir.r5.utils.ToolingExtensions.hasExtension(src, org.hl7.fhir.r5.utils.ToolingExtensions.EXT_XPATH_CONSTRAINT)) { 554 tgt.setXpath(org.hl7.fhir.r5.utils.ToolingExtensions.readStringExtension(src, org.hl7.fhir.r5.utils.ToolingExtensions.EXT_XPATH_CONSTRAINT)); 555 } 556 if (src.hasSource()) tgt.setSourceElement(Canonical40_50.convertCanonical(src.getSourceElement())); 557 return tgt; 558 } 559 560 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity> convertConstraintSeverity(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity> src) throws FHIRException { 561 if (src == null || src.isEmpty()) return null; 562 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverityEnumFactory()); 563 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 564 if (src.getValue() == null) { 565 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.NULL); 566 } else { 567 switch (src.getValue()) { 568 case ERROR: 569 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.ERROR); 570 break; 571 case WARNING: 572 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.WARNING); 573 break; 574 default: 575 tgt.setValue(org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.NULL); 576 break; 577 } 578 } 579 return tgt; 580 } 581 582 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity> convertConstraintSeverity(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity> src) throws FHIRException { 583 if (src == null || src.isEmpty()) return null; 584 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverityEnumFactory()); 585 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 586 if (src.getValue() == null) { 587 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.NULL); 588 } else { 589 switch (src.getValue()) { 590 case ERROR: 591 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.ERROR); 592 break; 593 case WARNING: 594 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.WARNING); 595 break; 596 default: 597 tgt.setValue(org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.NULL); 598 break; 599 } 600 } 601 return tgt; 602 } 603 604 public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { 605 if (src == null) return null; 606 org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent(); 607 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 608 if (src.hasStrength()) tgt.setStrengthElement(Enumerations40_50.convertBindingStrength(src.getStrengthElement())); 609 if (src.hasDescription()) tgt.setDescriptionElement(String40_50.convertStringToMarkdown(src.getDescriptionElement())); 610 if (src.hasValueSet()) tgt.setValueSetElement(Canonical40_50.convertCanonical(src.getValueSetElement())); 611 return tgt; 612 } 613 614 public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { 615 if (src == null) return null; 616 org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent(); 617 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 618 if (src.hasStrength()) tgt.setStrengthElement(Enumerations40_50.convertBindingStrength(src.getStrengthElement())); 619 if (src.hasDescription()) tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement())); 620 if (src.hasValueSet()) tgt.setValueSetElement(Canonical40_50.convertCanonical(src.getValueSetElement())); 621 return tgt; 622 } 623 624 public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { 625 if (src == null) return null; 626 org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent(); 627 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 628 if (src.hasIdentity()) tgt.setIdentityElement(Id40_50.convertId(src.getIdentityElement())); 629 if (src.hasLanguage()) tgt.setLanguageElement(Code40_50.convertCode(src.getLanguageElement())); 630 if (src.hasMap()) tgt.setMapElement(String40_50.convertString(src.getMapElement())); 631 if (src.hasComment()) tgt.setCommentElement(String40_50.convertStringToMarkdown(src.getCommentElement())); 632 return tgt; 633 } 634 635 public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { 636 if (src == null) return null; 637 org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent(); 638 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 639 if (src.hasIdentity()) tgt.setIdentityElement(Id40_50.convertId(src.getIdentityElement())); 640 if (src.hasLanguage()) tgt.setLanguageElement(Code40_50.convertCode(src.getLanguageElement())); 641 if (src.hasMap()) tgt.setMapElement(String40_50.convertString(src.getMapElement())); 642 if (src.hasComment()) tgt.setCommentElement(String40_50.convertString(src.getCommentElement())); 643 return tgt; 644 } 645}