001package org.hl7.fhir.convertors.conv30_50.resources30_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext30_50;
004import org.hl7.fhir.convertors.conv30_50.datatypes30_50.ContactDetail30_50;
005import org.hl7.fhir.convertors.conv30_50.datatypes30_50.ElementDefinition30_50;
006import org.hl7.fhir.convertors.conv30_50.datatypes30_50.UsageContext30_50;
007import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.CodeableConcept30_50;
008import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Coding30_50;
009import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Identifier30_50;
010import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.*;
011import org.hl7.fhir.exceptions.FHIRException;
012import org.hl7.fhir.utilities.Utilities;
013
014public class StructureDefinition30_50 {
015
016  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType> convertExtensionContext(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext> src) throws FHIRException {
017    if (src == null || src.isEmpty())
018      return null;
019    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());
020    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
021    switch (src.getValue()) {
022      case RESOURCE:
023        tgt.setValue(org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT);
024        break;
025      case DATATYPE:
026        tgt.setValue(org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT);
027        break;
028      case EXTENSION:
029        tgt.setValue(org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.EXTENSION);
030        break;
031      default:
032        tgt.setValue(org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.NULL);
033        break;
034    }
035    return tgt;
036  }
037
038  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext> convertExtensionContext(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType> src, String expression) throws FHIRException {
039    if (src == null || src.isEmpty())
040      return null;
041    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());
042    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
043    switch (src.getValue()) {
044      case FHIRPATH:
045        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE);
046        break;
047      case ELEMENT:
048        String tn = expression.contains(".") ? expression.substring(0, expression.indexOf(".")) : expression;
049        if (isResource300(tn)) {
050          tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE);
051        } else {
052          tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE);
053        }
054        break;
055      case EXTENSION:
056        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION);
057        break;
058      default:
059        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL);
060        break;
061    }
062    return tgt;
063  }
064
065  public static org.hl7.fhir.r5.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu3.model.StructureDefinition src) throws FHIRException {
066    if (src == null)
067      return null;
068    org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition();
069    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
070    if (src.hasUrl())
071      tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement()));
072    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
073      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
074    if (src.hasVersion())
075      tgt.setVersionElement(String30_50.convertString(src.getVersionElement()));
076    if (src.hasName())
077      tgt.setNameElement(String30_50.convertString(src.getNameElement()));
078    if (src.hasTitle())
079      tgt.setTitleElement(String30_50.convertString(src.getTitleElement()));
080    if (src.hasStatus())
081      tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement()));
082    if (src.hasExperimental())
083      tgt.setExperimentalElement(Boolean30_50.convertBoolean(src.getExperimentalElement()));
084    if (src.hasDate())
085      tgt.setDateElement(DateTime30_50.convertDateTime(src.getDateElement()));
086    if (src.hasPublisher())
087      tgt.setPublisherElement(String30_50.convertString(src.getPublisherElement()));
088    for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact())
089      tgt.addContact(ContactDetail30_50.convertContactDetail(t));
090    if (src.hasDescription())
091      tgt.setDescriptionElement(MarkDown30_50.convertMarkdown(src.getDescriptionElement()));
092    for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext())
093      tgt.addUseContext(UsageContext30_50.convertUsageContext(t));
094    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction())
095      tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept(t));
096    if (src.hasPurpose())
097      tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement()));
098    if (src.hasCopyright())
099      tgt.setCopyrightElement(MarkDown30_50.convertMarkdown(src.getCopyrightElement()));
100    for (org.hl7.fhir.dstu3.model.Coding t : src.getKeyword()) tgt.addKeyword(Coding30_50.convertCoding(t));
101    if (src.hasFhirVersion())
102      tgt.setFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion()));
103    for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping())
104      tgt.addMapping(convertStructureDefinitionMappingComponent(t));
105    if (src.hasKind())
106      tgt.setKindElement(convertStructureDefinitionKind(src.getKindElement()));
107    if (src.hasAbstract())
108      tgt.setAbstractElement(Boolean30_50.convertBoolean(src.getAbstractElement()));
109    for (org.hl7.fhir.dstu3.model.StringType t : src.getContext()) {
110      org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent ec = tgt.addContext();
111      ec.setTypeElement(convertExtensionContext(src.getContextTypeElement()));
112      ec.setExpression("*".equals(t.getValue()) ? "Element" : t.getValue());
113    }
114    for (org.hl7.fhir.dstu3.model.StringType t : src.getContextInvariant()) tgt.addContextInvariant(t.getValue());
115    if (src.hasType())
116      tgt.setType(src.getType());
117    if (src.hasBaseDefinition())
118      tgt.setBaseDefinition(src.getBaseDefinition());
119    if (src.hasDerivation())
120      tgt.setDerivationElement(convertTypeDerivationRule(src.getDerivationElement()));
121    if (src.hasSnapshot())
122      tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot()));
123    if (src.hasDifferential())
124      tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential()));
125    if (tgt.getDerivation() == org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION) {
126      for (org.hl7.fhir.r5.model.ElementDefinition ed : tgt.getSnapshot().getElement()) {
127        if (!ed.hasBase()) {
128          ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax());
129        }
130      }
131    }
132    return tgt;
133  }
134
135  public static org.hl7.fhir.dstu3.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r5.model.StructureDefinition src) throws FHIRException {
136    if (src == null)
137      return null;
138    org.hl7.fhir.dstu3.model.StructureDefinition tgt = new org.hl7.fhir.dstu3.model.StructureDefinition();
139    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
140    if (src.hasUrl())
141      tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement()));
142    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
143      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
144    if (src.hasVersion())
145      tgt.setVersionElement(String30_50.convertString(src.getVersionElement()));
146    if (src.hasName())
147      tgt.setNameElement(String30_50.convertString(src.getNameElement()));
148    if (src.hasTitle())
149      tgt.setTitleElement(String30_50.convertString(src.getTitleElement()));
150    if (src.hasStatus())
151      tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement()));
152    if (src.hasExperimental())
153      tgt.setExperimentalElement(Boolean30_50.convertBoolean(src.getExperimentalElement()));
154    if (src.hasDate())
155      tgt.setDateElement(DateTime30_50.convertDateTime(src.getDateElement()));
156    if (src.hasPublisher())
157      tgt.setPublisherElement(String30_50.convertString(src.getPublisherElement()));
158    for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact())
159      tgt.addContact(ContactDetail30_50.convertContactDetail(t));
160    if (src.hasDescription())
161      tgt.setDescriptionElement(MarkDown30_50.convertMarkdown(src.getDescriptionElement()));
162    for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext())
163      tgt.addUseContext(UsageContext30_50.convertUsageContext(t));
164    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction())
165      tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept(t));
166    if (src.hasPurpose())
167      tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement()));
168    if (src.hasCopyright())
169      tgt.setCopyrightElement(MarkDown30_50.convertMarkdown(src.getCopyrightElement()));
170    for (org.hl7.fhir.r5.model.Coding t : src.getKeyword()) tgt.addKeyword(Coding30_50.convertCoding(t));
171    if (src.hasFhirVersion())
172      tgt.setFhirVersion(src.getFhirVersion().toCode());
173    for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping())
174      tgt.addMapping(convertStructureDefinitionMappingComponent(t));
175    if (src.hasKind())
176      tgt.setKindElement(convertStructureDefinitionKind(src.getKindElement()));
177    if (src.hasAbstract())
178      tgt.setAbstractElement(Boolean30_50.convertBoolean(src.getAbstractElement()));
179    for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) {
180      if (!tgt.hasContextType())
181        tgt.setContextTypeElement(convertExtensionContext(t.getTypeElement(), t.getExpression()));
182      tgt.addContext("Element".equals(t.getExpression()) ? "*" : t.getExpression());
183    }
184    for (org.hl7.fhir.r5.model.StringType t : src.getContextInvariant()) tgt.addContextInvariant(t.getValue());
185    if (src.hasType())
186      tgt.setType(src.getType());
187    if (src.hasBaseDefinition())
188      tgt.setBaseDefinition(src.getBaseDefinition());
189    if (src.hasDerivation())
190      tgt.setDerivationElement(convertTypeDerivationRule(src.getDerivationElement()));
191    if (src.hasSnapshot())
192      tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot()));
193    if (src.hasDifferential())
194      tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential()));
195    return tgt;
196  }
197
198  public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException {
199    if (src == null)
200      return null;
201    org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent();
202    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
203    for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement())
204      tgt.addElement(ElementDefinition30_50.convertElementDefinition(t));
205    return tgt;
206  }
207
208  public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException {
209    if (src == null)
210      return null;
211    org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent();
212    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
213    for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement())
214      tgt.addElement(ElementDefinition30_50.convertElementDefinition(t));
215    return tgt;
216  }
217
218  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind> convertStructureDefinitionKind(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind> src) throws FHIRException {
219    if (src == null || src.isEmpty())
220      return null;
221    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());
222    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
223    switch (src.getValue()) {
224      case PRIMITIVETYPE:
225        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE);
226        break;
227      case COMPLEXTYPE:
228        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE);
229        break;
230      case RESOURCE:
231        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.RESOURCE);
232        break;
233      case LOGICAL:
234        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.LOGICAL);
235        break;
236      default:
237        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.NULL);
238        break;
239    }
240    return tgt;
241  }
242
243  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind> convertStructureDefinitionKind(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind> src) throws FHIRException {
244    if (src == null || src.isEmpty())
245      return null;
246    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());
247    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
248    switch (src.getValue()) {
249      case PRIMITIVETYPE:
250        tgt.setValue(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE);
251        break;
252      case COMPLEXTYPE:
253        tgt.setValue(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE);
254        break;
255      case RESOURCE:
256        tgt.setValue(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.RESOURCE);
257        break;
258      case LOGICAL:
259        tgt.setValue(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.LOGICAL);
260        break;
261      default:
262        tgt.setValue(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.NULL);
263        break;
264    }
265    return tgt;
266  }
267
268  public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException {
269    if (src == null)
270      return null;
271    org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent();
272    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
273    if (src.hasIdentity())
274      tgt.setIdentityElement(Id30_50.convertId(src.getIdentityElement()));
275    if (src.hasUri())
276      tgt.setUriElement(Uri30_50.convertUri(src.getUriElement()));
277    if (src.hasName())
278      tgt.setNameElement(String30_50.convertString(src.getNameElement()));
279    if (src.hasComment())
280      tgt.setCommentElement(String30_50.convertString(src.getCommentElement()));
281    return tgt;
282  }
283
284  public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException {
285    if (src == null)
286      return null;
287    org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent();
288    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
289    if (src.hasIdentity())
290      tgt.setIdentityElement(Id30_50.convertId(src.getIdentityElement()));
291    if (src.hasUri())
292      tgt.setUriElement(Uri30_50.convertUri(src.getUriElement()));
293    if (src.hasName())
294      tgt.setNameElement(String30_50.convertString(src.getNameElement()));
295    if (src.hasComment())
296      tgt.setCommentElement(String30_50.convertString(src.getCommentElement()));
297    return tgt;
298  }
299
300  public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException {
301    if (src == null)
302      return null;
303    org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent();
304    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
305    for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement())
306      tgt.addElement(ElementDefinition30_50.convertElementDefinition(t));
307    return tgt;
308  }
309
310  public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException {
311    if (src == null)
312      return null;
313    org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent();
314    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
315    for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement())
316      tgt.addElement(ElementDefinition30_50.convertElementDefinition(t));
317    return tgt;
318  }
319
320  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule> convertTypeDerivationRule(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule> src) throws FHIRException {
321    if (src == null || src.isEmpty())
322      return null;
323    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRuleEnumFactory());
324    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
325    switch (src.getValue()) {
326      case SPECIALIZATION:
327        tgt.setValue(org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION);
328        break;
329      case CONSTRAINT:
330        tgt.setValue(org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.CONSTRAINT);
331        break;
332      default:
333        tgt.setValue(org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.NULL);
334        break;
335    }
336    return tgt;
337  }
338
339  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule> convertTypeDerivationRule(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule> src) throws FHIRException {
340    if (src == null || src.isEmpty())
341      return null;
342    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRuleEnumFactory());
343    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
344    switch (src.getValue()) {
345      case SPECIALIZATION:
346        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION);
347        break;
348      case CONSTRAINT:
349        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT);
350        break;
351      default:
352        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.NULL);
353        break;
354    }
355    return tgt;
356  }
357
358  static public boolean isResource300(String tn) {
359    return Utilities.existsInList(tn, "Account", "ActivityDefinition", "AllergyIntolerance", "AdverseEvent", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodySite", "Bundle", "CapabilityStatement", "CarePlan", "CareTeam", "ChargeItem", "Claim", "ClaimResponse", "ClinicalImpression", "CodeSystem", "Communication", "CommunicationRequest", "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Consent", "Contract", "Coverage", "DataElement", "DetectedIssue", "Device", "DeviceComponent", "DeviceMetric", "DeviceRequest", "DeviceUseStatement", "DiagnosticReport", "DocumentManifest", "DocumentReference", "EligibilityRequest", "EligibilityResponse", "Encounter", "Endpoint", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "ExpansionProfile", "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", "GraphDefinition", "Group", "GuidanceResponse", "HealthcareService", "ImagingManifest", "ImagingStudy", "Immunization", "ImmunizationRecommendation", "ImplementationGuide", "Library", "Linkage", "List", "Location", "Measure", "MeasureReport", "Media", "Medication", "MedicationAdministration", "MedicationDispense", "MedicationRequest", "MedicationStatement", "MessageDefinition", "MessageHeader", "NamingSystem", "NutritionOrder", "Observation", "OperationDefinition", "OperationOutcome", "Organization", "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "PlanDefinition", "Practitioner", "PractitionerRole", "Procedure", "ProcedureRequest", "ProcessRequest", "ProcessResponse", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RequestGroup", "ResearchStudy", "ResearchSubject", "RiskAssessment", "Schedule", "SearchParameter", "Sequence", "ServiceDefinition", "Slot", "Specimen", "StructureDefinition", "StructureMap", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "Task", "TestScript", "TestReport", "ValueSet", "VisionPrescription");
360  }
361}