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