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