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