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