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