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