001package org.hl7.fhir.convertors.conv10_40.resources10_40;
002
003import org.hl7.fhir.convertors.VersionConvertorConstants;
004import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_40;
005import org.hl7.fhir.convertors.context.ConversionContext10_40;
006import org.hl7.fhir.convertors.conv10_40.datatypes10_40.Reference10_40;
007import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.CodeableConcept10_40;
008import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.Coding10_40;
009import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.ContactPoint10_40;
010import org.hl7.fhir.convertors.conv10_40.datatypes10_40.primitivetypes10_40.*;
011import org.hl7.fhir.exceptions.FHIRException;
012import org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent;
013import org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent;
014import org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction;
015
016public class Conformance10_40 {
017
018  static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus> convertConditionalDeleteStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus> src) throws FHIRException {
019    if (src == null || src.isEmpty())
020      return null;
021    org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatusEnumFactory());
022    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
023    switch (src.getValue()) {
024      case NOTSUPPORTED:
025        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED);
026        break;
027      case SINGLE:
028        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.SINGLE);
029        break;
030      case MULTIPLE:
031        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.MULTIPLE);
032        break;
033      default:
034        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.NULL);
035        break;
036    }
037    return tgt;
038  }
039
040  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus> convertConditionalDeleteStatus(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus> src) throws FHIRException {
041    if (src == null || src.isEmpty())
042      return null;
043    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());
044    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
045    switch (src.getValue()) {
046      case NOTSUPPORTED:
047        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED);
048        break;
049      case SINGLE:
050        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE);
051        break;
052      case MULTIPLE:
053        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE);
054        break;
055      default:
056        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NULL);
057        break;
058    }
059    return tgt;
060  }
061
062  public static org.hl7.fhir.dstu2.model.Conformance convertConformance(org.hl7.fhir.r4.model.CapabilityStatement src, BaseAdvisor_10_40 advisor) throws FHIRException {
063    if (src == null || src.isEmpty())
064      return null;
065    org.hl7.fhir.dstu2.model.Conformance tgt = new org.hl7.fhir.dstu2.model.Conformance();
066    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyDomainResource(src, tgt);
067    if (src.hasUrlElement())
068      tgt.setUrlElement(Uri10_40.convertUri(src.getUrlElement()));
069    if (src.hasVersionElement())
070      tgt.setVersionElement(String10_40.convertString(src.getVersionElement()));
071    if (src.hasNameElement())
072      tgt.setNameElement(String10_40.convertString(src.getNameElement()));
073    if (src.hasStatus())
074      tgt.setStatusElement(Enumerations10_40.convertConformanceResourceStatus(src.getStatusElement()));
075    if (src.hasExperimental())
076      tgt.setExperimentalElement(Boolean10_40.convertBoolean(src.getExperimentalElement()));
077    if (src.hasDate())
078      tgt.setDateElement(DateTime10_40.convertDateTime(src.getDateElement()));
079    if (src.hasPublisherElement())
080      tgt.setPublisherElement(String10_40.convertString(src.getPublisherElement()));
081    for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
082      tgt.addContact(convertConformanceContactComponent(t));
083    if (src.hasDescription())
084      tgt.setDescription(src.getDescription());
085    if (src.hasPurpose())
086      tgt.setRequirements(src.getPurpose());
087    if (src.hasCopyright())
088      tgt.setCopyright(src.getCopyright());
089    if (src.hasKind())
090      tgt.setKindElement(convertConformanceStatementKind(src.getKindElement()));
091    if (src.hasSoftware())
092      tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware()));
093    if (src.hasImplementation())
094      tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation()));
095    if (src.hasFhirVersion())
096      tgt.setFhirVersion(src.getFhirVersion().toCode());
097    if (src.hasExtension("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"))
098      tgt.setAcceptUnknown(org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown").getValue().primitiveValue()));
099    for (org.hl7.fhir.r4.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue());
100    for (CapabilityStatementRestComponent r : src.getRest())
101      for (CapabilityStatementRestResourceComponent rr : r.getResource())
102        for (org.hl7.fhir.r4.model.CanonicalType t : rr.getSupportedProfile())
103          tgt.addProfile(Canonical10_40.convertCanonicalToReference(t));
104    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest())
105      tgt.addRest(convertConformanceRestComponent(t));
106    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging())
107      tgt.addMessaging(convertConformanceMessagingComponent(t));
108    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument())
109      tgt.addDocument(convertConformanceDocumentComponent(t));
110    return tgt;
111  }
112
113  public static org.hl7.fhir.r4.model.CapabilityStatement convertConformance(org.hl7.fhir.dstu2.model.Conformance src) throws FHIRException {
114    if (src == null || src.isEmpty())
115      return null;
116    org.hl7.fhir.r4.model.CapabilityStatement tgt = new org.hl7.fhir.r4.model.CapabilityStatement();
117    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyDomainResource(src, tgt);
118    if (src.hasUrlElement())
119      tgt.setUrlElement(Uri10_40.convertUri(src.getUrlElement()));
120    if (src.hasVersionElement())
121      tgt.setVersionElement(String10_40.convertString(src.getVersionElement()));
122    if (src.hasNameElement())
123      tgt.setNameElement(String10_40.convertString(src.getNameElement()));
124    if (src.hasStatus())
125      tgt.setStatusElement(Enumerations10_40.convertConformanceResourceStatus(src.getStatusElement()));
126    if (src.hasExperimental())
127      tgt.setExperimentalElement(Boolean10_40.convertBoolean(src.getExperimentalElement()));
128    if (src.hasDate())
129      tgt.setDateElement(DateTime10_40.convertDateTime(src.getDateElement()));
130    if (src.hasPublisherElement())
131      tgt.setPublisherElement(String10_40.convertString(src.getPublisherElement()));
132    for (org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent t : src.getContact())
133      tgt.addContact(convertConformanceContactComponent(t));
134    if (src.hasDescription())
135      tgt.setDescription(src.getDescription());
136    if (src.hasRequirements())
137      tgt.setPurpose(src.getRequirements());
138    if (src.hasCopyright())
139      tgt.setCopyright(src.getCopyright());
140    if (src.hasKind())
141      tgt.setKindElement(convertConformanceStatementKind(src.getKindElement()));
142    if (src.hasSoftware())
143      tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware()));
144    if (src.hasImplementation())
145      tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation()));
146    if (src.hasFhirVersion())
147      tgt.setFhirVersion(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion()));
148    if (src.hasAcceptUnknown())
149      tgt.addExtension().setUrl("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown").setValue(new org.hl7.fhir.r4.model.CodeType(src.getAcceptUnknownElement().asStringValue()));
150    for (org.hl7.fhir.dstu2.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue());
151    for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent t : src.getRest())
152      tgt.addRest(convertConformanceRestComponent(t));
153    for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent t : src.getMessaging())
154      tgt.addMessaging(convertConformanceMessagingComponent(t));
155    for (org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent t : src.getDocument())
156      tgt.addDocument(convertConformanceDocumentComponent(t));
157    return tgt;
158  }
159
160  public static org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent convertConformanceContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException {
161    if (src == null || src.isEmpty())
162      return null;
163    org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent();
164    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
165    if (src.hasNameElement())
166      tgt.setNameElement(String10_40.convertString(src.getNameElement()));
167    for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
168      tgt.addTelecom(ContactPoint10_40.convertContactPoint(t));
169    return tgt;
170  }
171
172  public static org.hl7.fhir.r4.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent src) throws FHIRException {
173    if (src == null || src.isEmpty())
174      return null;
175    org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail();
176    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
177    if (src.hasNameElement())
178      tgt.setNameElement(String10_40.convertString(src.getNameElement()));
179    for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom())
180      tgt.addTelecom(ContactPoint10_40.convertContactPoint(t));
181    return tgt;
182  }
183
184  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent src) throws FHIRException {
185    if (src == null || src.isEmpty())
186      return null;
187    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent();
188    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
189    if (src.hasMode())
190      tgt.setModeElement(convertDocumentMode(src.getModeElement()));
191    if (src.hasDocumentation())
192      tgt.setDocumentation(src.getDocumentation());
193    if (src.hasProfile())
194      tgt.setProfileElement(Canonical10_40.convertReferenceToCanonical(src.getProfile()));
195    return tgt;
196  }
197
198  public static org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException {
199    if (src == null || src.isEmpty())
200      return null;
201    org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent();
202    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
203    if (src.hasMode())
204      tgt.setModeElement(convertDocumentMode(src.getModeElement()));
205    if (src.hasDocumentation())
206      tgt.setDocumentation(src.getDocumentation());
207    if (src.hasProfileElement())
208      tgt.setProfile(Canonical10_40.convertCanonicalToReference(src.getProfileElement()));
209    return tgt;
210  }
211
212  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent src) throws FHIRException {
213    if (src == null || src.isEmpty())
214      return null;
215    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent();
216    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
217    if (src.hasDescriptionElement())
218      tgt.setDescriptionElement(String10_40.convertString(src.getDescriptionElement()));
219    if (src.hasUrl())
220      tgt.setUrl(src.getUrl());
221    return tgt;
222  }
223
224  public static org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException {
225    if (src == null || src.isEmpty())
226      return null;
227    org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent();
228    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
229    if (src.hasDescriptionElement())
230      tgt.setDescriptionElement(String10_40.convertString(src.getDescriptionElement()));
231    if (src.hasUrl())
232      tgt.setUrl(src.getUrl());
233    return tgt;
234  }
235
236  public static org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException {
237    if (src == null || src.isEmpty())
238      return null;
239    org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent();
240    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
241    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint())
242      tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t));
243    if (src.hasReliableCacheElement())
244      tgt.setReliableCacheElement(UnsignedInt10_40.convertUnsignedInt(src.getReliableCacheElement()));
245    if (src.hasDocumentation())
246      tgt.setDocumentation(src.getDocumentation());
247    for (org.hl7.fhir.r4.model.Extension e : src.getExtensionsByUrl(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)) {
248      org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent event = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent();
249      tgt.addEvent(event);
250      event.setCode(Coding10_40.convertCoding((org.hl7.fhir.r4.model.Coding) e.getExtensionByUrl("code").getValue()));
251      if (e.hasExtension("category"))
252        event.setCategory(org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString()));
253      event.setMode(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.fromCode(e.getExtensionByUrl("mode").getValue().toString()));
254      org.hl7.fhir.r4.model.Extension focusE = e.getExtensionByUrl("focus");
255      if (focusE.getValue().hasPrimitiveValue())
256        event.setFocus(focusE.getValue().toString());
257      else {
258        event.setFocusElement(new org.hl7.fhir.dstu2.model.CodeType());
259        ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(focusE.getValue(), event.getFocusElement());
260      }
261      event.setRequest(Reference10_40.convertReference((org.hl7.fhir.r4.model.Reference) e.getExtensionByUrl("request").getValue()));
262      event.setResponse(Reference10_40.convertReference((org.hl7.fhir.r4.model.Reference) e.getExtensionByUrl("response").getValue()));
263      if (e.hasExtension("documentation"))
264        event.setDocumentation(e.getExtensionByUrl("documentation").getValue().toString());
265    }
266    return tgt;
267  }
268
269  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent src) throws FHIRException {
270    if (src == null || src.isEmpty())
271      return null;
272    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent();
273    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
274    for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent t : src.getEndpoint())
275      tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t));
276    if (src.hasReliableCacheElement())
277      tgt.setReliableCacheElement(UnsignedInt10_40.convertUnsignedInt(src.getReliableCacheElement()));
278    if (src.hasDocumentation())
279      tgt.setDocumentation(src.getDocumentation());
280    for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) {
281      org.hl7.fhir.r4.model.Extension e = new org.hl7.fhir.r4.model.Extension(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT);
282      e.addExtension(new org.hl7.fhir.r4.model.Extension("code", Coding10_40.convertCoding(t.getCode())));
283      if (t.hasCategory())
284        e.addExtension(new org.hl7.fhir.r4.model.Extension("category", new org.hl7.fhir.r4.model.CodeType(t.getCategory().toCode())));
285      e.addExtension(new org.hl7.fhir.r4.model.Extension("mode", new org.hl7.fhir.r4.model.CodeType(t.getMode().toCode())));
286      if (t.getFocusElement().hasValue())
287        e.addExtension(new org.hl7.fhir.r4.model.Extension("focus", new org.hl7.fhir.r4.model.StringType(t.getFocus())));
288      else {
289        org.hl7.fhir.r4.model.CodeType focus = new org.hl7.fhir.r4.model.CodeType();
290        org.hl7.fhir.r4.model.Extension focusE = new org.hl7.fhir.r4.model.Extension("focus", focus);
291        ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(t.getFocusElement(), focus);
292        e.addExtension(focusE);
293      }
294      e.addExtension(new org.hl7.fhir.r4.model.Extension("request", Reference10_40.convertReference(t.getRequest())));
295      e.addExtension(new org.hl7.fhir.r4.model.Extension("response", Reference10_40.convertReference(t.getResponse())));
296      if (t.hasDocumentation())
297        e.addExtension(new org.hl7.fhir.r4.model.Extension("documentation", new org.hl7.fhir.r4.model.StringType(t.getDocumentation())));
298      tgt.addExtension(e);
299    }
300    return tgt;
301  }
302
303  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent src) throws FHIRException {
304    if (src == null || src.isEmpty())
305      return null;
306    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
307    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
308    if (src.hasProtocol())
309      tgt.setProtocol(Coding10_40.convertCoding(src.getProtocol()));
310    if (src.hasAddress())
311      tgt.setAddress(src.getAddress());
312    return tgt;
313  }
314
315  public static org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException {
316    if (src == null || src.isEmpty())
317      return null;
318    org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent();
319    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
320    if (src.hasProtocol())
321      tgt.setProtocol(Coding10_40.convertCoding(src.getProtocol()));
322    if (src.hasAddress())
323      tgt.setAddress(src.getAddress());
324    return tgt;
325  }
326
327  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent src) throws FHIRException {
328    if (src == null || src.isEmpty())
329      return null;
330    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent();
331    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
332    if (src.hasMode())
333      tgt.setModeElement(convertRestfulConformanceMode(src.getModeElement()));
334    if (src.hasDocumentation())
335      tgt.setDocumentation(src.getDocumentation());
336    if (src.hasSecurity())
337      tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity()));
338    for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent t : src.getResource())
339      tgt.addResource(convertConformanceRestResourceComponent(t));
340    for (org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent t : src.getInteraction())
341      tgt.addInteraction(convertSystemInteractionComponent(t));
342    if (src.getTransactionMode() == org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BATCH || src.getTransactionMode() == org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BOTH)
343      tgt.addInteraction().setCode(SystemRestfulInteraction.BATCH);
344    for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam())
345      tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t));
346    for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent t : src.getOperation())
347      tgt.addOperation(convertConformanceRestOperationComponent(t));
348    for (org.hl7.fhir.dstu2.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue());
349    return tgt;
350  }
351
352  public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException {
353    if (src == null || src.isEmpty())
354      return null;
355    org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent();
356    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
357    if (src.hasMode())
358      tgt.setModeElement(convertRestfulConformanceMode(src.getModeElement()));
359    if (src.hasDocumentation())
360      tgt.setDocumentation(src.getDocumentation());
361    if (src.hasSecurity())
362      tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity()));
363    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource())
364      tgt.addResource(convertConformanceRestResourceComponent(t));
365    boolean batch = false;
366    boolean transaction = false;
367    for (org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) {
368      if (t.getCode().equals(SystemRestfulInteraction.BATCH))
369        batch = true;
370      else
371        tgt.addInteraction(convertSystemInteractionComponent(t));
372      if (t.getCode().equals(SystemRestfulInteraction.TRANSACTION))
373        transaction = true;
374    }
375    if (batch)
376      tgt.setTransactionMode(transaction ? org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BOTH : org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BATCH);
377    else
378      tgt.setTransactionMode(transaction ? org.hl7.fhir.dstu2.model.Conformance.TransactionMode.TRANSACTION : org.hl7.fhir.dstu2.model.Conformance.TransactionMode.NOTSUPPORTED);
379    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam())
380      tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t));
381    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation())
382      tgt.addOperation(convertConformanceRestOperationComponent(t));
383    for (org.hl7.fhir.r4.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue());
384    return tgt;
385  }
386
387  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException {
388    if (src == null || src.isEmpty())
389      return null;
390    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent();
391    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
392    if (src.hasNameElement())
393      tgt.setNameElement(String10_40.convertString(src.getNameElement()));
394    if (src.hasDefinition())
395      tgt.setDefinitionElement(Canonical10_40.convertReferenceToCanonical(src.getDefinition()));
396    return tgt;
397  }
398
399  public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException {
400    if (src == null || src.isEmpty())
401      return null;
402    org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent();
403    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
404    if (src.hasNameElement())
405      tgt.setNameElement(String10_40.convertString(src.getNameElement()));
406    if (src.hasDefinitionElement())
407      tgt.setDefinition(Canonical10_40.convertCanonicalToReference(src.getDefinitionElement()));
408    return tgt;
409  }
410
411  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException {
412    if (src == null || src.isEmpty())
413      return null;
414    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent();
415    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
416    if (src.hasTypeElement())
417      tgt.setTypeElement(Code10_40.convertCode(src.getTypeElement()));
418    if (src.hasProfile())
419      tgt.setProfileElement(Canonical10_40.convertReferenceToCanonical(src.getProfile()));
420    for (org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent t : src.getInteraction())
421      tgt.addInteraction(convertResourceInteractionComponent(t));
422    if (src.hasVersioning())
423      tgt.setVersioningElement(convertResourceVersionPolicy(src.getVersioningElement()));
424    if (src.hasReadHistoryElement())
425      tgt.setReadHistoryElement(Boolean10_40.convertBoolean(src.getReadHistoryElement()));
426    if (src.hasUpdateCreateElement())
427      tgt.setUpdateCreateElement(Boolean10_40.convertBoolean(src.getUpdateCreateElement()));
428    if (src.hasConditionalCreateElement())
429      tgt.setConditionalCreateElement(Boolean10_40.convertBoolean(src.getConditionalCreateElement()));
430    if (src.hasConditionalUpdateElement())
431      tgt.setConditionalUpdateElement(Boolean10_40.convertBoolean(src.getConditionalUpdateElement()));
432    if (src.hasConditionalDelete())
433      tgt.setConditionalDeleteElement(convertConditionalDeleteStatus(src.getConditionalDeleteElement()));
434    for (org.hl7.fhir.dstu2.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue());
435    for (org.hl7.fhir.dstu2.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue());
436    for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam())
437      tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t));
438    return tgt;
439  }
440
441  public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException {
442    if (src == null || src.isEmpty())
443      return null;
444    org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent();
445    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
446    if (src.hasTypeElement())
447      tgt.setTypeElement(Code10_40.convertCode(src.getTypeElement()));
448    if (src.hasProfile())
449      tgt.setProfile(Canonical10_40.convertCanonicalToReference(src.getProfileElement()));
450    for (org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction())
451      tgt.addInteraction(convertResourceInteractionComponent(t));
452    if (src.hasVersioning())
453      tgt.setVersioningElement(convertResourceVersionPolicy(src.getVersioningElement()));
454    if (src.hasReadHistoryElement())
455      tgt.setReadHistoryElement(Boolean10_40.convertBoolean(src.getReadHistoryElement()));
456    if (src.hasUpdateCreateElement())
457      tgt.setUpdateCreateElement(Boolean10_40.convertBoolean(src.getUpdateCreateElement()));
458    if (src.hasConditionalCreateElement())
459      tgt.setConditionalCreateElement(Boolean10_40.convertBoolean(src.getConditionalCreateElement()));
460    if (src.hasConditionalUpdateElement())
461      tgt.setConditionalUpdateElement(Boolean10_40.convertBoolean(src.getConditionalUpdateElement()));
462    if (src.hasConditionalDelete())
463      tgt.setConditionalDeleteElement(convertConditionalDeleteStatus(src.getConditionalDeleteElement()));
464    for (org.hl7.fhir.r4.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue());
465    for (org.hl7.fhir.r4.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue());
466    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam())
467      tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t));
468    return tgt;
469  }
470
471  public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException {
472    if (src == null || src.isEmpty())
473      return null;
474    org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent();
475    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
476    if (src.hasNameElement())
477      tgt.setNameElement(String10_40.convertString(src.getNameElement()));
478    if (src.hasDefinition())
479      tgt.setDefinition(src.getDefinition());
480    if (src.hasType())
481      tgt.setTypeElement(Enumerations10_40.convertSearchParamType(src.getTypeElement()));
482    if (src.hasDocumentation())
483      tgt.setDocumentation(src.getDocumentation());
484    return tgt;
485  }
486
487  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException {
488    if (src == null || src.isEmpty())
489      return null;
490    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
491    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
492    if (src.hasNameElement())
493      tgt.setNameElement(String10_40.convertString(src.getNameElement()));
494    if (src.hasDefinition())
495      tgt.setDefinition(src.getDefinition());
496    if (src.hasType())
497      tgt.setTypeElement(Enumerations10_40.convertSearchParamType(src.getTypeElement()));
498    if (src.hasDocumentation())
499      tgt.setDocumentation(src.getDocumentation());
500    return tgt;
501  }
502
503  public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException {
504    if (src == null || src.isEmpty())
505      return null;
506    org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent();
507    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
508    if (src.hasCorsElement())
509      tgt.setCorsElement(Boolean10_40.convertBoolean(src.getCorsElement()));
510    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getService())
511      tgt.addService(CodeableConcept10_40.convertCodeableConcept(t));
512    if (src.hasDescription())
513      tgt.setDescription(src.getDescription());
514    return tgt;
515  }
516
517  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException {
518    if (src == null || src.isEmpty())
519      return null;
520    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent();
521    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
522    if (src.hasCorsElement())
523      tgt.setCorsElement(Boolean10_40.convertBoolean(src.getCorsElement()));
524    for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getService())
525      tgt.addService(CodeableConcept10_40.convertCodeableConcept(t));
526    if (src.hasDescription())
527      tgt.setDescription(src.getDescription());
528    return tgt;
529  }
530
531  public static org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException {
532    if (src == null || src.isEmpty())
533      return null;
534    org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent();
535    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
536    if (src.hasNameElement())
537      tgt.setNameElement(String10_40.convertString(src.getNameElement()));
538    if (src.hasVersionElement())
539      tgt.setVersionElement(String10_40.convertString(src.getVersionElement()));
540    if (src.hasReleaseDateElement())
541      tgt.setReleaseDateElement(DateTime10_40.convertDateTime(src.getReleaseDateElement()));
542    return tgt;
543  }
544
545  public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException {
546    if (src == null || src.isEmpty())
547      return null;
548    org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent();
549    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
550    if (src.hasNameElement())
551      tgt.setNameElement(String10_40.convertString(src.getNameElement()));
552    if (src.hasVersionElement())
553      tgt.setVersionElement(String10_40.convertString(src.getVersionElement()));
554    if (src.hasReleaseDateElement())
555      tgt.setReleaseDateElement(DateTime10_40.convertDateTime(src.getReleaseDateElement()));
556    return tgt;
557  }
558
559  static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind> convertConformanceStatementKind(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind> src) throws FHIRException {
560    if (src == null || src.isEmpty())
561      return null;
562    org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKindEnumFactory());
563    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
564    switch (src.getValue()) {
565      case INSTANCE:
566        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.INSTANCE);
567        break;
568      case CAPABILITY:
569        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.CAPABILITY);
570        break;
571      case REQUIREMENTS:
572        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.REQUIREMENTS);
573        break;
574      default:
575        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.NULL);
576        break;
577    }
578    return tgt;
579  }
580
581  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind> convertConformanceStatementKind(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind> src) throws FHIRException {
582    if (src == null || src.isEmpty())
583      return null;
584    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());
585    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
586    switch (src.getValue()) {
587      case INSTANCE:
588        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.INSTANCE);
589        break;
590      case CAPABILITY:
591        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY);
592        break;
593      case REQUIREMENTS:
594        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS);
595        break;
596      default:
597        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.NULL);
598        break;
599    }
600    return tgt;
601  }
602
603  static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.DocumentMode> convertDocumentMode(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode> src) throws FHIRException {
604    if (src == null || src.isEmpty())
605      return null;
606    org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.DocumentMode> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Conformance.DocumentModeEnumFactory());
607    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
608    switch (src.getValue()) {
609      case PRODUCER:
610        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.DocumentMode.PRODUCER);
611        break;
612      case CONSUMER:
613        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.DocumentMode.CONSUMER);
614        break;
615      default:
616        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.DocumentMode.NULL);
617        break;
618    }
619    return tgt;
620  }
621
622  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode> convertDocumentMode(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.DocumentMode> src) throws FHIRException {
623    if (src == null || src.isEmpty())
624      return null;
625    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());
626    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
627    switch (src.getValue()) {
628      case PRODUCER:
629        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.PRODUCER);
630        break;
631      case CONSUMER:
632        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.CONSUMER);
633        break;
634      default:
635        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.NULL);
636        break;
637    }
638    return tgt;
639  }
640
641  public static org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent src) throws FHIRException {
642    if (src == null || src.isEmpty())
643      return null;
644    org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent();
645    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
646    if (src.hasCode())
647      tgt.setCodeElement(convertTypeRestfulInteraction(src.getCodeElement()));
648    if (src.hasDocumentation())
649      tgt.setDocumentation(src.getDocumentation());
650    return tgt;
651  }
652
653  public static org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException {
654    if (src == null || src.isEmpty())
655      return null;
656    org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent();
657    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
658    if (src.hasCode())
659      tgt.setCodeElement(convertTypeRestfulInteraction(src.getCodeElement()));
660    if (src.hasDocumentation())
661      tgt.setDocumentation(src.getDocumentation());
662    return tgt;
663  }
664
665  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy> convertResourceVersionPolicy(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy> src) throws FHIRException {
666    if (src == null || src.isEmpty())
667      return null;
668    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());
669    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
670    switch (src.getValue()) {
671      case NOVERSION:
672        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION);
673        break;
674      case VERSIONED:
675        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED);
676        break;
677      case VERSIONEDUPDATE:
678        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE);
679        break;
680      default:
681        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NULL);
682        break;
683    }
684    return tgt;
685  }
686
687  static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy> convertResourceVersionPolicy(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy> src) throws FHIRException {
688    if (src == null || src.isEmpty())
689      return null;
690    org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicyEnumFactory());
691    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
692    switch (src.getValue()) {
693      case NOVERSION:
694        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.NOVERSION);
695        break;
696      case VERSIONED:
697        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.VERSIONED);
698        break;
699      case VERSIONEDUPDATE:
700        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE);
701        break;
702      default:
703        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.NULL);
704        break;
705    }
706    return tgt;
707  }
708
709  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode> convertRestfulConformanceMode(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode> src) throws FHIRException {
710    if (src == null || src.isEmpty())
711      return null;
712    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());
713    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
714    switch (src.getValue()) {
715      case CLIENT:
716        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.CLIENT);
717        break;
718      case SERVER:
719        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.SERVER);
720        break;
721      default:
722        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.NULL);
723        break;
724    }
725    return tgt;
726  }
727
728  static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode> convertRestfulConformanceMode(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode> src) throws FHIRException {
729    if (src == null || src.isEmpty())
730      return null;
731    org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceModeEnumFactory());
732    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
733    switch (src.getValue()) {
734      case CLIENT:
735        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.CLIENT);
736        break;
737      case SERVER:
738        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.SERVER);
739        break;
740      default:
741        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.NULL);
742        break;
743    }
744    return tgt;
745  }
746
747  public static org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException {
748    if (src == null || src.isEmpty())
749      return null;
750    org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent();
751    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
752    if (src.hasCode())
753      tgt.setCodeElement(convertSystemRestfulInteraction(src.getCodeElement()));
754    if (src.hasDocumentation())
755      tgt.setDocumentation(src.getDocumentation());
756    return tgt;
757  }
758
759  public static org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent src) throws FHIRException {
760    if (src == null || src.isEmpty())
761      return null;
762    org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent();
763    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
764    if (src.hasCode())
765      tgt.setCodeElement(convertSystemRestfulInteraction(src.getCodeElement()));
766    if (src.hasDocumentation())
767      tgt.setDocumentation(src.getDocumentation());
768    return tgt;
769  }
770
771  static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction> convertSystemRestfulInteraction(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction> src) throws FHIRException {
772    if (src == null || src.isEmpty())
773      return null;
774    org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteractionEnumFactory());
775    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
776    switch (src.getValue()) {
777      case TRANSACTION:
778        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.TRANSACTION);
779        break;
780      case SEARCHSYSTEM:
781        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM);
782        break;
783      case HISTORYSYSTEM:
784        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM);
785        break;
786      default:
787        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.NULL);
788        break;
789    }
790    return tgt;
791  }
792
793  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction> convertSystemRestfulInteraction(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction> src) throws FHIRException {
794    if (src == null || src.isEmpty())
795      return null;
796    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());
797    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
798    switch (src.getValue()) {
799      case TRANSACTION:
800        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION);
801        break;
802      case SEARCHSYSTEM:
803        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM);
804        break;
805      case HISTORYSYSTEM:
806        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM);
807        break;
808      default:
809        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.NULL);
810        break;
811    }
812    return tgt;
813  }
814
815  static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction> convertTypeRestfulInteraction(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction> src) throws FHIRException {
816    if (src == null || src.isEmpty())
817      return null;
818    org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteractionEnumFactory());
819    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
820    switch (src.getValue()) {
821      case READ:
822        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.READ);
823        break;
824      case VREAD:
825        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.VREAD);
826        break;
827      case UPDATE:
828        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.UPDATE);
829        break;
830      case DELETE:
831        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.DELETE);
832        break;
833      case HISTORYINSTANCE:
834        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE);
835        break;
836      case HISTORYTYPE:
837        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.HISTORYTYPE);
838        break;
839      case CREATE:
840        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.CREATE);
841        break;
842      case SEARCHTYPE:
843        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.SEARCHTYPE);
844        break;
845      default:
846        tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.NULL);
847        break;
848    }
849    return tgt;
850  }
851
852  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction> convertTypeRestfulInteraction(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction> src) throws FHIRException {
853    if (src == null || src.isEmpty())
854      return null;
855    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());
856    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
857    switch (src.getValue()) {
858      case READ:
859        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.READ);
860        break;
861      case VREAD:
862        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.VREAD);
863        break;
864      case UPDATE:
865        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.UPDATE);
866        break;
867      case DELETE:
868        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.DELETE);
869        break;
870      case HISTORYINSTANCE:
871        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE);
872        break;
873      case HISTORYTYPE:
874        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE);
875        break;
876      case CREATE:
877        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.CREATE);
878        break;
879      case SEARCHTYPE:
880        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE);
881        break;
882      default:
883        tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.NULL);
884        break;
885    }
886    return tgt;
887  }
888
889  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode> convertConformanceEventMode(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode> src) throws FHIRException {
890    if (src == null || src.isEmpty()) return null;
891    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());
892    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
893    if (src.getValue() == null) {
894      tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.NULL);
895    } else {
896      switch (src.getValue()) {
897        case SENDER:
898          tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.SENDER);
899          break;
900        case RECEIVER:
901          tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.RECEIVER);
902          break;
903        default:
904          tgt.setValue(org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.NULL);
905          break;
906      }
907    }
908    return tgt;
909  }
910
911  static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode> convertConformanceEventMode(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode> src) throws FHIRException {
912    if (src == null || src.isEmpty()) return null;
913    org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Conformance.ConformanceEventModeEnumFactory());
914    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
915    if (src.getValue() == null) {
916      tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.NULL);
917    } else {
918      switch (src.getValue()) {
919        case SENDER:
920          tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.SENDER);
921          break;
922        case RECEIVER:
923          tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.RECEIVER);
924          break;
925        default:
926          tgt.setValue(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.NULL);
927          break;
928      }
929    }
930    return tgt;
931  }
932}