001package org.hl7.fhir.convertors.conv14_40.resources14_40; 002 003import org.hl7.fhir.convertors.context.ConversionContext14_40; 004import org.hl7.fhir.convertors.conv14_40.VersionConvertor_14_40; 005import org.hl7.fhir.convertors.conv14_40.datatypes14_40.ElementDefinition14_40; 006import org.hl7.fhir.convertors.conv14_40.datatypes14_40.complextypes14_40.CodeableConcept14_40; 007import org.hl7.fhir.convertors.conv14_40.datatypes14_40.complextypes14_40.Coding14_40; 008import org.hl7.fhir.convertors.conv14_40.datatypes14_40.complextypes14_40.ContactPoint14_40; 009import org.hl7.fhir.convertors.conv14_40.datatypes14_40.complextypes14_40.Identifier14_40; 010import org.hl7.fhir.convertors.conv14_40.datatypes14_40.primitivetypes14_40.*; 011import org.hl7.fhir.exceptions.FHIRException; 012import org.hl7.fhir.r4.model.ElementDefinition; 013import org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule; 014import org.hl7.fhir.utilities.Utilities; 015 016public class StructureDefinition14_40 { 017 018 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType> convertExtensionContext(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext> src) throws FHIRException { 019 if (src == null || src.isEmpty()) 020 return null; 021 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextTypeEnumFactory()); 022 ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt); 023 switch (src.getValue()) { 024 case RESOURCE: 025 tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT); 026 break; 027 case DATATYPE: 028 tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT); 029 break; 030 case EXTENSION: 031 tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.EXTENSION); 032 break; 033 default: 034 tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.NULL); 035 break; 036 } 037 return tgt; 038 } 039 040 static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext> convertExtensionContext(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType> src, String expression) throws FHIRException { 041 if (src == null || src.isEmpty()) 042 return null; 043 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()); 044 ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt); 045 switch (src.getValue()) { 046 case FHIRPATH: 047 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE); 048 break; 049 case ELEMENT: 050 String tn = expression.contains(".") ? expression.substring(0, expression.indexOf(".")) : expression; 051 if (isResource140(tn)) { 052 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE); 053 } else { 054 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.DATATYPE); 055 } 056 break; 057 case EXTENSION: 058 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.EXTENSION); 059 break; 060 default: 061 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.NULL); 062 break; 063 } 064 return tgt; 065 } 066 067 public static org.hl7.fhir.dstu2016may.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r4.model.StructureDefinition src) throws FHIRException { 068 if (src == null || src.isEmpty()) 069 return null; 070 org.hl7.fhir.dstu2016may.model.StructureDefinition tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition(); 071 ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyDomainResource(src, tgt); 072 if (src.hasUrl()) 073 tgt.setUrlElement(Uri14_40.convertUri(src.getUrlElement())); 074 for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) 075 tgt.addIdentifier(Identifier14_40.convertIdentifier(t)); 076 if (src.hasVersion()) 077 tgt.setVersionElement(String14_40.convertString(src.getVersionElement())); 078 if (src.hasNameElement()) 079 tgt.setNameElement(String14_40.convertString(src.getNameElement())); 080 if (src.hasTitle()) 081 tgt.setDisplayElement(String14_40.convertString(src.getTitleElement())); 082 if (src.hasStatus()) 083 tgt.setStatusElement(Enumerations14_40.convertConformanceResourceStatus(src.getStatusElement())); 084 if (src.hasExperimental()) 085 tgt.setExperimentalElement(Boolean14_40.convertBoolean(src.getExperimentalElement())); 086 if (src.hasPublisher()) 087 tgt.setPublisherElement(String14_40.convertString(src.getPublisherElement())); 088 for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) 089 tgt.addContact(convertStructureDefinitionContactComponent(t)); 090 if (src.hasDate()) 091 tgt.setDateElement(DateTime14_40.convertDateTime(src.getDateElement())); 092 if (src.hasDescription()) 093 tgt.setDescription(src.getDescription()); 094 for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) 095 if (t.hasValueCodeableConcept()) 096 tgt.addUseContext(CodeableConcept14_40.convertCodeableConcept(t.getValueCodeableConcept())); 097 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) 098 tgt.addUseContext(CodeableConcept14_40.convertCodeableConcept(t)); 099 if (src.hasPurpose()) 100 tgt.setRequirements(src.getPurpose()); 101 if (src.hasCopyright()) 102 tgt.setCopyright(src.getCopyright()); 103 for (org.hl7.fhir.r4.model.Coding t : src.getKeyword()) tgt.addCode(Coding14_40.convertCoding(t)); 104 if (src.hasFhirVersion()) 105 tgt.setFhirVersion(src.getFhirVersion().toCode()); 106 for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) 107 tgt.addMapping(convertStructureDefinitionMappingComponent(t)); 108 if (src.hasKind()) 109 tgt.setKindElement(convertStructureDefinitionKind(src.getKindElement())); 110 if (src.hasAbstractElement()) 111 tgt.setAbstractElement(Boolean14_40.convertBoolean(src.getAbstractElement())); 112 for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { 113 if (!tgt.hasContextType()) 114 tgt.setContextTypeElement(convertExtensionContext(t.getTypeElement(), t.getExpression())); 115 tgt.addContext("Element".equals(t.getExpression()) ? "*" : t.getExpression()); 116 } 117 if (src.hasBaseDefinition()) 118 tgt.setBaseDefinition(src.getBaseDefinition()); 119 if (src.hasType() && src.getDerivation() == org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.CONSTRAINT) 120 tgt.setBaseType(src.getType()); 121 if (src.hasDerivation()) 122 tgt.setDerivationElement(convertTypeDerivationRule(src.getDerivationElement())); 123 if (src.hasSnapshot()) 124 tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); 125 if (src.hasDifferential()) 126 tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); 127 return tgt; 128 } 129 130 public static org.hl7.fhir.r4.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu2016may.model.StructureDefinition src) throws FHIRException { 131 if (src == null || src.isEmpty()) 132 return null; 133 org.hl7.fhir.r4.model.StructureDefinition tgt = new org.hl7.fhir.r4.model.StructureDefinition(); 134 ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyDomainResource(src, tgt); 135 if (src.hasUrl()) 136 tgt.setUrlElement(Uri14_40.convertUri(src.getUrlElement())); 137 for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) 138 tgt.addIdentifier(Identifier14_40.convertIdentifier(t)); 139 if (src.hasVersion()) 140 tgt.setVersionElement(String14_40.convertString(src.getVersionElement())); 141 if (src.hasNameElement()) 142 tgt.setNameElement(String14_40.convertString(src.getNameElement())); 143 if (src.hasDisplay()) 144 tgt.setTitleElement(String14_40.convertString(src.getDisplayElement())); 145 if (src.hasStatus()) 146 tgt.setStatusElement(Enumerations14_40.convertConformanceResourceStatus(src.getStatusElement())); 147 if (src.hasExperimental()) 148 tgt.setExperimentalElement(Boolean14_40.convertBoolean(src.getExperimentalElement())); 149 if (src.hasPublisher()) 150 tgt.setPublisherElement(String14_40.convertString(src.getPublisherElement())); 151 for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) 152 tgt.addContact(convertStructureDefinitionContactComponent(t)); 153 if (src.hasDate()) 154 tgt.setDateElement(DateTime14_40.convertDateTime(src.getDateElement())); 155 if (src.hasDescription()) 156 tgt.setDescription(src.getDescription()); 157 for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) 158 if (VersionConvertor_14_40.isJurisdiction(t)) 159 tgt.addJurisdiction(CodeableConcept14_40.convertCodeableConcept(t)); 160 else 161 tgt.addUseContext(CodeableConcept14_40.convertCodeableConceptToUsageContext(t)); 162 if (src.hasRequirements()) 163 tgt.setPurpose(src.getRequirements()); 164 if (src.hasCopyright()) 165 tgt.setCopyright(src.getCopyright()); 166 for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) tgt.addKeyword(Coding14_40.convertCoding(t)); 167 if (src.hasFhirVersion()) 168 tgt.setFhirVersion(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); 169 for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) 170 tgt.addMapping(convertStructureDefinitionMappingComponent(t)); 171 if (src.hasKind()) 172 tgt.setKindElement(convertStructureDefinitionKind(src.getKindElement(), src.getName())); 173 if (src.hasAbstractElement()) 174 tgt.setAbstractElement(Boolean14_40.convertBoolean(src.getAbstractElement())); 175 for (org.hl7.fhir.dstu2016may.model.StringType t : src.getContext()) { 176 org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent ec = tgt.addContext(); 177 ec.setTypeElement(convertExtensionContext(src.getContextTypeElement())); 178 ec.setExpression("*".equals(t.getValue()) ? "Element" : t.getValue()); 179 } 180 if (src.getDerivation() == org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.CONSTRAINT) 181 tgt.setType(src.getBaseType()); 182 else 183 tgt.setType(src.getId()); 184 if (src.hasBaseDefinition()) 185 tgt.setBaseDefinition(src.getBaseDefinition()); 186 if (src.hasDerivation()) 187 tgt.setDerivationElement(convertTypeDerivationRule(src.getDerivationElement())); 188 if (src.hasSnapshot()) { 189 if (src.hasSnapshot()) 190 tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); 191 tgt.getSnapshot().getElementFirstRep().getType().clear(); 192 } 193 if (src.hasDifferential()) { 194 if (src.hasDifferential()) 195 tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); 196 tgt.getDifferential().getElementFirstRep().getType().clear(); 197 } 198 if (tgt.getDerivation() == TypeDerivationRule.SPECIALIZATION) { 199 for (ElementDefinition ed : tgt.getSnapshot().getElement()) { 200 if (!ed.hasBase()) { 201 ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax()); 202 } 203 } 204 } 205 return tgt; 206 } 207 208 public static org.hl7.fhir.r4.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { 209 if (src == null || src.isEmpty()) 210 return null; 211 org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); 212 ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt); 213 if (src.hasName()) 214 tgt.setNameElement(String14_40.convertString(src.getNameElement())); 215 for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) 216 tgt.addTelecom(ContactPoint14_40.convertContactPoint(t)); 217 return tgt; 218 } 219 220 public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { 221 if (src == null || src.isEmpty()) 222 return null; 223 org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent(); 224 ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt); 225 if (src.hasName()) 226 tgt.setNameElement(String14_40.convertString(src.getNameElement())); 227 for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) 228 tgt.addTelecom(ContactPoint14_40.convertContactPoint(t)); 229 return tgt; 230 } 231 232 public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { 233 if (src == null || src.isEmpty()) 234 return null; 235 org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent(); 236 ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt); 237 for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) 238 tgt.addElement(ElementDefinition14_40.convertElementDefinition(t)); 239 return tgt; 240 } 241 242 public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { 243 if (src == null || src.isEmpty()) 244 return null; 245 org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent(); 246 ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt); 247 for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) 248 tgt.addElement(ElementDefinition14_40.convertElementDefinition(t, src.getElement(), src.getElement().indexOf(t))); 249 return tgt; 250 } 251 252 static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind> convertStructureDefinitionKind(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind> src) throws FHIRException { 253 if (src == null || src.isEmpty()) 254 return null; 255 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()); 256 ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt); 257 switch (src.getValue()) { 258 case PRIMITIVETYPE: 259 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE); 260 break; 261 case COMPLEXTYPE: 262 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE); 263 break; 264 case RESOURCE: 265 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.RESOURCE); 266 break; 267 case LOGICAL: 268 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.LOGICAL); 269 break; 270 default: 271 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.NULL); 272 break; 273 } 274 return tgt; 275 } 276 277 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind> convertStructureDefinitionKind(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind> src, String name) throws FHIRException { 278 if (src == null || src.isEmpty()) 279 return null; 280 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKindEnumFactory()); 281 ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt); 282 switch (src.getValue()) { 283 case DATATYPE: 284 if (name.substring(0, 1).toLowerCase().equals(name.substring(0, 1))) { 285 tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE); 286 } else { 287 tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE); 288 } 289 break; 290 case RESOURCE: 291 tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.RESOURCE); 292 break; 293 case LOGICAL: 294 tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.LOGICAL); 295 break; 296 default: 297 tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.NULL); 298 break; 299 } 300 return tgt; 301 } 302 303 public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { 304 if (src == null || src.isEmpty()) 305 return null; 306 org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent(); 307 ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt); 308 if (src.hasIdentityElement()) 309 tgt.setIdentityElement(Id14_40.convertId(src.getIdentityElement())); 310 if (src.hasUri()) 311 tgt.setUriElement(Uri14_40.convertUri(src.getUriElement())); 312 if (src.hasName()) 313 tgt.setNameElement(String14_40.convertString(src.getNameElement())); 314 if (src.hasComment()) 315 tgt.setCommentsElement(String14_40.convertString(src.getCommentElement())); 316 return tgt; 317 } 318 319 public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { 320 if (src == null || src.isEmpty()) 321 return null; 322 org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent(); 323 ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt); 324 if (src.hasIdentityElement()) 325 tgt.setIdentityElement(Id14_40.convertId(src.getIdentityElement())); 326 if (src.hasUri()) 327 tgt.setUriElement(Uri14_40.convertUri(src.getUriElement())); 328 if (src.hasName()) 329 tgt.setNameElement(String14_40.convertString(src.getNameElement())); 330 if (src.hasComments()) 331 tgt.setCommentElement(String14_40.convertString(src.getCommentsElement())); 332 return tgt; 333 } 334 335 public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { 336 if (src == null || src.isEmpty()) 337 return null; 338 org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent(); 339 ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt); 340 for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) 341 tgt.addElement(ElementDefinition14_40.convertElementDefinition(t, src.getElement(), src.getElement().indexOf(t))); 342 return tgt; 343 } 344 345 public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { 346 if (src == null || src.isEmpty()) 347 return null; 348 org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent(); 349 ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt); 350 for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) 351 tgt.addElement(ElementDefinition14_40.convertElementDefinition(t)); 352 return tgt; 353 } 354 355 static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule> convertTypeDerivationRule(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule> src) throws FHIRException { 356 if (src == null || src.isEmpty()) 357 return null; 358 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()); 359 ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt); 360 switch (src.getValue()) { 361 case SPECIALIZATION: 362 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); 363 break; 364 case CONSTRAINT: 365 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.CONSTRAINT); 366 break; 367 default: 368 tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.NULL); 369 break; 370 } 371 return tgt; 372 } 373 374 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule> convertTypeDerivationRule(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule> src) throws FHIRException { 375 if (src == null || src.isEmpty()) 376 return null; 377 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRuleEnumFactory()); 378 ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt); 379 switch (src.getValue()) { 380 case SPECIALIZATION: 381 tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); 382 break; 383 case CONSTRAINT: 384 tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.CONSTRAINT); 385 break; 386 default: 387 tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.NULL); 388 break; 389 } 390 return tgt; 391 } 392 393 static public boolean isResource140(String tn) { 394 return Utilities.existsInList(tn, "Account", "AllergyIntolerance", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodySite", "Bundle", "CarePlan", "CareTeam", "Claim", "ClaimResponse", "ClinicalImpression", "CodeSystem", "Communication", "CommunicationRequest", "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Conformance", "Contract", "Coverage", "DataElement", "DecisionSupportRule", "DecisionSupportServiceModule", "DetectedIssue", "Device", "DeviceComponent", "DeviceMetric", "DeviceUseRequest", "DeviceUseStatement", "DiagnosticOrder", "DiagnosticReport", "DocumentManifest", "DocumentReference", "EligibilityRequest", "EligibilityResponse", "Encounter", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "ExpansionProfile", "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", "Group", "GuidanceResponse", "HealthcareService", "ImagingExcerpt", "ImagingObjectSelection", "ImagingStudy", "Immunization", "ImmunizationRecommendation", "ImplementationGuide", "Library", "Linkage", "List", "Location", "Measure", "MeasureReport", "Media", "Medication", "MedicationAdministration", "MedicationDispense", "MedicationOrder", "MedicationStatement", "MessageHeader", "ModuleDefinition", "NamingSystem", "NutritionOrder", "Observation", "OperationDefinition", "OperationOutcome", "Order", "OrderResponse", "OrderSet", "Organization", "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "Practitioner", "PractitionerRole", "Procedure", "ProcedureRequest", "ProcessRequest", "ProcessResponse", "Protocol", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RiskAssessment", "Schedule", "SearchParameter", "Sequence", "Slot", "Sequence", "Specimen", "StructureDefinition", "StructureMap", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "Task", "TestScript", "ValueSet", "VisionPrescription"); 395 } 396}