001package org.hl7.fhir.convertors.conv14_30.datatypes14_30; 002 003import org.hl7.fhir.convertors.VersionConvertorConstants; 004import org.hl7.fhir.convertors.context.ConversionContext14_30; 005import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.*; 006import org.hl7.fhir.convertors.conv14_30.resources14_30.Enumerations14_30; 007import org.hl7.fhir.dstu3.conformance.ProfileUtilities; 008import org.hl7.fhir.dstu3.model.ElementDefinition; 009import org.hl7.fhir.exceptions.FHIRException; 010 011import java.util.stream.Collectors; 012 013public class ElementDefinition14_30 { 014 public static org.hl7.fhir.dstu3.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu2016may.model.ElementDefinition src) throws FHIRException { 015 if (src == null || src.isEmpty()) return null; 016 org.hl7.fhir.dstu3.model.ElementDefinition tgt = new org.hl7.fhir.dstu3.model.ElementDefinition(); 017 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 018 if (src.hasPathElement()) tgt.setPathElement(String14_30.convertString(src.getPathElement())); 019 tgt.setRepresentation(src.getRepresentation().stream().map(ElementDefinition14_30::convertPropertyRepresentation).collect(Collectors.toList())); 020 if (src.hasName()) tgt.setSliceNameElement(String14_30.convertString(src.getNameElement())); 021 if (src.hasLabel()) tgt.setLabelElement(String14_30.convertString(src.getLabelElement())); 022 for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) tgt.addCode(Code14_30.convertCoding(t)); 023 if (src.hasSlicing()) tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); 024 if (src.hasShort()) tgt.setShortElement(String14_30.convertString(src.getShortElement())); 025 if (src.hasDefinition()) tgt.setDefinitionElement(MarkDown14_30.convertMarkdown(src.getDefinitionElement())); 026 if (src.hasComments()) tgt.setCommentElement(MarkDown14_30.convertMarkdown(src.getCommentsElement())); 027 if (src.hasRequirements()) tgt.setRequirementsElement(MarkDown14_30.convertMarkdown(src.getRequirementsElement())); 028 for (org.hl7.fhir.dstu2016may.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); 029 if (src.hasMin()) tgt.setMin(src.getMin()); 030 if (src.hasMax()) tgt.setMaxElement(String14_30.convertString(src.getMaxElement())); 031 if (src.hasBase()) tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); 032 if (src.hasContentReference()) 033 tgt.setContentReferenceElement(Uri14_30.convertUri(src.getContentReferenceElement())); 034 for (org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent t : src.getType()) 035 tgt.addType(convertTypeRefComponent(t)); 036 if (src.hasDefaultValue()) 037 tgt.setDefaultValue(ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().convertType(src.getDefaultValue())); 038 if (src.hasMeaningWhenMissing()) 039 tgt.setMeaningWhenMissingElement(MarkDown14_30.convertMarkdown(src.getMeaningWhenMissingElement())); 040 if (src.hasFixed()) 041 tgt.setFixed(ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().convertType(src.getFixed())); 042 if (src.hasPattern()) 043 tgt.setPattern(ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().convertType(src.getPattern())); 044 if (src.hasExample()) 045 tgt.addExample().setLabel("General").setValue(ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().convertType(src.getExample())); 046 if (src.hasMinValue()) 047 tgt.setMinValue(ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().convertType(src.getMinValue())); 048 if (src.hasMaxValue()) 049 tgt.setMaxValue(ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().convertType(src.getMaxValue())); 050 if (src.hasMaxLength()) tgt.setMaxLengthElement(Integer14_30.convertInteger(src.getMaxLengthElement())); 051 for (org.hl7.fhir.dstu2016may.model.IdType t : src.getCondition()) tgt.addCondition(t.getValue()); 052 for (org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) 053 tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); 054 if (src.hasMustSupport()) tgt.setMustSupportElement(Boolean14_30.convertBoolean(src.getMustSupportElement())); 055 if (src.hasIsModifier()) tgt.setIsModifierElement(Boolean14_30.convertBoolean(src.getIsModifierElement())); 056 if (src.hasIsSummary()) tgt.setIsSummaryElement(Boolean14_30.convertBoolean(src.getIsSummaryElement())); 057 if (src.hasBinding()) tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); 058 for (org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) 059 tgt.addMapping(convertElementDefinitionMappingComponent(t)); 060 return tgt; 061 } 062 063 public static org.hl7.fhir.dstu2016may.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu3.model.ElementDefinition src) throws FHIRException { 064 if (src == null || src.isEmpty()) return null; 065 org.hl7.fhir.dstu2016may.model.ElementDefinition tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition(); 066 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 067 if (src.hasPathElement()) tgt.setPathElement(String14_30.convertString(src.getPathElement())); 068 tgt.setRepresentation(src.getRepresentation().stream().map(ElementDefinition14_30::convertPropertyRepresentation).collect(Collectors.toList())); 069 if (src.hasSliceName()) tgt.setNameElement(String14_30.convertString(src.getSliceNameElement())); 070 if (src.hasLabel()) tgt.setLabelElement(String14_30.convertString(src.getLabelElement())); 071 for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) tgt.addCode(Code14_30.convertCoding(t)); 072 if (src.hasSlicing()) tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); 073 if (src.hasShort()) tgt.setShortElement(String14_30.convertString(src.getShortElement())); 074 if (src.hasDefinition()) tgt.setDefinitionElement(MarkDown14_30.convertMarkdown(src.getDefinitionElement())); 075 if (src.hasComment()) tgt.setCommentsElement(MarkDown14_30.convertMarkdown(src.getCommentElement())); 076 if (src.hasRequirements()) tgt.setRequirementsElement(MarkDown14_30.convertMarkdown(src.getRequirementsElement())); 077 for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) tgt.addAlias(t.getValue()); 078 if (src.hasMin()) tgt.setMin(src.getMin()); 079 if (src.hasMax()) tgt.setMaxElement(String14_30.convertString(src.getMaxElement())); 080 if (src.hasBase()) tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); 081 if (src.hasContentReference()) 082 tgt.setContentReferenceElement(Uri14_30.convertUri(src.getContentReferenceElement())); 083 for (org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent t : src.getType()) 084 tgt.addType(convertTypeRefComponent(t)); 085 if (src.hasDefaultValue()) 086 tgt.setDefaultValue(ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().convertType(src.getDefaultValue())); 087 if (src.hasMeaningWhenMissing()) 088 tgt.setMeaningWhenMissingElement(MarkDown14_30.convertMarkdown(src.getMeaningWhenMissingElement())); 089 if (src.hasFixed()) 090 tgt.setFixed(ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().convertType(src.getFixed())); 091 if (src.hasPattern()) 092 tgt.setPattern(ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().convertType(src.getPattern())); 093 if (src.hasExample()) 094 tgt.setExample(ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().convertType(src.getExample().get(0).getValue())); 095 if (src.hasMinValue()) 096 tgt.setMinValue(ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().convertType(src.getMinValue())); 097 if (src.hasMaxValue()) 098 tgt.setMaxValue(ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().convertType(src.getMaxValue())); 099 if (src.hasMaxLength()) tgt.setMaxLengthElement(Integer14_30.convertInteger(src.getMaxLengthElement())); 100 for (org.hl7.fhir.dstu3.model.IdType t : src.getCondition()) tgt.addCondition(t.getValue()); 101 for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) 102 tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); 103 if (src.hasMustSupport()) tgt.setMustSupportElement(Boolean14_30.convertBoolean(src.getMustSupportElement())); 104 if (src.hasIsModifier()) tgt.setIsModifierElement(Boolean14_30.convertBoolean(src.getIsModifierElement())); 105 if (src.hasIsSummary()) tgt.setIsSummaryElement(Boolean14_30.convertBoolean(src.getIsSummaryElement())); 106 if (src.hasBinding()) tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); 107 for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) 108 tgt.addMapping(convertElementDefinitionMappingComponent(t)); 109 return tgt; 110 } 111 112 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation> convertPropertyRepresentation(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation> src) throws FHIRException { 113 if (src == null || src.isEmpty()) return null; 114 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()); 115 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 116 if (src.getValue() == null) { 117 tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.NULL); 118 } else { 119 switch (src.getValue()) { 120 case XMLATTR: 121 tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLATTR); 122 break; 123 case XMLTEXT: 124 tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLTEXT); 125 break; 126 case TYPEATTR: 127 tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.TYPEATTR); 128 break; 129 case CDATEXT: 130 tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.CDATEXT); 131 break; 132 default: 133 tgt.setValue(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.NULL); 134 break; 135 } 136 } 137 return tgt; 138 } 139 140 static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation> convertPropertyRepresentation(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation> src) throws FHIRException { 141 if (src == null || src.isEmpty()) return null; 142 org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentationEnumFactory()); 143 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 144 if (src.getValue() == null) { 145 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.NULL); 146 } else { 147 switch (src.getValue()) { 148 case XMLATTR: 149 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.XMLATTR); 150 break; 151 case XMLTEXT: 152 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.XMLTEXT); 153 break; 154 case TYPEATTR: 155 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.TYPEATTR); 156 break; 157 case CDATEXT: 158 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.CDATEXT); 159 break; 160 default: 161 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.NULL); 162 break; 163 } 164 } 165 return tgt; 166 } 167 168 public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { 169 if (src == null || src.isEmpty()) return null; 170 org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent(); 171 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 172 for (org.hl7.fhir.dstu2016may.model.StringType t : src.getDiscriminator()) 173 tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue())); 174 if (src.hasDescription()) tgt.setDescriptionElement(String14_30.convertString(src.getDescriptionElement())); 175 if (src.hasOrdered()) tgt.setOrderedElement(Boolean14_30.convertBoolean(src.getOrderedElement())); 176 if (src.hasRules()) tgt.setRulesElement(convertSlicingRules(src.getRulesElement())); 177 return tgt; 178 } 179 180 public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { 181 if (src == null || src.isEmpty()) return null; 182 org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent(); 183 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 184 for (ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) 185 tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t)); 186 if (src.hasDescription()) tgt.setDescriptionElement(String14_30.convertString(src.getDescriptionElement())); 187 if (src.hasOrdered()) tgt.setOrderedElement(Boolean14_30.convertBoolean(src.getOrderedElement())); 188 if (src.hasRules()) tgt.setRulesElement(convertSlicingRules(src.getRulesElement())); 189 return tgt; 190 } 191 192 static public org.hl7.fhir.dstu3.model.Enumeration<ElementDefinition.SlicingRules> convertSlicingRules(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules> src) throws FHIRException { 193 if (src == null || src.isEmpty()) return null; 194 org.hl7.fhir.dstu3.model.Enumeration<ElementDefinition.SlicingRules> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new ElementDefinition.SlicingRulesEnumFactory()); 195 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 196 if (src.getValue() == null) { 197 tgt.setValue(ElementDefinition.SlicingRules.NULL); 198 } else { 199 switch (src.getValue()) { 200 case CLOSED: 201 tgt.setValue(ElementDefinition.SlicingRules.CLOSED); 202 break; 203 case OPEN: 204 tgt.setValue(ElementDefinition.SlicingRules.OPEN); 205 break; 206 case OPENATEND: 207 tgt.setValue(ElementDefinition.SlicingRules.OPENATEND); 208 break; 209 default: 210 tgt.setValue(ElementDefinition.SlicingRules.NULL); 211 break; 212 } 213 } 214 return tgt; 215 } 216 217 static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules> convertSlicingRules(org.hl7.fhir.dstu3.model.Enumeration<ElementDefinition.SlicingRules> src) throws FHIRException { 218 if (src == null || src.isEmpty()) return null; 219 org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRulesEnumFactory()); 220 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 221 if (src.getValue() == null) { 222 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.NULL); 223 } else { 224 switch (src.getValue()) { 225 case CLOSED: 226 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.CLOSED); 227 break; 228 case OPEN: 229 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.OPEN); 230 break; 231 case OPENATEND: 232 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.OPENATEND); 233 break; 234 default: 235 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.NULL); 236 break; 237 } 238 } 239 return tgt; 240 } 241 242 public static ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { 243 if (src == null || src.isEmpty()) return null; 244 ElementDefinition.ElementDefinitionBaseComponent tgt = new ElementDefinition.ElementDefinitionBaseComponent(); 245 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 246 if (src.hasPathElement()) tgt.setPathElement(String14_30.convertString(src.getPathElement())); 247 tgt.setMin(src.getMin()); 248 if (src.hasMaxElement()) tgt.setMaxElement(String14_30.convertString(src.getMaxElement())); 249 return tgt; 250 } 251 252 public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { 253 if (src == null || src.isEmpty()) return null; 254 org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent(); 255 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 256 if (src.hasPathElement()) tgt.setPathElement(String14_30.convertString(src.getPathElement())); 257 tgt.setMin(src.getMin()); 258 if (src.hasMaxElement()) tgt.setMaxElement(String14_30.convertString(src.getMaxElement())); 259 return tgt; 260 } 261 262 public static ElementDefinition.TypeRefComponent convertTypeRefComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent src) throws FHIRException { 263 if (src == null || src.isEmpty()) return null; 264 ElementDefinition.TypeRefComponent tgt = new ElementDefinition.TypeRefComponent(); 265 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 266 tgt.setCode(src.getCode()); 267 for (org.hl7.fhir.dstu2016may.model.UriType u : src.getProfile()) { 268 if (src.getCode().equals("Reference")) tgt.setTargetProfile(u.getValue()); 269 else tgt.setProfile(u.getValue()); 270 } 271 for (org.hl7.fhir.dstu2016may.model.Extension t : src.getExtensionsByUrl(VersionConvertorConstants.PROFILE_EXTENSION)) { 272 String s = ((org.hl7.fhir.dstu2016may.model.PrimitiveType<String>) t.getValue()).getValue(); 273 tgt.setProfile(s); 274 } 275 tgt.setAggregation(src.getAggregation().stream().map(ElementDefinition14_30::convertAggregationMode).collect(Collectors.toList())); 276 if (src.hasVersioning()) tgt.setVersioningElement(convertReferenceVersionRules(src.getVersioningElement())); 277 return tgt; 278 } 279 280 public static org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent convertTypeRefComponent(ElementDefinition.TypeRefComponent src) throws FHIRException { 281 if (src == null || src.isEmpty()) return null; 282 org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent(); 283 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 284 tgt.setCode(src.getCode()); 285 if (src.hasTarget()) { 286 if (src.hasTargetProfile()) { 287 tgt.addProfile(src.getTargetProfile()); 288 } 289 if (src.hasProfile()) { 290 if (src.getCode().equals("Reference")) { 291 org.hl7.fhir.dstu2016may.model.Extension t = new org.hl7.fhir.dstu2016may.model.Extension(VersionConvertorConstants.PROFILE_EXTENSION); 292 t.setValue(new org.hl7.fhir.dstu2016may.model.StringType(src.getProfile())); 293 tgt.addExtension(t); 294 } else tgt.addProfile(src.getProfile()); 295 } 296 } else tgt.addProfile(src.getProfile()); 297 tgt.setAggregation(src.getAggregation().stream().map(ElementDefinition14_30::convertAggregationMode).collect(Collectors.toList())); 298 if (src.hasVersioning()) tgt.setVersioningElement(convertReferenceVersionRules(src.getVersioningElement())); 299 return tgt; 300 } 301 302 static public org.hl7.fhir.dstu3.model.Enumeration<ElementDefinition.AggregationMode> convertAggregationMode(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode> src) throws FHIRException { 303 if (src == null || src.isEmpty()) return null; 304 org.hl7.fhir.dstu3.model.Enumeration<ElementDefinition.AggregationMode> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new ElementDefinition.AggregationModeEnumFactory()); 305 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 306 if (src.getValue() == null) { 307 tgt.setValue(ElementDefinition.AggregationMode.NULL); 308 } else { 309 switch (src.getValue()) { 310 case CONTAINED: 311 tgt.setValue(ElementDefinition.AggregationMode.CONTAINED); 312 break; 313 case REFERENCED: 314 tgt.setValue(ElementDefinition.AggregationMode.REFERENCED); 315 break; 316 case BUNDLED: 317 tgt.setValue(ElementDefinition.AggregationMode.BUNDLED); 318 break; 319 default: 320 tgt.setValue(ElementDefinition.AggregationMode.NULL); 321 break; 322 } 323 } 324 return tgt; 325 } 326 327 static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode> convertAggregationMode(org.hl7.fhir.dstu3.model.Enumeration<ElementDefinition.AggregationMode> src) throws FHIRException { 328 if (src == null || src.isEmpty()) return null; 329 org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationModeEnumFactory()); 330 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 331 if (src.getValue() == null) { 332 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.NULL); 333 } else { 334 switch (src.getValue()) { 335 case CONTAINED: 336 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.CONTAINED); 337 break; 338 case REFERENCED: 339 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.REFERENCED); 340 break; 341 case BUNDLED: 342 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.BUNDLED); 343 break; 344 default: 345 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.NULL); 346 break; 347 } 348 } 349 return tgt; 350 } 351 352 static public org.hl7.fhir.dstu3.model.Enumeration<ElementDefinition.ReferenceVersionRules> convertReferenceVersionRules(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules> src) throws FHIRException { 353 if (src == null || src.isEmpty()) return null; 354 org.hl7.fhir.dstu3.model.Enumeration<ElementDefinition.ReferenceVersionRules> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new ElementDefinition.ReferenceVersionRulesEnumFactory()); 355 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 356 if (src.getValue() == null) { 357 tgt.setValue(ElementDefinition.ReferenceVersionRules.NULL); 358 } else { 359 switch (src.getValue()) { 360 case EITHER: 361 tgt.setValue(ElementDefinition.ReferenceVersionRules.EITHER); 362 break; 363 case INDEPENDENT: 364 tgt.setValue(ElementDefinition.ReferenceVersionRules.INDEPENDENT); 365 break; 366 case SPECIFIC: 367 tgt.setValue(ElementDefinition.ReferenceVersionRules.SPECIFIC); 368 break; 369 default: 370 tgt.setValue(ElementDefinition.ReferenceVersionRules.NULL); 371 break; 372 } 373 } 374 return tgt; 375 } 376 377 static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules> convertReferenceVersionRules(org.hl7.fhir.dstu3.model.Enumeration<ElementDefinition.ReferenceVersionRules> src) throws FHIRException { 378 if (src == null || src.isEmpty()) return null; 379 org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRulesEnumFactory()); 380 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 381 if (src.getValue() == null) { 382 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.NULL); 383 } else { 384 switch (src.getValue()) { 385 case EITHER: 386 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.EITHER); 387 break; 388 case INDEPENDENT: 389 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT); 390 break; 391 case SPECIFIC: 392 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.SPECIFIC); 393 break; 394 default: 395 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.NULL); 396 break; 397 } 398 } 399 return tgt; 400 } 401 402 public static ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { 403 if (src == null || src.isEmpty()) return null; 404 ElementDefinition.ElementDefinitionConstraintComponent tgt = new ElementDefinition.ElementDefinitionConstraintComponent(); 405 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 406 if (src.hasKeyElement()) tgt.setKeyElement(Id14_30.convertId(src.getKeyElement())); 407 if (src.hasRequirements()) tgt.setRequirementsElement(String14_30.convertString(src.getRequirementsElement())); 408 if (src.hasSeverity()) tgt.setSeverityElement(convertConstraintSeverity(src.getSeverityElement())); 409 if (src.hasHumanElement()) tgt.setHumanElement(String14_30.convertString(src.getHumanElement())); 410 if (src.hasExpression()) tgt.setExpressionElement(String14_30.convertString(src.getExpressionElement())); 411 if (src.hasXpathElement()) tgt.setXpathElement(String14_30.convertString(src.getXpathElement())); 412 return tgt; 413 } 414 415 public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { 416 if (src == null || src.isEmpty()) return null; 417 org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent(); 418 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 419 if (src.hasKeyElement()) tgt.setKeyElement(Id14_30.convertId(src.getKeyElement())); 420 if (src.hasRequirements()) tgt.setRequirementsElement(String14_30.convertString(src.getRequirementsElement())); 421 if (src.hasSeverity()) tgt.setSeverityElement(convertConstraintSeverity(src.getSeverityElement())); 422 if (src.hasHumanElement()) tgt.setHumanElement(String14_30.convertString(src.getHumanElement())); 423 if (src.hasExpression()) tgt.setExpressionElement(String14_30.convertString(src.getExpressionElement())); 424 if (src.hasXpathElement()) tgt.setXpathElement(String14_30.convertString(src.getXpathElement())); 425 return tgt; 426 } 427 428 static public org.hl7.fhir.dstu3.model.Enumeration<ElementDefinition.ConstraintSeverity> convertConstraintSeverity(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity> src) throws FHIRException { 429 if (src == null || src.isEmpty()) return null; 430 org.hl7.fhir.dstu3.model.Enumeration<ElementDefinition.ConstraintSeverity> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new ElementDefinition.ConstraintSeverityEnumFactory()); 431 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 432 if (src.getValue() == null) { 433 tgt.setValue(ElementDefinition.ConstraintSeverity.NULL); 434 } else { 435 switch (src.getValue()) { 436 case ERROR: 437 tgt.setValue(ElementDefinition.ConstraintSeverity.ERROR); 438 break; 439 case WARNING: 440 tgt.setValue(ElementDefinition.ConstraintSeverity.WARNING); 441 break; 442 default: 443 tgt.setValue(ElementDefinition.ConstraintSeverity.NULL); 444 break; 445 } 446 } 447 return tgt; 448 } 449 450 static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity> convertConstraintSeverity(org.hl7.fhir.dstu3.model.Enumeration<ElementDefinition.ConstraintSeverity> src) throws FHIRException { 451 if (src == null || src.isEmpty()) return null; 452 org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverityEnumFactory()); 453 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 454 if (src.getValue() == null) { 455 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.NULL); 456 } else { 457 switch (src.getValue()) { 458 case ERROR: 459 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.ERROR); 460 break; 461 case WARNING: 462 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.WARNING); 463 break; 464 default: 465 tgt.setValue(org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.NULL); 466 break; 467 } 468 } 469 return tgt; 470 } 471 472 public static ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { 473 if (src == null || src.isEmpty()) return null; 474 ElementDefinition.ElementDefinitionBindingComponent tgt = new ElementDefinition.ElementDefinitionBindingComponent(); 475 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 476 if (src.hasStrength()) tgt.setStrengthElement(Enumerations14_30.convertBindingStrength(src.getStrengthElement())); 477 if (src.hasDescription()) tgt.setDescriptionElement(String14_30.convertString(src.getDescriptionElement())); 478 if (src.hasValueSet()) 479 tgt.setValueSet(ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().convertType(src.getValueSet())); 480 return tgt; 481 } 482 483 public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { 484 if (src == null || src.isEmpty()) return null; 485 org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent(); 486 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 487 if (src.hasStrength()) tgt.setStrengthElement(Enumerations14_30.convertBindingStrength(src.getStrengthElement())); 488 if (src.hasDescription()) tgt.setDescriptionElement(String14_30.convertString(src.getDescriptionElement())); 489 if (src.hasValueSet()) 490 tgt.setValueSet(ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().convertType(src.getValueSet())); 491 return tgt; 492 } 493 494 public static ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { 495 if (src == null || src.isEmpty()) return null; 496 ElementDefinition.ElementDefinitionMappingComponent tgt = new ElementDefinition.ElementDefinitionMappingComponent(); 497 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 498 if (src.hasIdentityElement()) tgt.setIdentityElement(Id14_30.convertId(src.getIdentityElement())); 499 if (src.hasLanguage()) tgt.setLanguageElement(Code14_30.convertCode(src.getLanguageElement())); 500 if (src.hasMapElement()) tgt.setMapElement(String14_30.convertString(src.getMapElement())); 501 return tgt; 502 } 503 504 public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { 505 if (src == null || src.isEmpty()) return null; 506 org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent(); 507 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 508 if (src.hasIdentityElement()) tgt.setIdentityElement(Id14_30.convertId(src.getIdentityElement())); 509 if (src.hasLanguage()) tgt.setLanguageElement(Code14_30.convertCode(src.getLanguageElement())); 510 if (src.hasMapElement()) tgt.setMapElement(String14_30.convertString(src.getMapElement())); 511 return tgt; 512 } 513}