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