001package org.hl7.fhir.convertors.conv40_50.resources40_50;
002
003import java.util.stream.Collectors;
004
005import org.hl7.fhir.convertors.context.ConversionContext40_50;
006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.CodeableConcept40_50;
007import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Coding40_50;
008import org.hl7.fhir.convertors.conv40_50.datatypes40_50.metadata40_50.ContactDetail40_50;
009import org.hl7.fhir.convertors.conv40_50.datatypes40_50.metadata40_50.UsageContext40_50;
010import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Boolean40_50;
011import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Canonical40_50;
012import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Code40_50;
013import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.DateTime40_50;
014import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.MarkDown40_50;
015import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50;
016import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.UnsignedInt40_50;
017import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50;
018import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Url40_50;
019import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Reference40_50;
020import org.hl7.fhir.exceptions.FHIRException;
021
022/*
023  Copyright (c) 2011+, HL7, Inc.
024  All rights reserved.
025  
026  Redistribution and use in source and binary forms, with or without modification, 
027  are permitted provided that the following conditions are met:
028  
029   * Redistributions of source code must retain the above copyright notice, this 
030     list of conditions and the following disclaimer.
031   * Redistributions in binary form must reproduce the above copyright notice, 
032     this list of conditions and the following disclaimer in the documentation 
033     and/or other materials provided with the distribution.
034   * Neither the name of HL7 nor the names of its contributors may be used to 
035     endorse or promote products derived from this software without specific 
036     prior written permission.
037  
038  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
039  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
040  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
041  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
042  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
043  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
044  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
045  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
046  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
047  POSSIBILITY OF SUCH DAMAGE.
048  
049*/
050// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
051public class CapabilityStatement40_50 {
052
053  public static org.hl7.fhir.r5.model.CapabilityStatement convertCapabilityStatement(org.hl7.fhir.r4.model.CapabilityStatement src) throws FHIRException {
054    if (src == null)
055      return null;
056    org.hl7.fhir.r5.model.CapabilityStatement tgt = new org.hl7.fhir.r5.model.CapabilityStatement();
057    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
058    if (src.hasUrl())
059      tgt.setUrlElement(Uri40_50.convertUri(src.getUrlElement()));
060    if (src.hasVersion())
061      tgt.setVersionElement(String40_50.convertString(src.getVersionElement()));
062    if (src.hasName())
063      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
064    if (src.hasTitle())
065      tgt.setTitleElement(String40_50.convertString(src.getTitleElement()));
066    if (src.hasStatus())
067      tgt.setStatusElement(Enumerations40_50.convertPublicationStatus(src.getStatusElement()));
068    if (src.hasExperimental())
069      tgt.setExperimentalElement(Boolean40_50.convertBoolean(src.getExperimentalElement()));
070    if (src.hasDate())
071      tgt.setDateElement(DateTime40_50.convertDateTime(src.getDateElement()));
072    if (src.hasPublisher())
073      tgt.setPublisherElement(String40_50.convertString(src.getPublisherElement()));
074    for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
075      tgt.addContact(ContactDetail40_50.convertContactDetail(t));
076    if (src.hasDescription())
077      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
078    for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext())
079      tgt.addUseContext(UsageContext40_50.convertUsageContext(t));
080    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction())
081      tgt.addJurisdiction(CodeableConcept40_50.convertCodeableConcept(t));
082    if (src.hasPurpose())
083      tgt.setPurposeElement(MarkDown40_50.convertMarkdown(src.getPurposeElement()));
084    if (src.hasCopyright())
085      tgt.setCopyrightElement(MarkDown40_50.convertMarkdown(src.getCopyrightElement()));
086    if (src.hasKind())
087      tgt.setKindElement(convertCapabilityStatementKind(src.getKindElement()));
088    for (org.hl7.fhir.r4.model.CanonicalType t : src.getInstantiates())
089      tgt.getInstantiates().add(Canonical40_50.convertCanonical(t));
090    for (org.hl7.fhir.r4.model.CanonicalType t : src.getImports())
091      tgt.getImports().add(Canonical40_50.convertCanonical(t));
092    if (src.hasSoftware())
093      tgt.setSoftware(convertCapabilityStatementSoftwareComponent(src.getSoftware()));
094    if (src.hasImplementation())
095      tgt.setImplementation(convertCapabilityStatementImplementationComponent(src.getImplementation()));
096    if (src.hasFhirVersion())
097      tgt.setFhirVersionElement(Enumerations40_50.convertFHIRVersion(src.getFhirVersionElement()));
098    for (org.hl7.fhir.r4.model.CodeType t : src.getFormat()) tgt.getFormat().add(Code40_50.convertCode(t));
099    for (org.hl7.fhir.r4.model.CodeType t : src.getPatchFormat()) tgt.getPatchFormat().add(Code40_50.convertCode(t));
100    for (org.hl7.fhir.r4.model.CanonicalType t : src.getImplementationGuide())
101      tgt.getImplementationGuide().add(Canonical40_50.convertCanonical(t));
102    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest())
103      tgt.addRest(convertCapabilityStatementRestComponent(t));
104    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging())
105      tgt.addMessaging(convertCapabilityStatementMessagingComponent(t));
106    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument())
107      tgt.addDocument(convertCapabilityStatementDocumentComponent(t));
108    return tgt;
109  }
110
111  public static org.hl7.fhir.r4.model.CapabilityStatement convertCapabilityStatement(org.hl7.fhir.r5.model.CapabilityStatement src) throws FHIRException {
112    if (src == null)
113      return null;
114    org.hl7.fhir.r4.model.CapabilityStatement tgt = new org.hl7.fhir.r4.model.CapabilityStatement();
115    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
116    if (src.hasUrl())
117      tgt.setUrlElement(Uri40_50.convertUri(src.getUrlElement()));
118    if (src.hasVersion())
119      tgt.setVersionElement(String40_50.convertString(src.getVersionElement()));
120    if (src.hasName())
121      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
122    if (src.hasTitle())
123      tgt.setTitleElement(String40_50.convertString(src.getTitleElement()));
124    if (src.hasStatus())
125      tgt.setStatusElement(Enumerations40_50.convertPublicationStatus(src.getStatusElement()));
126    if (src.hasExperimental())
127      tgt.setExperimentalElement(Boolean40_50.convertBoolean(src.getExperimentalElement()));
128    if (src.hasDate())
129      tgt.setDateElement(DateTime40_50.convertDateTime(src.getDateElement()));
130    if (src.hasPublisher())
131      tgt.setPublisherElement(String40_50.convertString(src.getPublisherElement()));
132    for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact())
133      tgt.addContact(ContactDetail40_50.convertContactDetail(t));
134    if (src.hasDescription())
135      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
136    for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext())
137      tgt.addUseContext(UsageContext40_50.convertUsageContext(t));
138    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction())
139      tgt.addJurisdiction(CodeableConcept40_50.convertCodeableConcept(t));
140    if (src.hasPurpose())
141      tgt.setPurposeElement(MarkDown40_50.convertMarkdown(src.getPurposeElement()));
142    if (src.hasCopyright())
143      tgt.setCopyrightElement(MarkDown40_50.convertMarkdown(src.getCopyrightElement()));
144    if (src.hasKind())
145      tgt.setKindElement(convertCapabilityStatementKind(src.getKindElement()));
146    for (org.hl7.fhir.r5.model.CanonicalType t : src.getInstantiates())
147      tgt.getInstantiates().add(Canonical40_50.convertCanonical(t));
148    for (org.hl7.fhir.r5.model.CanonicalType t : src.getImports())
149      tgt.getImports().add(Canonical40_50.convertCanonical(t));
150    if (src.hasSoftware())
151      tgt.setSoftware(convertCapabilityStatementSoftwareComponent(src.getSoftware()));
152    if (src.hasImplementation())
153      tgt.setImplementation(convertCapabilityStatementImplementationComponent(src.getImplementation()));
154    if (src.hasFhirVersion())
155      tgt.setFhirVersionElement(Enumerations40_50.convertFHIRVersion(src.getFhirVersionElement()));
156    for (org.hl7.fhir.r5.model.CodeType t : src.getFormat()) tgt.getFormat().add(Code40_50.convertCode(t));
157    for (org.hl7.fhir.r5.model.CodeType t : src.getPatchFormat()) tgt.getPatchFormat().add(Code40_50.convertCode(t));
158    for (org.hl7.fhir.r5.model.CanonicalType t : src.getImplementationGuide())
159      tgt.getImplementationGuide().add(Canonical40_50.convertCanonical(t));
160    for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest())
161      tgt.addRest(convertCapabilityStatementRestComponent(t));
162    for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging())
163      tgt.addMessaging(convertCapabilityStatementMessagingComponent(t));
164    for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument())
165      tgt.addDocument(convertCapabilityStatementDocumentComponent(t));
166    return tgt;
167  }
168
169  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind> convertCapabilityStatementKind(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind> src) throws FHIRException {
170    if (src == null || src.isEmpty())
171      return null;
172    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKindEnumFactory());
173    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
174    switch (src.getValue()) {
175      case INSTANCE:
176        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.INSTANCE);
177        break;
178      case CAPABILITY:
179        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.CAPABILITY);
180        break;
181      case REQUIREMENTS:
182        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.REQUIREMENTS);
183        break;
184      default:
185        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind.NULL);
186        break;
187    }
188    return tgt;
189  }
190
191  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind> convertCapabilityStatementKind(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.CapabilityStatementKind> src) throws FHIRException {
192    if (src == null || src.isEmpty())
193      return null;
194    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());
195    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
196    switch (src.getValue()) {
197      case INSTANCE:
198        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.INSTANCE);
199        break;
200      case CAPABILITY:
201        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY);
202        break;
203      case REQUIREMENTS:
204        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS);
205        break;
206      default:
207        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.NULL);
208        break;
209    }
210    return tgt;
211  }
212
213  public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertCapabilityStatementSoftwareComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException {
214    if (src == null)
215      return null;
216    org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent();
217    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
218    if (src.hasName())
219      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
220    if (src.hasVersion())
221      tgt.setVersionElement(String40_50.convertString(src.getVersionElement()));
222    if (src.hasReleaseDate())
223      tgt.setReleaseDateElement(DateTime40_50.convertDateTime(src.getReleaseDateElement()));
224    return tgt;
225  }
226
227  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertCapabilityStatementSoftwareComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException {
228    if (src == null)
229      return null;
230    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent();
231    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
232    if (src.hasName())
233      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
234    if (src.hasVersion())
235      tgt.setVersionElement(String40_50.convertString(src.getVersionElement()));
236    if (src.hasReleaseDate())
237      tgt.setReleaseDateElement(DateTime40_50.convertDateTime(src.getReleaseDateElement()));
238    return tgt;
239  }
240
241  public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent convertCapabilityStatementImplementationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException {
242    if (src == null)
243      return null;
244    org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent();
245    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
246    if (src.hasDescription())
247      tgt.setDescriptionElement(String40_50.convertStringToMarkdown(src.getDescriptionElement()));
248    if (src.hasUrl())
249      tgt.setUrlElement(Url40_50.convertUrl(src.getUrlElement()));
250    if (src.hasCustodian())
251      tgt.setCustodian(Reference40_50.convertReference(src.getCustodian()));
252    return tgt;
253  }
254
255  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent convertCapabilityStatementImplementationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException {
256    if (src == null)
257      return null;
258    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent();
259    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
260    if (src.hasDescription())
261      tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement()));
262    if (src.hasUrl())
263      tgt.setUrlElement(Url40_50.convertUrl(src.getUrlElement()));
264    if (src.hasCustodian())
265      tgt.setCustodian(Reference40_50.convertReference(src.getCustodian()));
266    return tgt;
267  }
268
269  public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent convertCapabilityStatementRestComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException {
270    if (src == null)
271      return null;
272    org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent();
273    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
274    if (src.hasMode())
275      tgt.setModeElement(convertRestfulCapabilityMode(src.getModeElement()));
276    if (src.hasDocumentation())
277      tgt.setDocumentationElement(MarkDown40_50.convertMarkdown(src.getDocumentationElement()));
278    if (src.hasSecurity())
279      tgt.setSecurity(convertCapabilityStatementRestSecurityComponent(src.getSecurity()));
280    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource())
281      tgt.addResource(convertCapabilityStatementRestResourceComponent(t));
282    for (org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction())
283      tgt.addInteraction(convertSystemInteractionComponent(t));
284    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam())
285      tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t));
286    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation())
287      tgt.addOperation(convertCapabilityStatementRestResourceOperationComponent(t));
288    for (org.hl7.fhir.r4.model.CanonicalType t : src.getCompartment())
289      tgt.getCompartment().add(Canonical40_50.convertCanonical(t));
290    return tgt;
291  }
292
293  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent convertCapabilityStatementRestComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException {
294    if (src == null)
295      return null;
296    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent();
297    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
298    if (src.hasMode())
299      tgt.setModeElement(convertRestfulCapabilityMode(src.getModeElement()));
300    if (src.hasDocumentation())
301      tgt.setDocumentationElement(MarkDown40_50.convertMarkdown(src.getDocumentationElement()));
302    if (src.hasSecurity())
303      tgt.setSecurity(convertCapabilityStatementRestSecurityComponent(src.getSecurity()));
304    for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource())
305      tgt.addResource(convertCapabilityStatementRestResourceComponent(t));
306    for (org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction())
307      tgt.addInteraction(convertSystemInteractionComponent(t));
308    for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam())
309      tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t));
310    for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation())
311      tgt.addOperation(convertCapabilityStatementRestResourceOperationComponent(t));
312    for (org.hl7.fhir.r5.model.CanonicalType t : src.getCompartment())
313      tgt.getCompartment().add(Canonical40_50.convertCanonical(t));
314    return tgt;
315  }
316
317  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode> convertRestfulCapabilityMode(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode> src) throws FHIRException {
318    if (src == null || src.isEmpty())
319      return null;
320    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityModeEnumFactory());
321    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
322    switch (src.getValue()) {
323      case CLIENT:
324        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode.CLIENT);
325        break;
326      case SERVER:
327        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode.SERVER);
328        break;
329      default:
330        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode.NULL);
331        break;
332    }
333    return tgt;
334  }
335
336  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode> convertRestfulCapabilityMode(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode> src) throws FHIRException {
337    if (src == null || src.isEmpty())
338      return null;
339    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());
340    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
341    switch (src.getValue()) {
342      case CLIENT:
343        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.CLIENT);
344        break;
345      case SERVER:
346        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.SERVER);
347        break;
348      default:
349        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.NULL);
350        break;
351    }
352    return tgt;
353  }
354
355  public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertCapabilityStatementRestSecurityComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException {
356    if (src == null)
357      return null;
358    org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent();
359    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
360    if (src.hasCors())
361      tgt.setCorsElement(Boolean40_50.convertBoolean(src.getCorsElement()));
362    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getService())
363      tgt.addService(CodeableConcept40_50.convertCodeableConcept(t));
364    if (src.hasDescription())
365      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
366    return tgt;
367  }
368
369  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertCapabilityStatementRestSecurityComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException {
370    if (src == null)
371      return null;
372    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent();
373    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
374    if (src.hasCors())
375      tgt.setCorsElement(Boolean40_50.convertBoolean(src.getCorsElement()));
376    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getService())
377      tgt.addService(CodeableConcept40_50.convertCodeableConcept(t));
378    if (src.hasDescription())
379      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
380    return tgt;
381  }
382
383  public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertCapabilityStatementRestResourceComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException {
384    if (src == null)
385      return null;
386    org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent();
387    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
388    if (src.hasType())
389      tgt.setTypeElement(Code40_50.convertCode(src.getTypeElement()));
390    if (src.hasProfile())
391      tgt.setProfileElement(Canonical40_50.convertCanonical(src.getProfileElement()));
392    for (org.hl7.fhir.r4.model.CanonicalType t : src.getSupportedProfile())
393      tgt.getSupportedProfile().add(Canonical40_50.convertCanonical(t));
394    if (src.hasDocumentation())
395      tgt.setDocumentationElement(MarkDown40_50.convertMarkdown(src.getDocumentationElement()));
396    for (org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction())
397      tgt.addInteraction(convertResourceInteractionComponent(t));
398    if (src.hasVersioning())
399      tgt.setVersioningElement(convertResourceVersionPolicy(src.getVersioningElement()));
400    if (src.hasReadHistory())
401      tgt.setReadHistoryElement(Boolean40_50.convertBoolean(src.getReadHistoryElement()));
402    if (src.hasUpdateCreate())
403      tgt.setUpdateCreateElement(Boolean40_50.convertBoolean(src.getUpdateCreateElement()));
404    if (src.hasConditionalCreate())
405      tgt.setConditionalCreateElement(Boolean40_50.convertBoolean(src.getConditionalCreateElement()));
406    if (src.hasConditionalRead())
407      tgt.setConditionalReadElement(convertConditionalReadStatus(src.getConditionalReadElement()));
408    if (src.hasConditionalUpdate())
409      tgt.setConditionalUpdateElement(Boolean40_50.convertBoolean(src.getConditionalUpdateElement()));
410    if (src.hasConditionalDelete())
411      tgt.setConditionalDeleteElement(convertConditionalDeleteStatus(src.getConditionalDeleteElement()));
412    tgt.setReferencePolicy(src.getReferencePolicy().stream()
413      .map(CapabilityStatement40_50::convertReferenceHandlingPolicy)
414      .collect(Collectors.toList()));
415    for (org.hl7.fhir.r4.model.StringType t : src.getSearchInclude())
416      tgt.getSearchInclude().add(String40_50.convertString(t));
417    for (org.hl7.fhir.r4.model.StringType t : src.getSearchRevInclude())
418      tgt.getSearchRevInclude().add(String40_50.convertString(t));
419    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam())
420      tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t));
421    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation())
422      tgt.addOperation(convertCapabilityStatementRestResourceOperationComponent(t));
423    return tgt;
424  }
425
426  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertCapabilityStatementRestResourceComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException {
427    if (src == null)
428      return null;
429    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent();
430    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
431    if (src.hasType())
432      tgt.setTypeElement(Code40_50.convertCode(src.getTypeElement()));
433    if (src.hasProfile())
434      tgt.setProfileElement(Canonical40_50.convertCanonical(src.getProfileElement()));
435    for (org.hl7.fhir.r5.model.CanonicalType t : src.getSupportedProfile())
436      tgt.getSupportedProfile().add(Canonical40_50.convertCanonical(t));
437    if (src.hasDocumentation())
438      tgt.setDocumentationElement(MarkDown40_50.convertMarkdown(src.getDocumentationElement()));
439    for (org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction())
440      tgt.addInteraction(convertResourceInteractionComponent(t));
441    if (src.hasVersioning())
442      tgt.setVersioningElement(convertResourceVersionPolicy(src.getVersioningElement()));
443    if (src.hasReadHistory())
444      tgt.setReadHistoryElement(Boolean40_50.convertBoolean(src.getReadHistoryElement()));
445    if (src.hasUpdateCreate())
446      tgt.setUpdateCreateElement(Boolean40_50.convertBoolean(src.getUpdateCreateElement()));
447    if (src.hasConditionalCreate())
448      tgt.setConditionalCreateElement(Boolean40_50.convertBoolean(src.getConditionalCreateElement()));
449    if (src.hasConditionalRead())
450      tgt.setConditionalReadElement(convertConditionalReadStatus(src.getConditionalReadElement()));
451    if (src.hasConditionalUpdate())
452      tgt.setConditionalUpdateElement(Boolean40_50.convertBoolean(src.getConditionalUpdateElement()));
453    if (src.hasConditionalDelete())
454      tgt.setConditionalDeleteElement(convertConditionalDeleteStatus(src.getConditionalDeleteElement()));
455    tgt.setReferencePolicy(src.getReferencePolicy().stream()
456      .map(CapabilityStatement40_50::convertReferenceHandlingPolicy)
457      .collect(Collectors.toList()));
458    for (org.hl7.fhir.r5.model.StringType t : src.getSearchInclude())
459      tgt.getSearchInclude().add(String40_50.convertString(t));
460    for (org.hl7.fhir.r5.model.StringType t : src.getSearchRevInclude())
461      tgt.getSearchRevInclude().add(String40_50.convertString(t));
462    for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam())
463      tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t));
464    for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation())
465      tgt.addOperation(convertCapabilityStatementRestResourceOperationComponent(t));
466    return tgt;
467  }
468
469  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy> convertResourceVersionPolicy(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy> src) throws FHIRException {
470    if (src == null || src.isEmpty())
471      return null;
472    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicyEnumFactory());
473    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
474    switch (src.getValue()) {
475      case NOVERSION:
476        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION);
477        break;
478      case VERSIONED:
479        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED);
480        break;
481      case VERSIONEDUPDATE:
482        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE);
483        break;
484      default:
485        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NULL);
486        break;
487    }
488    return tgt;
489  }
490
491  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy> convertResourceVersionPolicy(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy> src) throws FHIRException {
492    if (src == null || src.isEmpty())
493      return null;
494    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());
495    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
496    switch (src.getValue()) {
497      case NOVERSION:
498        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION);
499        break;
500      case VERSIONED:
501        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED);
502        break;
503      case VERSIONEDUPDATE:
504        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE);
505        break;
506      default:
507        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NULL);
508        break;
509    }
510    return tgt;
511  }
512
513  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus> convertConditionalReadStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus> src) throws FHIRException {
514    if (src == null || src.isEmpty())
515      return null;
516    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatusEnumFactory());
517    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
518    switch (src.getValue()) {
519      case NOTSUPPORTED:
520        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.NOTSUPPORTED);
521        break;
522      case MODIFIEDSINCE:
523        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.MODIFIEDSINCE);
524        break;
525      case NOTMATCH:
526        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.NOTMATCH);
527        break;
528      case FULLSUPPORT:
529        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.FULLSUPPORT);
530        break;
531      default:
532        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.NULL);
533        break;
534    }
535    return tgt;
536  }
537
538  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus> convertConditionalReadStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus> src) throws FHIRException {
539    if (src == null || src.isEmpty())
540      return null;
541    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());
542    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
543    switch (src.getValue()) {
544      case NOTSUPPORTED:
545        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.NOTSUPPORTED);
546        break;
547      case MODIFIEDSINCE:
548        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.MODIFIEDSINCE);
549        break;
550      case NOTMATCH:
551        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.NOTMATCH);
552        break;
553      case FULLSUPPORT:
554        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.FULLSUPPORT);
555        break;
556      default:
557        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.NULL);
558        break;
559    }
560    return tgt;
561  }
562
563  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus> convertConditionalDeleteStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus> src) throws FHIRException {
564    if (src == null || src.isEmpty())
565      return null;
566    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatusEnumFactory());
567    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
568    switch (src.getValue()) {
569      case NOTSUPPORTED:
570        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED);
571        break;
572      case SINGLE:
573        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE);
574        break;
575      case MULTIPLE:
576        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE);
577        break;
578      default:
579        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NULL);
580        break;
581    }
582    return tgt;
583  }
584
585  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus> convertConditionalDeleteStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus> src) throws FHIRException {
586    if (src == null || src.isEmpty())
587      return null;
588    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());
589    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
590    switch (src.getValue()) {
591      case NOTSUPPORTED:
592        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED);
593        break;
594      case SINGLE:
595        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE);
596        break;
597      case MULTIPLE:
598        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE);
599        break;
600      default:
601        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NULL);
602        break;
603    }
604    return tgt;
605  }
606
607  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy> convertReferenceHandlingPolicy(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy> src) throws FHIRException {
608    if (src == null || src.isEmpty())
609      return null;
610    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicyEnumFactory());
611    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
612    switch (src.getValue()) {
613      case LITERAL:
614        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.LITERAL);
615        break;
616      case LOGICAL:
617        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.LOGICAL);
618        break;
619      case RESOLVES:
620        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.RESOLVES);
621        break;
622      case ENFORCED:
623        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.ENFORCED);
624        break;
625      case LOCAL:
626        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.LOCAL);
627        break;
628      default:
629        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.NULL);
630        break;
631    }
632    return tgt;
633  }
634
635  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy> convertReferenceHandlingPolicy(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy> src) throws FHIRException {
636    if (src == null || src.isEmpty())
637      return null;
638    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());
639    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
640    switch (src.getValue()) {
641      case LITERAL:
642        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.LITERAL);
643        break;
644      case LOGICAL:
645        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.LOGICAL);
646        break;
647      case RESOLVES:
648        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.RESOLVES);
649        break;
650      case ENFORCED:
651        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.ENFORCED);
652        break;
653      case LOCAL:
654        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.LOCAL);
655        break;
656      default:
657        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.NULL);
658        break;
659    }
660    return tgt;
661  }
662
663  public static org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException {
664    if (src == null)
665      return null;
666    org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent();
667    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
668    if (src.hasCode())
669      tgt.setCodeElement(convertTypeRestfulInteraction(src.getCodeElement()));
670    if (src.hasDocumentation())
671      tgt.setDocumentationElement(MarkDown40_50.convertMarkdown(src.getDocumentationElement()));
672    return tgt;
673  }
674
675  public static org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException {
676    if (src == null)
677      return null;
678    org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent();
679    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
680    if (src.hasCode())
681      tgt.setCodeElement(convertTypeRestfulInteraction(src.getCodeElement()));
682    if (src.hasDocumentation())
683      tgt.setDocumentationElement(MarkDown40_50.convertMarkdown(src.getDocumentationElement()));
684    return tgt;
685  }
686
687  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction> convertTypeRestfulInteraction(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction> src) throws FHIRException {
688    if (src == null || src.isEmpty())
689      return null;
690    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteractionEnumFactory());
691    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
692    switch (src.getValue()) {
693      case READ:
694        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.READ);
695        break;
696      case VREAD:
697        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.VREAD);
698        break;
699      case UPDATE:
700        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.UPDATE);
701        break;
702      case PATCH:
703        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.PATCH);
704        break;
705      case DELETE:
706        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.DELETE);
707        break;
708      case HISTORYINSTANCE:
709        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE);
710        break;
711      case HISTORYTYPE:
712        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE);
713        break;
714      case CREATE:
715        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.CREATE);
716        break;
717      case SEARCHTYPE:
718        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE);
719        break;
720      default:
721        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.NULL);
722        break;
723    }
724    return tgt;
725  }
726
727  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction> convertTypeRestfulInteraction(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction> src) throws FHIRException {
728    if (src == null || src.isEmpty())
729      return null;
730    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());
731    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
732    switch (src.getValue()) {
733      case READ:
734        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.READ);
735        break;
736      case VREAD:
737        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.VREAD);
738        break;
739      case UPDATE:
740        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.UPDATE);
741        break;
742      case PATCH:
743        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.PATCH);
744        break;
745      case DELETE:
746        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.DELETE);
747        break;
748      case HISTORYINSTANCE:
749        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE);
750        break;
751      case HISTORYTYPE:
752        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE);
753        break;
754      case CREATE:
755        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.CREATE);
756        break;
757      case SEARCHTYPE:
758        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE);
759        break;
760      default:
761        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.NULL);
762        break;
763    }
764    return tgt;
765  }
766
767  public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertCapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException {
768    if (src == null)
769      return null;
770    org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
771    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
772    if (src.hasName())
773      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
774    if (src.hasDefinition())
775      tgt.setDefinitionElement(Canonical40_50.convertCanonical(src.getDefinitionElement()));
776    if (src.hasType())
777      tgt.setTypeElement(Enumerations40_50.convertSearchParamType(src.getTypeElement()));
778    if (src.hasDocumentation())
779      tgt.setDocumentationElement(MarkDown40_50.convertMarkdown(src.getDocumentationElement()));
780    return tgt;
781  }
782
783  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertCapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException {
784    if (src == null)
785      return null;
786    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
787    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
788    if (src.hasName())
789      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
790    if (src.hasDefinition())
791      tgt.setDefinitionElement(Canonical40_50.convertCanonical(src.getDefinitionElement()));
792    if (src.hasType())
793      tgt.setTypeElement(Enumerations40_50.convertSearchParamType(src.getTypeElement()));
794    if (src.hasDocumentation())
795      tgt.setDocumentationElement(MarkDown40_50.convertMarkdown(src.getDocumentationElement()));
796    return tgt;
797  }
798
799  public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertCapabilityStatementRestResourceOperationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException {
800    if (src == null)
801      return null;
802    org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent();
803    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
804    if (src.hasName())
805      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
806    if (src.hasDefinition())
807      tgt.setDefinitionElement(Canonical40_50.convertCanonical(src.getDefinitionElement()));
808    if (src.hasDocumentation())
809      tgt.setDocumentationElement(MarkDown40_50.convertMarkdown(src.getDocumentationElement()));
810    return tgt;
811  }
812
813  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertCapabilityStatementRestResourceOperationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException {
814    if (src == null)
815      return null;
816    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent();
817    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
818    if (src.hasName())
819      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
820    if (src.hasDefinition())
821      tgt.setDefinitionElement(Canonical40_50.convertCanonical(src.getDefinitionElement()));
822    if (src.hasDocumentation())
823      tgt.setDocumentationElement(MarkDown40_50.convertMarkdown(src.getDocumentationElement()));
824    return tgt;
825  }
826
827  public static org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException {
828    if (src == null)
829      return null;
830    org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent();
831    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
832    if (src.hasCode())
833      tgt.setCodeElement(convertSystemRestfulInteraction(src.getCodeElement()));
834    if (src.hasDocumentation())
835      tgt.setDocumentationElement(MarkDown40_50.convertMarkdown(src.getDocumentationElement()));
836    return tgt;
837  }
838
839  public static org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException {
840    if (src == null)
841      return null;
842    org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent();
843    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
844    if (src.hasCode())
845      tgt.setCodeElement(convertSystemRestfulInteraction(src.getCodeElement()));
846    if (src.hasDocumentation())
847      tgt.setDocumentationElement(MarkDown40_50.convertMarkdown(src.getDocumentationElement()));
848    return tgt;
849  }
850
851  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction> convertSystemRestfulInteraction(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction> src) throws FHIRException {
852    if (src == null || src.isEmpty())
853      return null;
854    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteractionEnumFactory());
855    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
856    switch (src.getValue()) {
857      case TRANSACTION:
858        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION);
859        break;
860      case BATCH:
861        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.BATCH);
862        break;
863      case SEARCHSYSTEM:
864        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM);
865        break;
866      case HISTORYSYSTEM:
867        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM);
868        break;
869      default:
870        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.NULL);
871        break;
872    }
873    return tgt;
874  }
875
876  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction> convertSystemRestfulInteraction(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction> src) throws FHIRException {
877    if (src == null || src.isEmpty())
878      return null;
879    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());
880    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
881    switch (src.getValue()) {
882      case TRANSACTION:
883        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION);
884        break;
885      case BATCH:
886        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.BATCH);
887        break;
888      case SEARCHSYSTEM:
889        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM);
890        break;
891      case HISTORYSYSTEM:
892        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM);
893        break;
894      default:
895        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.NULL);
896        break;
897    }
898    return tgt;
899  }
900
901  public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent convertCapabilityStatementMessagingComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException {
902    if (src == null)
903      return null;
904    org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent();
905    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
906    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint())
907      tgt.addEndpoint(convertCapabilityStatementMessagingEndpointComponent(t));
908    if (src.hasReliableCache())
909      tgt.setReliableCacheElement(UnsignedInt40_50.convertUnsignedInt(src.getReliableCacheElement()));
910    if (src.hasDocumentation())
911      tgt.setDocumentationElement(MarkDown40_50.convertMarkdown(src.getDocumentationElement()));
912    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent t : src.getSupportedMessage())
913      tgt.addSupportedMessage(convertCapabilityStatementMessagingSupportedMessageComponent(t));
914    return tgt;
915  }
916
917  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent convertCapabilityStatementMessagingComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException {
918    if (src == null)
919      return null;
920    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent();
921    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
922    for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint())
923      tgt.addEndpoint(convertCapabilityStatementMessagingEndpointComponent(t));
924    if (src.hasReliableCache())
925      tgt.setReliableCacheElement(UnsignedInt40_50.convertUnsignedInt(src.getReliableCacheElement()));
926    if (src.hasDocumentation())
927      tgt.setDocumentationElement(MarkDown40_50.convertMarkdown(src.getDocumentationElement()));
928    for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent t : src.getSupportedMessage())
929      tgt.addSupportedMessage(convertCapabilityStatementMessagingSupportedMessageComponent(t));
930    return tgt;
931  }
932
933  public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertCapabilityStatementMessagingEndpointComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException {
934    if (src == null)
935      return null;
936    org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
937    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
938    if (src.hasProtocol())
939      tgt.setProtocol(Coding40_50.convertCoding(src.getProtocol()));
940    if (src.hasAddress())
941      tgt.setAddressElement(Url40_50.convertUrl(src.getAddressElement()));
942    return tgt;
943  }
944
945  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertCapabilityStatementMessagingEndpointComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException {
946    if (src == null)
947      return null;
948    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
949    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
950    if (src.hasProtocol())
951      tgt.setProtocol(Coding40_50.convertCoding(src.getProtocol()));
952    if (src.hasAddress())
953      tgt.setAddressElement(Url40_50.convertUrl(src.getAddressElement()));
954    return tgt;
955  }
956
957  public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent convertCapabilityStatementMessagingSupportedMessageComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent src) throws FHIRException {
958    if (src == null)
959      return null;
960    org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
961    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
962    if (src.hasMode())
963      tgt.setModeElement(convertEventCapabilityMode(src.getModeElement()));
964    if (src.hasDefinition())
965      tgt.setDefinitionElement(Canonical40_50.convertCanonical(src.getDefinitionElement()));
966    return tgt;
967  }
968
969  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent convertCapabilityStatementMessagingSupportedMessageComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent src) throws FHIRException {
970    if (src == null)
971      return null;
972    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
973    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
974    if (src.hasMode())
975      tgt.setModeElement(convertEventCapabilityMode(src.getModeElement()));
976    if (src.hasDefinition())
977      tgt.setDefinitionElement(Canonical40_50.convertCanonical(src.getDefinitionElement()));
978    return tgt;
979  }
980
981  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode> convertEventCapabilityMode(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode> src) throws FHIRException {
982    if (src == null || src.isEmpty())
983      return null;
984    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityModeEnumFactory());
985    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
986    switch (src.getValue()) {
987      case SENDER:
988        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.SENDER);
989        break;
990      case RECEIVER:
991        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.RECEIVER);
992        break;
993      default:
994        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.NULL);
995        break;
996    }
997    return tgt;
998  }
999
1000  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode> convertEventCapabilityMode(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode> src) throws FHIRException {
1001    if (src == null || src.isEmpty())
1002      return null;
1003    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());
1004    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
1005    switch (src.getValue()) {
1006      case SENDER:
1007        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.SENDER);
1008        break;
1009      case RECEIVER:
1010        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.RECEIVER);
1011        break;
1012      default:
1013        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.NULL);
1014        break;
1015    }
1016    return tgt;
1017  }
1018
1019  public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent convertCapabilityStatementDocumentComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException {
1020    if (src == null)
1021      return null;
1022    org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent();
1023    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
1024    if (src.hasMode())
1025      tgt.setModeElement(convertDocumentMode(src.getModeElement()));
1026    if (src.hasDocumentation())
1027      tgt.setDocumentationElement(MarkDown40_50.convertMarkdown(src.getDocumentationElement()));
1028    if (src.hasProfile())
1029      tgt.setProfileElement(Canonical40_50.convertCanonical(src.getProfileElement()));
1030    return tgt;
1031  }
1032
1033  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent convertCapabilityStatementDocumentComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException {
1034    if (src == null)
1035      return null;
1036    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent();
1037    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
1038    if (src.hasMode())
1039      tgt.setModeElement(convertDocumentMode(src.getModeElement()));
1040    if (src.hasDocumentation())
1041      tgt.setDocumentationElement(MarkDown40_50.convertMarkdown(src.getDocumentationElement()));
1042    if (src.hasProfile())
1043      tgt.setProfileElement(Canonical40_50.convertCanonical(src.getProfileElement()));
1044    return tgt;
1045  }
1046
1047  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode> convertDocumentMode(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode> src) throws FHIRException {
1048    if (src == null || src.isEmpty())
1049      return null;
1050    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.CapabilityStatement.DocumentModeEnumFactory());
1051    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
1052    switch (src.getValue()) {
1053      case PRODUCER:
1054        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.PRODUCER);
1055        break;
1056      case CONSUMER:
1057        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.CONSUMER);
1058        break;
1059      default:
1060        tgt.setValue(org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.NULL);
1061        break;
1062    }
1063    return tgt;
1064  }
1065
1066  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode> convertDocumentMode(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode> src) throws FHIRException {
1067    if (src == null || src.isEmpty())
1068      return null;
1069    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());
1070    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
1071    switch (src.getValue()) {
1072      case PRODUCER:
1073        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.PRODUCER);
1074        break;
1075      case CONSUMER:
1076        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.CONSUMER);
1077        break;
1078      default:
1079        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.NULL);
1080        break;
1081    }
1082    return tgt;
1083  }
1084}