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