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