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