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