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