001package org.hl7.fhir.convertors.conv14_30.resources14_30; 002 003import org.hl7.fhir.convertors.context.ConversionContext14_30; 004import org.hl7.fhir.convertors.conv14_30.VersionConvertor_14_30; 005import org.hl7.fhir.convertors.conv14_30.datatypes14_30.ElementDefinition14_30; 006import org.hl7.fhir.convertors.conv14_30.datatypes14_30.complextypes14_30.CodeableConcept14_30; 007import org.hl7.fhir.convertors.conv14_30.datatypes14_30.complextypes14_30.ContactPoint14_30; 008import org.hl7.fhir.convertors.conv14_30.datatypes14_30.complextypes14_30.Identifier14_30; 009import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.Boolean14_30; 010import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.Code14_30; 011import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.DateTime14_30; 012import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.Id14_30; 013import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.String14_30; 014import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.Uri14_30; 015import org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule; 016import org.hl7.fhir.exceptions.FHIRException; 017 018public class StructureDefinition14_30 { 019 020 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext> convertExtensionContext(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext> src) throws FHIRException { 021 if (src == null || src.isEmpty()) 022 return null; 023 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContextEnumFactory()); 024 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 025 switch (src.getValue()) { 026 case RESOURCE: 027 tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE); 028 break; 029 case DATATYPE: 030 tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE); 031 break; 032 case EXTENSION: 033 tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION); 034 break; 035 default: 036 tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL); 037 break; 038 } 039 return tgt; 040 } 041 042 static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext> convertExtensionContext(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext> src) throws FHIRException { 043 if (src == null || src.isEmpty()) 044 return null; 045 org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContextEnumFactory()); 046 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 047 switch (src.getValue()) { 048 case RESOURCE: 049 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE); 050 break; 051 case DATATYPE: 052 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.DATATYPE); 053 break; 054 case EXTENSION: 055 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.EXTENSION); 056 break; 057 default: 058 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.NULL); 059 break; 060 } 061 return tgt; 062 } 063 064 public static org.hl7.fhir.dstu2016may.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu3.model.StructureDefinition src) throws FHIRException { 065 if (src == null || src.isEmpty()) 066 return null; 067 org.hl7.fhir.dstu2016may.model.StructureDefinition tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition(); 068 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyDomainResource(src, tgt); 069 if (src.hasUrl()) 070 tgt.setUrlElement(Uri14_30.convertUri(src.getUrlElement())); 071 for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) 072 tgt.addIdentifier(Identifier14_30.convertIdentifier(t)); 073 if (src.hasVersion()) 074 tgt.setVersionElement(String14_30.convertString(src.getVersionElement())); 075 if (src.hasNameElement()) 076 tgt.setNameElement(String14_30.convertString(src.getNameElement())); 077 if (src.hasTitle()) 078 tgt.setDisplayElement(String14_30.convertString(src.getTitleElement())); 079 if (src.hasStatus()) 080 tgt.setStatusElement(Enumerations14_30.convertConformanceResourceStatus(src.getStatusElement())); 081 if (src.hasExperimental()) 082 tgt.setExperimentalElement(Boolean14_30.convertBoolean(src.getExperimentalElement())); 083 if (src.hasPublisher()) 084 tgt.setPublisherElement(String14_30.convertString(src.getPublisherElement())); 085 for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) 086 tgt.addContact(convertStructureDefinitionContactComponent(t)); 087 if (src.hasDate()) 088 tgt.setDateElement(DateTime14_30.convertDateTime(src.getDateElement())); 089 if (src.hasDescription()) 090 tgt.setDescription(src.getDescription()); 091 for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) 092 if (t.hasValueCodeableConcept()) 093 tgt.addUseContext(CodeableConcept14_30.convertCodeableConcept(t.getValueCodeableConcept())); 094 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) 095 tgt.addUseContext(CodeableConcept14_30.convertCodeableConcept(t)); 096 if (src.hasPurpose()) 097 tgt.setRequirements(src.getPurpose()); 098 if (src.hasCopyright()) 099 tgt.setCopyright(src.getCopyright()); 100 for (org.hl7.fhir.dstu3.model.Coding t : src.getKeyword()) tgt.addCode(Code14_30.convertCoding(t)); 101 if (src.hasFhirVersion()) 102 tgt.setFhirVersionElement(Id14_30.convertId(src.getFhirVersionElement())); 103 for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) 104 tgt.addMapping(convertStructureDefinitionMappingComponent(t)); 105 if (src.hasKind()) 106 tgt.setKindElement(convertStructureDefinitionKind(src.getKindElement())); 107 if (src.hasAbstractElement()) 108 tgt.setAbstractElement(Boolean14_30.convertBoolean(src.getAbstractElement())); 109 if (src.hasContextType()) 110 tgt.setContextTypeElement(convertExtensionContext(src.getContextTypeElement())); 111 for (org.hl7.fhir.dstu3.model.StringType t : src.getContext()) tgt.addContext(t.getValue()); 112 if (src.hasBaseDefinition()) 113 tgt.setBaseDefinitionElement(Uri14_30.convertUri(src.getBaseDefinitionElement())); 114 if (src.hasType() && src.getDerivation() == org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT) 115 tgt.setBaseTypeElement(Code14_30.convertCode(src.getTypeElement())); 116 if (src.hasDerivation()) 117 tgt.setDerivationElement(convertTypeDerivationRule(src.getDerivationElement())); 118 if (src.hasSnapshot()) 119 tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); 120 if (src.hasDifferential()) 121 tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); 122 return tgt; 123 } 124 125 public static org.hl7.fhir.dstu3.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu2016may.model.StructureDefinition src) throws FHIRException { 126 if (src == null || src.isEmpty()) 127 return null; 128 org.hl7.fhir.dstu3.model.StructureDefinition tgt = new org.hl7.fhir.dstu3.model.StructureDefinition(); 129 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyDomainResource(src, tgt); 130 if (src.hasUrl()) 131 tgt.setUrlElement(Uri14_30.convertUri(src.getUrlElement())); 132 for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) 133 tgt.addIdentifier(Identifier14_30.convertIdentifier(t)); 134 if (src.hasVersion()) 135 tgt.setVersionElement(String14_30.convertString(src.getVersionElement())); 136 if (src.hasNameElement()) 137 tgt.setNameElement(String14_30.convertString(src.getNameElement())); 138 if (src.hasDisplay()) 139 tgt.setTitleElement(String14_30.convertString(src.getDisplayElement())); 140 if (src.hasStatus()) 141 tgt.setStatusElement(Enumerations14_30.convertConformanceResourceStatus(src.getStatusElement())); 142 if (src.hasExperimental()) 143 tgt.setExperimentalElement(Boolean14_30.convertBoolean(src.getExperimentalElement())); 144 if (src.hasPublisher()) 145 tgt.setPublisherElement(String14_30.convertString(src.getPublisherElement())); 146 for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) 147 tgt.addContact(convertStructureDefinitionContactComponent(t)); 148 if (src.hasDate()) 149 tgt.setDateElement(DateTime14_30.convertDateTime(src.getDateElement())); 150 if (src.hasDescription()) 151 tgt.setDescription(src.getDescription()); 152 for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) 153 if (VersionConvertor_14_30.isJurisdiction(t)) 154 tgt.addJurisdiction(CodeableConcept14_30.convertCodeableConcept(t)); 155 else 156 tgt.addUseContext(CodeableConcept14_30.convertCodeableConceptToUsageContext(t)); 157 if (src.hasRequirements()) 158 tgt.setPurpose(src.getRequirements()); 159 if (src.hasCopyright()) 160 tgt.setCopyright(src.getCopyright()); 161 for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) tgt.addKeyword(Code14_30.convertCoding(t)); 162 if (src.hasFhirVersion()) 163 tgt.setFhirVersionElement(Id14_30.convertId(src.getFhirVersionElement())); 164 for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) 165 tgt.addMapping(convertStructureDefinitionMappingComponent(t)); 166 if (src.hasKind()) 167 tgt.setKindElement(convertStructureDefinitionKind(src.getKindElement())); 168 if (src.hasAbstractElement()) 169 tgt.setAbstractElement(Boolean14_30.convertBoolean(src.getAbstractElement())); 170 if (src.hasContextType()) 171 tgt.setContextTypeElement(convertExtensionContext(src.getContextTypeElement())); 172 for (org.hl7.fhir.dstu2016may.model.StringType t : src.getContext()) tgt.addContext(t.getValue()); 173 if (src.getDerivation() == TypeDerivationRule.CONSTRAINT) 174 tgt.setTypeElement(Code14_30.convertCode(src.getBaseTypeElement())); 175 else 176 tgt.setType(src.getId()); 177 if (src.hasBaseDefinition()) 178 tgt.setBaseDefinitionElement(Uri14_30.convertUri(src.getBaseDefinitionElement())); 179 if (src.hasDerivation()) 180 tgt.setDerivationElement(convertTypeDerivationRule(src.getDerivationElement())); 181 if (src.hasSnapshot()) { 182 if (src.hasSnapshot()) 183 tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); 184 tgt.getSnapshot().getElementFirstRep().getType().clear(); 185 } 186 if (src.hasDifferential()) { 187 if (src.hasDifferential()) 188 tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); 189 tgt.getDifferential().getElementFirstRep().getType().clear(); 190 } 191 return tgt; 192 } 193 194 public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { 195 if (src == null || src.isEmpty()) 196 return null; 197 org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent(); 198 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 199 if (src.hasName()) 200 tgt.setNameElement(String14_30.convertString(src.getNameElement())); 201 for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) 202 tgt.addTelecom(ContactPoint14_30.convertContactPoint(t)); 203 return tgt; 204 } 205 206 public static org.hl7.fhir.dstu3.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { 207 if (src == null || src.isEmpty()) 208 return null; 209 org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); 210 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 211 if (src.hasName()) 212 tgt.setNameElement(String14_30.convertString(src.getNameElement())); 213 for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) 214 tgt.addTelecom(ContactPoint14_30.convertContactPoint(t)); 215 return tgt; 216 } 217 218 public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { 219 if (src == null || src.isEmpty()) 220 return null; 221 org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent(); 222 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt); 223 for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) 224 tgt.addElement(ElementDefinition14_30.convertElementDefinition(t)); 225 return tgt; 226 } 227 228 public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { 229 if (src == null || src.isEmpty()) 230 return null; 231 org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent(); 232 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt); 233 for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) 234 tgt.addElement(ElementDefinition14_30.convertElementDefinition(t)); 235 return tgt; 236 } 237 238 static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind> convertStructureDefinitionKind(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind> src) throws FHIRException { 239 if (src == null || src.isEmpty()) 240 return null; 241 org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKindEnumFactory()); 242 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 243 switch (src.getValue()) { 244 case PRIMITIVETYPE: 245 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE); 246 break; 247 case COMPLEXTYPE: 248 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE); 249 break; 250 case RESOURCE: 251 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.RESOURCE); 252 break; 253 case LOGICAL: 254 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.LOGICAL); 255 break; 256 default: 257 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.NULL); 258 break; 259 } 260 return tgt; 261 } 262 263 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind> convertStructureDefinitionKind(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind> src) throws FHIRException { 264 if (src == null || src.isEmpty()) 265 return null; 266 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKindEnumFactory()); 267 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 268 switch (src.getValue()) { 269 case DATATYPE: 270 tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE); 271 break; 272 case RESOURCE: 273 tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.RESOURCE); 274 break; 275 case LOGICAL: 276 tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.LOGICAL); 277 break; 278 default: 279 tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.NULL); 280 break; 281 } 282 return tgt; 283 } 284 285 public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { 286 if (src == null || src.isEmpty()) 287 return null; 288 org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent(); 289 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt); 290 if (src.hasIdentityElement()) 291 tgt.setIdentityElement(Id14_30.convertId(src.getIdentityElement())); 292 if (src.hasUri()) 293 tgt.setUriElement(Uri14_30.convertUri(src.getUriElement())); 294 if (src.hasName()) 295 tgt.setNameElement(String14_30.convertString(src.getNameElement())); 296 if (src.hasComments()) 297 tgt.setCommentElement(String14_30.convertString(src.getCommentsElement())); 298 return tgt; 299 } 300 301 public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { 302 if (src == null || src.isEmpty()) 303 return null; 304 org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent(); 305 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt); 306 if (src.hasIdentityElement()) 307 tgt.setIdentityElement(Id14_30.convertId(src.getIdentityElement())); 308 if (src.hasUri()) 309 tgt.setUriElement(Uri14_30.convertUri(src.getUriElement())); 310 if (src.hasName()) 311 tgt.setNameElement(String14_30.convertString(src.getNameElement())); 312 if (src.hasComment()) 313 tgt.setCommentsElement(String14_30.convertString(src.getCommentElement())); 314 return tgt; 315 } 316 317 public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { 318 if (src == null || src.isEmpty()) 319 return null; 320 org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent(); 321 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt); 322 for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) 323 tgt.addElement(ElementDefinition14_30.convertElementDefinition(t)); 324 return tgt; 325 } 326 327 public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { 328 if (src == null || src.isEmpty()) 329 return null; 330 org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent(); 331 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt); 332 for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) 333 tgt.addElement(ElementDefinition14_30.convertElementDefinition(t)); 334 return tgt; 335 } 336 337 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule> convertTypeDerivationRule(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule> src) throws FHIRException { 338 if (src == null || src.isEmpty()) 339 return null; 340 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRuleEnumFactory()); 341 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 342 switch (src.getValue()) { 343 case SPECIALIZATION: 344 tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); 345 break; 346 case CONSTRAINT: 347 tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT); 348 break; 349 default: 350 tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.NULL); 351 break; 352 } 353 return tgt; 354 } 355 356 static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule> convertTypeDerivationRule(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule> src) throws FHIRException { 357 if (src == null || src.isEmpty()) 358 return null; 359 org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRuleEnumFactory()); 360 ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt); 361 switch (src.getValue()) { 362 case SPECIALIZATION: 363 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); 364 break; 365 case CONSTRAINT: 366 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.CONSTRAINT); 367 break; 368 default: 369 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.NULL); 370 break; 371 } 372 return tgt; 373 } 374}