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