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