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