001package org.hl7.fhir.convertors.conv30_40.resources30_40;
002
003import org.hl7.fhir.convertors.VersionConvertorConstants;
004import org.hl7.fhir.convertors.context.ConversionContext30_40;
005import org.hl7.fhir.convertors.conv30_40.datatypes30_40.ContactDetail30_40;
006import org.hl7.fhir.convertors.conv30_40.datatypes30_40.Reference30_40;
007import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.CodeableConcept30_40;
008import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Coding30_40;
009import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Timing30_40;
010import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.*;
011import org.hl7.fhir.dstu3.model.CapabilityStatement;
012import org.hl7.fhir.dstu3.model.Enumeration;
013import org.hl7.fhir.exceptions.FHIRException;
014import org.hl7.fhir.r4.model.Extension;
015
016import java.util.stream.Collectors;
017
018public class CapabilityStatement30_40 {
019
020  private static final String[] IGNORED_EXTENSION_URLS = new String[]{
021    VersionConvertorConstants.EXT_ACCEPT_UNKNOWN_EXTENSION_URL
022  };
023
024  public static org.hl7.fhir.dstu3.model.CapabilityStatement convertCapabilityStatement(org.hl7.fhir.r4.model.CapabilityStatement src) throws FHIRException {
025    if (src == null)
026      return null;
027    org.hl7.fhir.dstu3.model.CapabilityStatement tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement();
028    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt, IGNORED_EXTENSION_URLS);
029    if (src.hasUrl())
030      tgt.setUrlElement(Uri30_40.convertUri(src.getUrlElement()));
031    if (src.hasVersion())
032      tgt.setVersionElement(String30_40.convertString(src.getVersionElement()));
033    if (src.hasName())
034      tgt.setNameElement(String30_40.convertString(src.getNameElement()));
035    if (src.hasTitle())
036      tgt.setTitleElement(String30_40.convertString(src.getTitleElement()));
037    if (src.hasStatus())
038      tgt.setStatusElement(Enumerations30_40.convertPublicationStatus(src.getStatusElement()));
039    if (src.hasExperimental())
040      tgt.setExperimentalElement(Boolean30_40.convertBoolean(src.getExperimentalElement()));
041    if (src.hasDateElement())
042      tgt.setDateElement(DateTime30_40.convertDateTime(src.getDateElement()));
043    if (src.hasPublisher())
044      tgt.setPublisherElement(String30_40.convertString(src.getPublisherElement()));
045    for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
046      tgt.addContact(ContactDetail30_40.convertContactDetail(t));
047    if (src.hasDescription())
048      tgt.setDescriptionElement(MarkDown30_40.convertMarkdown(src.getDescriptionElement()));
049    for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext())
050      tgt.addUseContext(Timing30_40.convertUsageContext(t));
051    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction())
052      tgt.addJurisdiction(CodeableConcept30_40.convertCodeableConcept(t));
053    if (src.hasPurpose())
054      tgt.setPurposeElement(MarkDown30_40.convertMarkdown(src.getPurposeElement()));
055    if (src.hasCopyright())
056      tgt.setCopyrightElement(MarkDown30_40.convertMarkdown(src.getCopyrightElement()));
057    if (src.hasKind())
058      tgt.setKindElement(convertCapabilityStatementKind(src.getKindElement()));
059    for (org.hl7.fhir.r4.model.UriType t : src.getInstantiates()) tgt.addInstantiates(t.getValue());
060    if (src.hasSoftware())
061      tgt.setSoftware(convertCapabilityStatementSoftwareComponent(src.getSoftware()));
062    if (src.hasImplementation())
063      tgt.setImplementation(convertCapabilityStatementImplementationComponent(src.getImplementation()));
064    if (src.hasFhirVersion())
065      tgt.setFhirVersion(src.getFhirVersion().toCode());
066    if (src.hasExtension(VersionConvertorConstants.EXT_ACCEPT_UNKNOWN_EXTENSION_URL))
067      tgt.setAcceptUnknown(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.fromCode(src.getExtensionByUrl(VersionConvertorConstants.EXT_ACCEPT_UNKNOWN_EXTENSION_URL).getValue().primitiveValue()));
068    for (org.hl7.fhir.r4.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue());
069    for (org.hl7.fhir.r4.model.CodeType t : src.getPatchFormat()) tgt.addPatchFormat(t.getValue());
070    for (org.hl7.fhir.r4.model.UriType t : src.getImplementationGuide()) tgt.addImplementationGuide(t.getValue());
071    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent r : src.getRest())
072      for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent rr : r.getResource())
073        for (org.hl7.fhir.r4.model.CanonicalType t : rr.getSupportedProfile())
074          tgt.addProfile(Reference30_40.convertCanonicalToReference(t));
075    for (org.hl7.fhir.r4.model.Extension ext : src.getExtension()) {
076      if (VersionConvertorConstants.EXT_CS_PROFILE.equals(ext.getUrl())) {
077        tgt.addProfile(Reference30_40.convertReference((org.hl7.fhir.r4.model.Reference) ext.getValue()));
078      }
079    }
080    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest())
081      tgt.addRest(convertCapabilityStatementRestComponent(t));
082    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging())
083      tgt.addMessaging(convertCapabilityStatementMessagingComponent(t));
084    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument())
085      tgt.addDocument(convertCapabilityStatementDocumentComponent(t));
086    return tgt;
087  }
088
089  public static org.hl7.fhir.r4.model.CapabilityStatement convertCapabilityStatement(org.hl7.fhir.dstu3.model.CapabilityStatement src) throws FHIRException {
090    if (src == null)
091      return null;
092    org.hl7.fhir.r4.model.CapabilityStatement tgt = new org.hl7.fhir.r4.model.CapabilityStatement();
093    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt);
094    if (src.hasUrl())
095      tgt.setUrlElement(Uri30_40.convertUri(src.getUrlElement()));
096    if (src.hasVersion())
097      tgt.setVersionElement(String30_40.convertString(src.getVersionElement()));
098    if (src.hasName())
099      tgt.setNameElement(String30_40.convertString(src.getNameElement()));
100    if (src.hasTitle())
101      tgt.setTitleElement(String30_40.convertString(src.getTitleElement()));
102    if (src.hasStatus())
103      tgt.setStatusElement(Enumerations30_40.convertPublicationStatus(src.getStatusElement()));
104    if (src.hasExperimental())
105      tgt.setExperimentalElement(Boolean30_40.convertBoolean(src.getExperimentalElement()));
106    if (src.hasDateElement())
107      tgt.setDateElement(DateTime30_40.convertDateTime(src.getDateElement()));
108    if (src.hasPublisher())
109      tgt.setPublisherElement(String30_40.convertString(src.getPublisherElement()));
110    for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact())
111      tgt.addContact(ContactDetail30_40.convertContactDetail(t));
112    if (src.hasDescription())
113      tgt.setDescriptionElement(MarkDown30_40.convertMarkdown(src.getDescriptionElement()));
114    for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext())
115      tgt.addUseContext(Timing30_40.convertUsageContext(t));
116    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction())
117      tgt.addJurisdiction(CodeableConcept30_40.convertCodeableConcept(t));
118    if (src.hasPurpose())
119      tgt.setPurposeElement(MarkDown30_40.convertMarkdown(src.getPurposeElement()));
120    if (src.hasCopyright())
121      tgt.setCopyrightElement(MarkDown30_40.convertMarkdown(src.getCopyrightElement()));
122    if (src.hasKind())
123      tgt.setKindElement(convertCapabilityStatementKind(src.getKindElement()));
124    for (org.hl7.fhir.dstu3.model.UriType t : src.getInstantiates()) tgt.addInstantiates(t.getValue());
125    if (src.hasSoftware())
126      tgt.setSoftware(convertCapabilityStatementSoftwareComponent(src.getSoftware()));
127    if (src.hasImplementation())
128      tgt.setImplementation(convertCapabilityStatementImplementationComponent(src.getImplementation()));
129    if (src.hasFhirVersion())
130      tgt.setFhirVersion(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion()));
131    if (src.hasAcceptUnknown())
132      tgt.addExtension().setUrl(VersionConvertorConstants.EXT_ACCEPT_UNKNOWN_EXTENSION_URL).setValue(new org.hl7.fhir.r4.model.CodeType(src.getAcceptUnknownElement().asStringValue()));
133    for (org.hl7.fhir.dstu3.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue());
134    for (org.hl7.fhir.dstu3.model.CodeType t : src.getPatchFormat()) tgt.addPatchFormat(t.getValue());
135    for (org.hl7.fhir.dstu3.model.UriType t : src.getImplementationGuide()) tgt.addImplementationGuide(t.getValue());
136    for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile())
137      tgt.addExtension(VersionConvertorConstants.EXT_CS_PROFILE, Reference30_40.convertReference(t));
138    for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest())
139      tgt.addRest(convertCapabilityStatementRestComponent(t));
140    for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging())
141      tgt.addMessaging(convertCapabilityStatementMessagingComponent(t));
142    for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument())
143      tgt.addDocument(convertCapabilityStatementDocumentComponent(t));
144    return tgt;
145  }
146
147  public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent convertCapabilityStatementDocumentComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException {
148    if (src == null)
149      return null;
150    org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent();
151    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
152    if (src.hasMode())
153      tgt.setModeElement(convertDocumentMode(src.getModeElement()));
154    if (src.hasDocumentation())
155      tgt.setDocumentation(src.getDocumentation());
156    if (src.hasProfile())
157      tgt.setProfile(Reference30_40.convertCanonicalToReference(src.getProfileElement()));
158    return tgt;
159  }
160
161  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent convertCapabilityStatementDocumentComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException {
162    if (src == null)
163      return null;
164    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent();
165    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
166    if (src.hasMode())
167      tgt.setModeElement(convertDocumentMode(src.getModeElement()));
168    if (src.hasDocumentation())
169      tgt.setDocumentation(src.getDocumentation());
170    if (src.hasProfile())
171      tgt.setProfileElement(Reference30_40.convertReferenceToCanonical(src.getProfile()));
172    return tgt;
173  }
174
175  public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent convertCapabilityStatementImplementationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException {
176    if (src == null)
177      return null;
178    org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent();
179    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
180    if (src.hasDescription())
181      tgt.setDescriptionElement(String30_40.convertString(src.getDescriptionElement()));
182    if (src.hasUrl())
183      tgt.setUrl(src.getUrl());
184    return tgt;
185  }
186
187  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent convertCapabilityStatementImplementationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException {
188    if (src == null)
189      return null;
190    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent();
191    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
192    if (src.hasDescription())
193      tgt.setDescriptionElement(String30_40.convertString(src.getDescriptionElement()));
194    if (src.hasUrl())
195      tgt.setUrl(src.getUrl());
196    return tgt;
197  }
198
199  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind> convertCapabilityStatementKind(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind> src) throws FHIRException {
200      if (src == null || src.isEmpty())
201          return null;
202      Enumeration<CapabilityStatement.CapabilityStatementKind> tgt = new Enumeration<>(new CapabilityStatement.CapabilityStatementKindEnumFactory());
203      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
204      if (src.getValue() == null) {
205          tgt.setValue(null);
206      } else {
207          switch (src.getValue()) {
208              case INSTANCE:
209                  tgt.setValue(CapabilityStatement.CapabilityStatementKind.INSTANCE);
210                  break;
211              case CAPABILITY:
212                  tgt.setValue(CapabilityStatement.CapabilityStatementKind.CAPABILITY);
213                  break;
214              case REQUIREMENTS:
215                  tgt.setValue(CapabilityStatement.CapabilityStatementKind.REQUIREMENTS);
216                  break;
217              default:
218                  tgt.setValue(CapabilityStatement.CapabilityStatementKind.NULL);
219                  break;
220          }
221      }
222      return tgt;
223  }
224
225  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind> convertCapabilityStatementKind(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind> src) throws FHIRException {
226      if (src == null || src.isEmpty())
227          return null;
228      org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKindEnumFactory());
229      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
230      if (src.getValue() == null) {
231          tgt.setValue(null);
232      } else {
233          switch (src.getValue()) {
234              case INSTANCE:
235                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.INSTANCE);
236                  break;
237              case CAPABILITY:
238                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY);
239                  break;
240              case REQUIREMENTS:
241                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS);
242                  break;
243              default:
244                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.NULL);
245                  break;
246          }
247      }
248      return tgt;
249  }
250
251  public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent convertCapabilityStatementMessagingComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException {
252    if (src == null)
253      return null;
254    org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent();
255    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src, tgt, VersionConvertorConstants.EXT_IG_CONFORMANCE_MESSAGE_EVENT);
256    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint())
257      tgt.addEndpoint(convertCapabilityStatementMessagingEndpointComponent(t));
258    if (src.hasReliableCache())
259      tgt.setReliableCacheElement(UnsignedInt30_40.convertUnsignedInt(src.getReliableCacheElement()));
260    if (src.hasDocumentation())
261      tgt.setDocumentation(src.getDocumentation());
262    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent t : src.getSupportedMessage())
263      tgt.addSupportedMessage(convertCapabilityStatementMessagingSupportedMessageComponent(t));
264    for (org.hl7.fhir.r4.model.Extension e : src.getExtensionsByUrl(VersionConvertorConstants.EXT_IG_CONFORMANCE_MESSAGE_EVENT)) {
265      tgt.addEvent(convertMessageExtensionToMessageEvent(e));
266    }
267    return tgt;
268  }
269
270  public static CapabilityStatement.CapabilityStatementMessagingEventComponent convertMessageExtensionToMessageEvent(Extension extension) {
271    CapabilityStatement.CapabilityStatementMessagingEventComponent event = new CapabilityStatement.CapabilityStatementMessagingEventComponent();
272    event.setCode(Coding30_40.convertCoding((org.hl7.fhir.r4.model.Coding) extension.getExtensionByUrl("code").getValue()));
273    if (extension.hasExtension("category"))
274      event.setCategory(CapabilityStatement.MessageSignificanceCategory.fromCode(extension.getExtensionByUrl("category").getValue().toString()));
275    event.setMode(CapabilityStatement.EventCapabilityMode.fromCode(extension.getExtensionByUrl("mode").getValue().toString()));
276
277    event.setFocusElement(convertFocusExtensionR4ToMessageEventDstu3(extension.getExtensionByUrl("focus")));
278    event.setRequest(Reference30_40.convertReference((org.hl7.fhir.r4.model.Reference) extension.getExtensionByUrl("request").getValue()));
279    event.setResponse(Reference30_40.convertReference((org.hl7.fhir.r4.model.Reference) extension.getExtensionByUrl("response").getValue()));
280    if (extension.hasExtension("documentation"))
281      event.setDocumentation(extension.getExtensionByUrl("documentation").getValue().toString());
282
283    return event;
284  }
285
286  public static org.hl7.fhir.dstu3.model.CodeType convertFocusExtensionR4ToMessageEventDstu3(Extension focusE) {
287    org.hl7.fhir.dstu3.model.CodeType result = new org.hl7.fhir.dstu3.model.CodeType();
288    if (focusE.getValue().hasPrimitiveValue()) {
289      result.setValue(focusE.getValue().toString());
290    } else {
291      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(focusE.getValue(), result);
292    }
293    return result;
294  }
295
296  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent convertCapabilityStatementMessagingComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException {
297    if (src == null)
298      return null;
299    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent();
300    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
301    for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint())
302      tgt.addEndpoint(convertCapabilityStatementMessagingEndpointComponent(t));
303    if (src.hasReliableCache())
304      tgt.setReliableCacheElement(UnsignedInt30_40.convertUnsignedInt(src.getReliableCacheElement()));
305    if (src.hasDocumentation())
306      tgt.setDocumentation(src.getDocumentation());
307    for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent t : src.getSupportedMessage())
308      tgt.addSupportedMessage(convertCapabilityStatementMessagingSupportedMessageComponent(t));
309    for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent t : src.getEvent()) {
310      Extension e = convertCapabilityStatementMessageEvent(t);
311      tgt.addExtension(e);
312    }
313    return tgt;
314  }
315
316  public static Extension convertCapabilityStatementMessageEvent(CapabilityStatement.CapabilityStatementMessagingEventComponent t) {
317    Extension e = new Extension(VersionConvertorConstants.EXT_IG_CONFORMANCE_MESSAGE_EVENT);
318    e.addExtension(new Extension("code", Coding30_40.convertCoding(t.getCode())));
319    if (t.hasCategory()) {
320      e.addExtension(new Extension("category", new org.hl7.fhir.r4.model.CodeType(t.getCategory().toCode())));
321    }
322    e.addExtension(new Extension("mode", new org.hl7.fhir.r4.model.CodeType(t.getMode().toCode())));
323    if (t.hasFocusElement()) {
324      e.addExtension(convertFocusMessagingEventComponent(t.getFocusElement()));
325    }
326    e.addExtension(new Extension("request", Reference30_40.convertReference(t.getRequest())));
327    e.addExtension(new Extension("response", Reference30_40.convertReference(t.getResponse())));
328    if (t.hasDocumentation()) {
329      e.addExtension(new Extension("documentation", new org.hl7.fhir.r4.model.StringType(t.getDocumentation())));
330    }
331    return e;
332  }
333
334  public static Extension convertFocusMessagingEventComponent(org.hl7.fhir.dstu3.model.CodeType t) {
335    Extension result = new Extension("focus");
336    if (t.hasValue()) {
337      result.setValue(new org.hl7.fhir.r4.model.StringType(t.getValue()));
338    } else {
339      org.hl7.fhir.r4.model.CodeType focus = new org.hl7.fhir.r4.model.CodeType();
340      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(t, focus);
341      result.setValue(focus);
342    }
343    return result;
344  }
345
346  public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertCapabilityStatementMessagingEndpointComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException {
347    if (src == null)
348      return null;
349    org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
350    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
351    if (src.hasProtocol())
352      tgt.setProtocol(Coding30_40.convertCoding(src.getProtocol()));
353    if (src.hasAddress())
354      tgt.setAddress(src.getAddress());
355    return tgt;
356  }
357
358  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertCapabilityStatementMessagingEndpointComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException {
359    if (src == null)
360      return null;
361    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
362    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
363    if (src.hasProtocol())
364      tgt.setProtocol(Coding30_40.convertCoding(src.getProtocol()));
365    if (src.hasAddress())
366      tgt.setAddress(src.getAddress());
367    return tgt;
368  }
369
370  public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent convertCapabilityStatementMessagingSupportedMessageComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent src) throws FHIRException {
371    if (src == null)
372      return null;
373    org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
374    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
375    if (src.hasMode())
376      tgt.setModeElement(convertEventCapabilityMode(src.getModeElement()));
377    if (src.hasDefinition())
378      tgt.setDefinition(Reference30_40.convertCanonicalToReference(src.getDefinitionElement()));
379    return tgt;
380  }
381
382  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent convertCapabilityStatementMessagingSupportedMessageComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent src) throws FHIRException {
383    if (src == null)
384      return null;
385    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
386    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
387    if (src.hasMode())
388      tgt.setModeElement(convertEventCapabilityMode(src.getModeElement()));
389    if (src.hasDefinition())
390      tgt.setDefinitionElement(Reference30_40.convertReferenceToCanonical(src.getDefinition()));
391    return tgt;
392  }
393
394  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent convertCapabilityStatementRestComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException {
395    if (src == null)
396      return null;
397    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent();
398    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
399    if (src.hasMode())
400      tgt.setModeElement(convertRestfulCapabilityMode(src.getModeElement()));
401    if (src.hasDocumentation())
402      tgt.setDocumentation(src.getDocumentation());
403    if (src.hasSecurity())
404      tgt.setSecurity(convertCapabilityStatementRestSecurityComponent(src.getSecurity()));
405    for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource())
406      tgt.addResource(convertCapabilityStatementRestResourceComponent(t));
407    for (org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction())
408      tgt.addInteraction(convertSystemInteractionComponent(t));
409    for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam())
410      tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t));
411    for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent t : src.getOperation())
412      tgt.addOperation(convertCapabilityStatementRestOperationComponent(t));
413    for (org.hl7.fhir.dstu3.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue());
414    return tgt;
415  }
416
417  public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent convertCapabilityStatementRestComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException {
418    if (src == null)
419      return null;
420    org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent();
421    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
422    if (src.hasMode())
423      tgt.setModeElement(convertRestfulCapabilityMode(src.getModeElement()));
424    if (src.hasDocumentation())
425      tgt.setDocumentation(src.getDocumentation());
426    if (src.hasSecurity())
427      tgt.setSecurity(convertCapabilityStatementRestSecurityComponent(src.getSecurity()));
428    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource())
429      tgt.addResource(convertCapabilityStatementRestResourceComponent(t));
430    for (org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction())
431      tgt.addInteraction(convertSystemInteractionComponent(t));
432    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam())
433      tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t));
434    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation())
435      tgt.addOperation(convertCapabilityStatementRestOperationComponent(t));
436    for (org.hl7.fhir.r4.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue());
437    return tgt;
438  }
439
440  public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent convertCapabilityStatementRestOperationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException {
441    if (src == null)
442      return null;
443    org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent();
444    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
445    if (src.hasName())
446      tgt.setNameElement(String30_40.convertString(src.getNameElement()));
447    if (src.hasDefinition())
448      tgt.setDefinition(Reference30_40.convertCanonicalToReference(src.getDefinitionElement()));
449    return tgt;
450  }
451
452  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertCapabilityStatementRestOperationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent src) throws FHIRException {
453    if (src == null)
454      return null;
455    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent();
456    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
457    if (src.hasName())
458      tgt.setNameElement(String30_40.convertString(src.getNameElement()));
459    if (src.hasDefinition())
460      tgt.setDefinitionElement(Reference30_40.convertReferenceToCanonical(src.getDefinition()));
461    return tgt;
462  }
463
464  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertCapabilityStatementRestResourceComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException {
465    if (src == null)
466      return null;
467    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent();
468    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
469    if (src.hasType())
470      tgt.setTypeElement(Code30_40.convertCode(src.getTypeElement()));
471    if (src.hasProfile())
472      tgt.setProfileElement(Reference30_40.convertReferenceToCanonical(src.getProfile()));
473    if (src.hasDocumentation())
474      tgt.setDocumentationElement(MarkDown30_40.convertMarkdown(src.getDocumentationElement()));
475    for (org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction())
476      tgt.addInteraction(convertResourceInteractionComponent(t));
477    if (src.hasVersioning())
478      tgt.setVersioningElement(convertResourceVersionPolicy(src.getVersioningElement()));
479    if (src.hasReadHistory())
480      tgt.setReadHistoryElement(Boolean30_40.convertBoolean(src.getReadHistoryElement()));
481    if (src.hasUpdateCreate())
482      tgt.setUpdateCreateElement(Boolean30_40.convertBoolean(src.getUpdateCreateElement()));
483    if (src.hasConditionalCreate())
484      tgt.setConditionalCreateElement(Boolean30_40.convertBoolean(src.getConditionalCreateElement()));
485    if (src.hasConditionalRead())
486      tgt.setConditionalReadElement(convertConditionalReadStatus(src.getConditionalReadElement()));
487    if (src.hasConditionalUpdate())
488      tgt.setConditionalUpdateElement(Boolean30_40.convertBoolean(src.getConditionalUpdateElement()));
489    if (src.hasConditionalDelete())
490      tgt.setConditionalDeleteElement(convertConditionalDeleteStatus(src.getConditionalDeleteElement()));
491    tgt.setReferencePolicy(src.getReferencePolicy().stream()
492      .map(CapabilityStatement30_40::convertReferenceHandlingPolicy)
493      .collect(Collectors.toList()));
494    for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue());
495    for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue());
496    for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam())
497      tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t));
498    return tgt;
499  }
500
501  public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertCapabilityStatementRestResourceComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException {
502    if (src == null)
503      return null;
504    org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent();
505    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
506    if (src.hasType())
507      tgt.setTypeElement(Code30_40.convertCode(src.getTypeElement()));
508    if (src.hasProfile())
509      tgt.setProfile(Reference30_40.convertCanonicalToReference(src.getProfileElement()));
510    if (src.hasDocumentation())
511      tgt.setDocumentationElement(MarkDown30_40.convertMarkdown(src.getDocumentationElement()));
512    for (org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction())
513      tgt.addInteraction(convertResourceInteractionComponent(t));
514    if (src.hasVersioning())
515      tgt.setVersioningElement(convertResourceVersionPolicy(src.getVersioningElement()));
516    if (src.hasReadHistory())
517      tgt.setReadHistoryElement(Boolean30_40.convertBoolean(src.getReadHistoryElement()));
518    if (src.hasUpdateCreate())
519      tgt.setUpdateCreateElement(Boolean30_40.convertBoolean(src.getUpdateCreateElement()));
520    if (src.hasConditionalCreate())
521      tgt.setConditionalCreateElement(Boolean30_40.convertBoolean(src.getConditionalCreateElement()));
522    if (src.hasConditionalRead())
523      tgt.setConditionalReadElement(convertConditionalReadStatus(src.getConditionalReadElement()));
524    if (src.hasConditionalUpdate())
525      tgt.setConditionalUpdateElement(Boolean30_40.convertBoolean(src.getConditionalUpdateElement()));
526    if (src.hasConditionalDelete())
527      tgt.setConditionalDeleteElement(convertConditionalDeleteStatus(src.getConditionalDeleteElement()));
528    tgt.setReferencePolicy(src.getReferencePolicy().stream()
529      .map(CapabilityStatement30_40::convertReferenceHandlingPolicy)
530      .collect(Collectors.toList()));
531    for (org.hl7.fhir.r4.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue());
532    for (org.hl7.fhir.r4.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue());
533    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam())
534      tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t));
535    return tgt;
536  }
537
538  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertCapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException {
539    if (src == null)
540      return null;
541    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
542    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
543    if (src.hasName())
544      tgt.setNameElement(String30_40.convertString(src.getNameElement()));
545    if (src.hasDefinition())
546      tgt.setDefinition(src.getDefinition());
547    if (src.hasType())
548      tgt.setTypeElement(Enumerations30_40.convertSearchParamType(src.getTypeElement()));
549    if (src.hasDocumentation())
550      tgt.setDocumentation(src.getDocumentation());
551    return tgt;
552  }
553
554  public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertCapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException {
555    if (src == null)
556      return null;
557    org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
558    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
559    if (src.hasName())
560      tgt.setNameElement(String30_40.convertString(src.getNameElement()));
561    if (src.hasDefinition())
562      tgt.setDefinition(src.getDefinition());
563    if (src.hasType())
564      tgt.setTypeElement(Enumerations30_40.convertSearchParamType(src.getTypeElement()));
565    if (src.hasDocumentation())
566      tgt.setDocumentation(src.getDocumentation());
567    return tgt;
568  }
569
570  public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertCapabilityStatementRestSecurityComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException {
571    if (src == null)
572      return null;
573    org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent();
574    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
575    if (src.hasCors())
576      tgt.setCorsElement(Boolean30_40.convertBoolean(src.getCorsElement()));
577    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getService())
578      tgt.addService(CodeableConcept30_40.convertCodeableConcept(t));
579    if (src.hasDescription())
580      tgt.setDescription(src.getDescription());
581    return tgt;
582  }
583
584  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertCapabilityStatementRestSecurityComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException {
585    if (src == null)
586      return null;
587    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent();
588    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
589    if (src.hasCors())
590      tgt.setCorsElement(Boolean30_40.convertBoolean(src.getCorsElement()));
591    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getService())
592      tgt.addService(CodeableConcept30_40.convertCodeableConcept(t));
593    if (src.hasDescription())
594      tgt.setDescription(src.getDescription());
595    return tgt;
596  }
597
598  public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertCapabilityStatementSoftwareComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException {
599    if (src == null)
600      return null;
601    org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent();
602    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
603    if (src.hasName())
604      tgt.setNameElement(String30_40.convertString(src.getNameElement()));
605    if (src.hasVersion())
606      tgt.setVersionElement(String30_40.convertString(src.getVersionElement()));
607    if (src.hasReleaseDate())
608      tgt.setReleaseDateElement(DateTime30_40.convertDateTime(src.getReleaseDateElement()));
609    return tgt;
610  }
611
612  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertCapabilityStatementSoftwareComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException {
613    if (src == null)
614      return null;
615    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent();
616    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
617    if (src.hasName())
618      tgt.setNameElement(String30_40.convertString(src.getNameElement()));
619    if (src.hasVersion())
620      tgt.setVersionElement(String30_40.convertString(src.getVersionElement()));
621    if (src.hasReleaseDate())
622      tgt.setReleaseDateElement(DateTime30_40.convertDateTime(src.getReleaseDateElement()));
623    return tgt;
624  }
625
626  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus> convertConditionalDeleteStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus> src) throws FHIRException {
627      if (src == null || src.isEmpty())
628          return null;
629      Enumeration<CapabilityStatement.ConditionalDeleteStatus> tgt = new Enumeration<>(new CapabilityStatement.ConditionalDeleteStatusEnumFactory());
630      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
631      if (src.getValue() == null) {
632          tgt.setValue(null);
633      } else {
634          switch (src.getValue()) {
635              case NOTSUPPORTED:
636                  tgt.setValue(CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED);
637                  break;
638              case SINGLE:
639                  tgt.setValue(CapabilityStatement.ConditionalDeleteStatus.SINGLE);
640                  break;
641              case MULTIPLE:
642                  tgt.setValue(CapabilityStatement.ConditionalDeleteStatus.MULTIPLE);
643                  break;
644              default:
645                  tgt.setValue(CapabilityStatement.ConditionalDeleteStatus.NULL);
646                  break;
647          }
648      }
649      return tgt;
650  }
651
652  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus> convertConditionalDeleteStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus> src) throws FHIRException {
653      if (src == null || src.isEmpty())
654          return null;
655      org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatusEnumFactory());
656      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
657      if (src.getValue() == null) {
658          tgt.setValue(null);
659      } else {
660          switch (src.getValue()) {
661              case NOTSUPPORTED:
662                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED);
663                  break;
664              case SINGLE:
665                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE);
666                  break;
667              case MULTIPLE:
668                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE);
669                  break;
670              default:
671                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NULL);
672                  break;
673          }
674      }
675      return tgt;
676  }
677
678  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus> convertConditionalReadStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus> src) throws FHIRException {
679      if (src == null || src.isEmpty())
680          return null;
681      Enumeration<CapabilityStatement.ConditionalReadStatus> tgt = new Enumeration<>(new CapabilityStatement.ConditionalReadStatusEnumFactory());
682      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
683      if (src.getValue() == null) {
684          tgt.setValue(null);
685      } else {
686          switch (src.getValue()) {
687              case NOTSUPPORTED:
688                  tgt.setValue(CapabilityStatement.ConditionalReadStatus.NOTSUPPORTED);
689                  break;
690              case MODIFIEDSINCE:
691                  tgt.setValue(CapabilityStatement.ConditionalReadStatus.MODIFIEDSINCE);
692                  break;
693              case NOTMATCH:
694                  tgt.setValue(CapabilityStatement.ConditionalReadStatus.NOTMATCH);
695                  break;
696              case FULLSUPPORT:
697                  tgt.setValue(CapabilityStatement.ConditionalReadStatus.FULLSUPPORT);
698                  break;
699              default:
700                  tgt.setValue(CapabilityStatement.ConditionalReadStatus.NULL);
701                  break;
702          }
703      }
704      return tgt;
705  }
706
707  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus> convertConditionalReadStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus> src) throws FHIRException {
708      if (src == null || src.isEmpty())
709          return null;
710      org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatusEnumFactory());
711      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
712      if (src.getValue() == null) {
713          tgt.setValue(null);
714      } else {
715          switch (src.getValue()) {
716              case NOTSUPPORTED:
717                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.NOTSUPPORTED);
718                  break;
719              case MODIFIEDSINCE:
720                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.MODIFIEDSINCE);
721                  break;
722              case NOTMATCH:
723                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.NOTMATCH);
724                  break;
725              case FULLSUPPORT:
726                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.FULLSUPPORT);
727                  break;
728              default:
729                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.NULL);
730                  break;
731          }
732      }
733      return tgt;
734  }
735
736  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode> convertDocumentMode(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode> src) throws FHIRException {
737      if (src == null || src.isEmpty())
738          return null;
739      org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CapabilityStatement.DocumentModeEnumFactory());
740      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
741      if (src.getValue() == null) {
742          tgt.setValue(null);
743      } else {
744          switch (src.getValue()) {
745              case PRODUCER:
746                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.PRODUCER);
747                  break;
748              case CONSUMER:
749                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.CONSUMER);
750                  break;
751              default:
752                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.NULL);
753                  break;
754          }
755      }
756      return tgt;
757  }
758
759  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode> convertDocumentMode(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode> src) throws FHIRException {
760      if (src == null || src.isEmpty())
761          return null;
762      Enumeration<CapabilityStatement.DocumentMode> tgt = new Enumeration<>(new CapabilityStatement.DocumentModeEnumFactory());
763      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
764      if (src.getValue() == null) {
765          tgt.setValue(null);
766      } else {
767          switch (src.getValue()) {
768              case PRODUCER:
769                  tgt.setValue(CapabilityStatement.DocumentMode.PRODUCER);
770                  break;
771              case CONSUMER:
772                  tgt.setValue(CapabilityStatement.DocumentMode.CONSUMER);
773                  break;
774              default:
775                  tgt.setValue(CapabilityStatement.DocumentMode.NULL);
776                  break;
777          }
778      }
779      return tgt;
780  }
781
782  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode> convertEventCapabilityMode(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode> src) throws FHIRException {
783      if (src == null || src.isEmpty())
784          return null;
785      Enumeration<CapabilityStatement.EventCapabilityMode> tgt = new Enumeration<>(new CapabilityStatement.EventCapabilityModeEnumFactory());
786      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
787      if (src.getValue() == null) {
788          tgt.setValue(null);
789      } else {
790          switch (src.getValue()) {
791              case SENDER:
792                  tgt.setValue(CapabilityStatement.EventCapabilityMode.SENDER);
793                  break;
794              case RECEIVER:
795                  tgt.setValue(CapabilityStatement.EventCapabilityMode.RECEIVER);
796                  break;
797              default:
798                  tgt.setValue(CapabilityStatement.EventCapabilityMode.NULL);
799                  break;
800          }
801      }
802      return tgt;
803  }
804
805  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode> convertEventCapabilityMode(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode> src) throws FHIRException {
806      if (src == null || src.isEmpty())
807          return null;
808      org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityModeEnumFactory());
809      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
810      if (src.getValue() == null) {
811          tgt.setValue(null);
812      } else {
813          switch (src.getValue()) {
814              case SENDER:
815                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.SENDER);
816                  break;
817              case RECEIVER:
818                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.RECEIVER);
819                  break;
820              default:
821                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.NULL);
822                  break;
823          }
824      }
825      return tgt;
826  }
827
828  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy> convertReferenceHandlingPolicy(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy> src) throws FHIRException {
829      if (src == null || src.isEmpty())
830          return null;
831      org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicyEnumFactory());
832      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
833      if (src.getValue() == null) {
834          tgt.setValue(null);
835      } else {
836          switch (src.getValue()) {
837              case LITERAL:
838                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.LITERAL);
839                  break;
840              case LOGICAL:
841                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.LOGICAL);
842                  break;
843              case RESOLVES:
844                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.RESOLVES);
845                  break;
846              case ENFORCED:
847                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.ENFORCED);
848                  break;
849              case LOCAL:
850                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.LOCAL);
851                  break;
852              default:
853                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.NULL);
854                  break;
855          }
856      }
857      return tgt;
858  }
859
860  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy> convertReferenceHandlingPolicy(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy> src) throws FHIRException {
861      if (src == null || src.isEmpty())
862          return null;
863      Enumeration<CapabilityStatement.ReferenceHandlingPolicy> tgt = new Enumeration<>(new CapabilityStatement.ReferenceHandlingPolicyEnumFactory());
864      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
865      if (src.getValue() == null) {
866          tgt.setValue(null);
867      } else {
868          switch (src.getValue()) {
869              case LITERAL:
870                  tgt.setValue(CapabilityStatement.ReferenceHandlingPolicy.LITERAL);
871                  break;
872              case LOGICAL:
873                  tgt.setValue(CapabilityStatement.ReferenceHandlingPolicy.LOGICAL);
874                  break;
875              case RESOLVES:
876                  tgt.setValue(CapabilityStatement.ReferenceHandlingPolicy.RESOLVES);
877                  break;
878              case ENFORCED:
879                  tgt.setValue(CapabilityStatement.ReferenceHandlingPolicy.ENFORCED);
880                  break;
881              case LOCAL:
882                  tgt.setValue(CapabilityStatement.ReferenceHandlingPolicy.LOCAL);
883                  break;
884              default:
885                  tgt.setValue(CapabilityStatement.ReferenceHandlingPolicy.NULL);
886                  break;
887          }
888      }
889      return tgt;
890  }
891
892  public static org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException {
893    if (src == null)
894      return null;
895    org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent();
896    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
897    if (src.hasCode())
898      tgt.setCodeElement(convertTypeRestfulInteraction(src.getCodeElement()));
899    if (src.hasDocumentation())
900      tgt.setDocumentation(src.getDocumentation());
901    return tgt;
902  }
903
904  public static org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException {
905    if (src == null)
906      return null;
907    org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent();
908    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
909    if (src.hasCode())
910      tgt.setCodeElement(convertTypeRestfulInteraction(src.getCodeElement()));
911    if (src.hasDocumentation())
912      tgt.setDocumentation(src.getDocumentation());
913    return tgt;
914  }
915
916  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy> convertResourceVersionPolicy(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy> src) throws FHIRException {
917      if (src == null || src.isEmpty())
918          return null;
919      org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicyEnumFactory());
920      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
921      if (src.getValue() == null) {
922          tgt.setValue(null);
923      } else {
924          switch (src.getValue()) {
925              case NOVERSION:
926                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION);
927                  break;
928              case VERSIONED:
929                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED);
930                  break;
931              case VERSIONEDUPDATE:
932                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE);
933                  break;
934              default:
935                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NULL);
936                  break;
937          }
938      }
939      return tgt;
940  }
941
942  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy> convertResourceVersionPolicy(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy> src) throws FHIRException {
943      if (src == null || src.isEmpty())
944          return null;
945      Enumeration<CapabilityStatement.ResourceVersionPolicy> tgt = new Enumeration<>(new CapabilityStatement.ResourceVersionPolicyEnumFactory());
946      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
947      if (src.getValue() == null) {
948          tgt.setValue(null);
949      } else {
950          switch (src.getValue()) {
951              case NOVERSION:
952                  tgt.setValue(CapabilityStatement.ResourceVersionPolicy.NOVERSION);
953                  break;
954              case VERSIONED:
955                  tgt.setValue(CapabilityStatement.ResourceVersionPolicy.VERSIONED);
956                  break;
957              case VERSIONEDUPDATE:
958                  tgt.setValue(CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE);
959                  break;
960              default:
961                  tgt.setValue(CapabilityStatement.ResourceVersionPolicy.NULL);
962                  break;
963          }
964      }
965      return tgt;
966  }
967
968  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode> convertRestfulCapabilityMode(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode> src) throws FHIRException {
969      if (src == null || src.isEmpty())
970          return null;
971      Enumeration<CapabilityStatement.RestfulCapabilityMode> tgt = new Enumeration<>(new CapabilityStatement.RestfulCapabilityModeEnumFactory());
972      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
973      if (src.getValue() == null) {
974          tgt.setValue(null);
975      } else {
976          switch (src.getValue()) {
977              case CLIENT:
978                  tgt.setValue(CapabilityStatement.RestfulCapabilityMode.CLIENT);
979                  break;
980              case SERVER:
981                  tgt.setValue(CapabilityStatement.RestfulCapabilityMode.SERVER);
982                  break;
983              default:
984                  tgt.setValue(CapabilityStatement.RestfulCapabilityMode.NULL);
985                  break;
986          }
987      }
988      return tgt;
989  }
990
991  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode> convertRestfulCapabilityMode(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode> src) throws FHIRException {
992      if (src == null || src.isEmpty())
993          return null;
994      org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityModeEnumFactory());
995      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
996      if (src.getValue() == null) {
997          tgt.setValue(null);
998      } else {
999          switch (src.getValue()) {
1000              case CLIENT:
1001                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.CLIENT);
1002                  break;
1003              case SERVER:
1004                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.SERVER);
1005                  break;
1006              default:
1007                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.NULL);
1008                  break;
1009          }
1010      }
1011      return tgt;
1012  }
1013
1014  public static org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException {
1015    if (src == null)
1016      return null;
1017    org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent();
1018    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
1019    if (src.hasCode())
1020      tgt.setCodeElement(convertSystemRestfulInteraction(src.getCodeElement()));
1021    if (src.hasDocumentation())
1022      tgt.setDocumentation(src.getDocumentation());
1023    return tgt;
1024  }
1025
1026  public static org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException {
1027    if (src == null)
1028      return null;
1029    org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent();
1030    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
1031    if (src.hasCode())
1032      tgt.setCodeElement(convertSystemRestfulInteraction(src.getCodeElement()));
1033    if (src.hasDocumentation())
1034      tgt.setDocumentation(src.getDocumentation());
1035    return tgt;
1036  }
1037
1038  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction> convertSystemRestfulInteraction(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction> src) throws FHIRException {
1039      if (src == null || src.isEmpty())
1040          return null;
1041      Enumeration<CapabilityStatement.SystemRestfulInteraction> tgt = new Enumeration<>(new CapabilityStatement.SystemRestfulInteractionEnumFactory());
1042      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
1043      if (src.getValue() == null) {
1044          tgt.setValue(null);
1045      } else {
1046          switch (src.getValue()) {
1047              case TRANSACTION:
1048                  tgt.setValue(CapabilityStatement.SystemRestfulInteraction.TRANSACTION);
1049                  break;
1050              case BATCH:
1051                  tgt.setValue(CapabilityStatement.SystemRestfulInteraction.BATCH);
1052                  break;
1053              case SEARCHSYSTEM:
1054                  tgt.setValue(CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM);
1055                  break;
1056              case HISTORYSYSTEM:
1057                  tgt.setValue(CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM);
1058                  break;
1059              default:
1060                  tgt.setValue(CapabilityStatement.SystemRestfulInteraction.NULL);
1061                  break;
1062          }
1063      }
1064      return tgt;
1065  }
1066
1067  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction> convertSystemRestfulInteraction(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction> src) throws FHIRException {
1068      if (src == null || src.isEmpty())
1069          return null;
1070      org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteractionEnumFactory());
1071      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
1072      if (src.getValue() == null) {
1073          tgt.setValue(null);
1074      } else {
1075          switch (src.getValue()) {
1076              case TRANSACTION:
1077                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION);
1078                  break;
1079              case BATCH:
1080                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.BATCH);
1081                  break;
1082              case SEARCHSYSTEM:
1083                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM);
1084                  break;
1085              case HISTORYSYSTEM:
1086                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM);
1087                  break;
1088              default:
1089                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.NULL);
1090                  break;
1091          }
1092      }
1093      return tgt;
1094  }
1095
1096  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction> convertTypeRestfulInteraction(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction> src) throws FHIRException {
1097      if (src == null || src.isEmpty())
1098          return null;
1099      Enumeration<CapabilityStatement.TypeRestfulInteraction> tgt = new Enumeration<>(new CapabilityStatement.TypeRestfulInteractionEnumFactory());
1100      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
1101      if (src.getValue() == null) {
1102          tgt.setValue(null);
1103      } else {
1104          switch (src.getValue()) {
1105              case READ:
1106                  tgt.setValue(CapabilityStatement.TypeRestfulInteraction.READ);
1107                  break;
1108              case VREAD:
1109                  tgt.setValue(CapabilityStatement.TypeRestfulInteraction.VREAD);
1110                  break;
1111              case UPDATE:
1112                  tgt.setValue(CapabilityStatement.TypeRestfulInteraction.UPDATE);
1113                  break;
1114              case PATCH:
1115                  tgt.setValue(CapabilityStatement.TypeRestfulInteraction.PATCH);
1116                  break;
1117              case DELETE:
1118                  tgt.setValue(CapabilityStatement.TypeRestfulInteraction.DELETE);
1119                  break;
1120              case HISTORYINSTANCE:
1121                  tgt.setValue(CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE);
1122                  break;
1123              case HISTORYTYPE:
1124                  tgt.setValue(CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE);
1125                  break;
1126              case CREATE:
1127                  tgt.setValue(CapabilityStatement.TypeRestfulInteraction.CREATE);
1128                  break;
1129              case SEARCHTYPE:
1130                  tgt.setValue(CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE);
1131                  break;
1132              default:
1133                  tgt.setValue(CapabilityStatement.TypeRestfulInteraction.NULL);
1134                  break;
1135          }
1136      }
1137      return tgt;
1138  }
1139
1140  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction> convertTypeRestfulInteraction(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction> src) throws FHIRException {
1141      if (src == null || src.isEmpty())
1142          return null;
1143      org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteractionEnumFactory());
1144      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
1145      if (src.getValue() == null) {
1146          tgt.setValue(null);
1147      } else {
1148          switch (src.getValue()) {
1149              case READ:
1150                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.READ);
1151                  break;
1152              case VREAD:
1153                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.VREAD);
1154                  break;
1155              case UPDATE:
1156                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.UPDATE);
1157                  break;
1158              case PATCH:
1159                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.PATCH);
1160                  break;
1161              case DELETE:
1162                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.DELETE);
1163                  break;
1164              case HISTORYINSTANCE:
1165                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE);
1166                  break;
1167              case HISTORYTYPE:
1168                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE);
1169                  break;
1170              case CREATE:
1171                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.CREATE);
1172                  break;
1173              case SEARCHTYPE:
1174                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE);
1175                  break;
1176              default:
1177                  tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.NULL);
1178                  break;
1179          }
1180      }
1181      return tgt;
1182  }
1183}