001package org.hl7.fhir.convertors.conv10_50.resources10_50;
002
003import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_50;
004import org.hl7.fhir.convertors.context.ConversionContext10_50;
005import org.hl7.fhir.convertors.conv10_50.datatypes10_50.complextypes10_50.Signature10_50;
006import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Decimal10_50;
007import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Instant10_50;
008import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.String10_50;
009import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.UnsignedInt10_50;
010import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Uri10_50;
011import org.hl7.fhir.exceptions.FHIRException;
012import org.hl7.fhir.r5.model.Bundle;
013import org.hl7.fhir.r5.model.Bundle.LinkRelationTypes;
014import org.hl7.fhir.r5.model.Enumeration;
015import org.hl7.fhir.utilities.FhirPublication;
016
017public class Bundle10_50 {
018
019  public static org.hl7.fhir.r5.model.Bundle convertBundle(org.hl7.fhir.dstu2.model.Bundle src) throws FHIRException {
020    if (src == null || src.isEmpty())
021      return null;
022    org.hl7.fhir.r5.model.Bundle tgt = new org.hl7.fhir.r5.model.Bundle();
023    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyResource(src, tgt);
024    if (src.hasType())
025      tgt.setTypeElement(convertBundleType(src.getTypeElement()));
026    if (src.hasTotal())
027      tgt.setTotalElement(UnsignedInt10_50.convertUnsignedInt(src.getTotalElement()));
028    for (org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent t : src.getLink())
029      tgt.addLink(convertBundleLinkComponent(t));
030    for (org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent t : src.getEntry())
031      tgt.addEntry(convertBundleEntryComponent(t));
032    if (src.hasSignature())
033      tgt.setSignature(Signature10_50.convertSignature(src.getSignature()));
034    return tgt;
035  }
036
037  public static org.hl7.fhir.dstu2.model.Bundle convertBundle(org.hl7.fhir.r5.model.Bundle src) throws FHIRException {
038    return convertBundle(src, null);
039  }
040
041  public static org.hl7.fhir.dstu2.model.Bundle convertBundle(org.hl7.fhir.r5.model.Bundle src, BaseAdvisor_10_50 advisor) throws FHIRException {
042    if (src == null || src.isEmpty())
043      return null;
044    org.hl7.fhir.dstu2.model.Bundle tgt = new org.hl7.fhir.dstu2.model.Bundle();
045    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyResource(src, tgt);
046    if (src.hasType())
047      tgt.setTypeElement(convertBundleType(src.getTypeElement()));
048    if (src.hasTotal())
049      tgt.setTotalElement(UnsignedInt10_50.convertUnsignedInt(src.getTotalElement()));
050    for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t));
051    for (org.hl7.fhir.r5.model.Bundle.BundleEntryComponent t : src.getEntry())
052      tgt.addEntry(convertBundleEntryComponent(t, advisor));
053    if (src.hasSignature())
054      tgt.setSignature(Signature10_50.convertSignature(src.getSignature()));
055    return tgt;
056  }
057
058  public static org.hl7.fhir.r5.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent src) throws FHIRException {
059    if (src == null || src.isEmpty())
060      return null;
061    org.hl7.fhir.r5.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryComponent();
062    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyBackboneElement(src,tgt);
063    for (org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent t : src.getLink())
064      tgt.addLink(convertBundleLinkComponent(t));
065    if (src.hasFullUrlElement())
066      tgt.setFullUrlElement(Uri10_50.convertUri(src.getFullUrlElement()));
067    if (src.hasResource())
068      tgt.setResource(ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().convertResource(src.getResource()));
069    if (src.hasSearch())
070      tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch()));
071    if (src.hasRequest())
072      tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest()));
073    if (src.hasResponse())
074      tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse()));
075    return tgt;
076  }
077
078  public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src, BaseAdvisor_10_50 advisor) throws FHIRException {
079    if (src == null || src.isEmpty())
080      return null;
081    if (advisor.ignoreEntry(src, FhirPublication.DSTU2))
082      return null;
083    org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent();
084    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyBackboneElement(src,tgt);
085    for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t));
086    if (src.hasFullUrlElement())
087      tgt.setFullUrlElement(Uri10_50.convertUri(src.getFullUrlElement()));
088    if (src.hasResource())
089      tgt.setResource(ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().convertResource(src.getResource()));
090    if (src.hasSearch())
091      tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch()));
092    if (src.hasRequest())
093      tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest()));
094    if (src.hasResponse())
095      tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse()));
096    return tgt;
097  }
098
099  public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src) throws FHIRException {
100    return convertBundleEntryComponent(src, null);
101  }
102
103  public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent src) throws FHIRException {
104    if (src == null || src.isEmpty())
105      return null;
106    org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent();
107    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyBackboneElement(src,tgt);
108    if (src.hasMethod())
109      tgt.setMethodElement(convertHTTPVerb(src.getMethodElement()));
110    if (src.hasUrlElement())
111      tgt.setUrlElement(Uri10_50.convertUri(src.getUrlElement()));
112    if (src.hasIfNoneMatchElement())
113      tgt.setIfNoneMatchElement(String10_50.convertString(src.getIfNoneMatchElement()));
114    if (src.hasIfModifiedSinceElement())
115      tgt.setIfModifiedSinceElement(Instant10_50.convertInstant(src.getIfModifiedSinceElement()));
116    if (src.hasIfMatchElement())
117      tgt.setIfMatchElement(String10_50.convertString(src.getIfMatchElement()));
118    if (src.hasIfNoneExistElement())
119      tgt.setIfNoneExistElement(String10_50.convertString(src.getIfNoneExistElement()));
120    return tgt;
121  }
122
123  public static org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent src) throws FHIRException {
124    if (src == null || src.isEmpty())
125      return null;
126    org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent();
127    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyBackboneElement(src,tgt);
128    if (src.hasMethod())
129      tgt.setMethodElement(convertHTTPVerb(src.getMethodElement()));
130    if (src.hasUrlElement())
131      tgt.setUrlElement(Uri10_50.convertUri(src.getUrlElement()));
132    if (src.hasIfNoneMatchElement())
133      tgt.setIfNoneMatchElement(String10_50.convertString(src.getIfNoneMatchElement()));
134    if (src.hasIfModifiedSinceElement())
135      tgt.setIfModifiedSinceElement(Instant10_50.convertInstant(src.getIfModifiedSinceElement()));
136    if (src.hasIfMatchElement())
137      tgt.setIfMatchElement(String10_50.convertString(src.getIfMatchElement()));
138    if (src.hasIfNoneExistElement())
139      tgt.setIfNoneExistElement(String10_50.convertString(src.getIfNoneExistElement()));
140    return tgt;
141  }
142
143  public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent src) throws FHIRException {
144    if (src == null || src.isEmpty())
145      return null;
146    org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent();
147    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyBackboneElement(src,tgt);
148    if (src.hasStatusElement())
149      tgt.setStatusElement(String10_50.convertString(src.getStatusElement()));
150    if (src.hasLocationElement())
151      tgt.setLocationElement(Uri10_50.convertUri(src.getLocationElement()));
152    if (src.hasEtagElement())
153      tgt.setEtagElement(String10_50.convertString(src.getEtagElement()));
154    if (src.hasLastModifiedElement())
155      tgt.setLastModifiedElement(Instant10_50.convertInstant(src.getLastModifiedElement()));
156    return tgt;
157  }
158
159  public static org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent src) throws FHIRException {
160    if (src == null || src.isEmpty())
161      return null;
162    org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent();
163    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyBackboneElement(src,tgt);
164    if (src.hasStatusElement())
165      tgt.setStatusElement(String10_50.convertString(src.getStatusElement()));
166    if (src.hasLocationElement())
167      tgt.setLocationElement(Uri10_50.convertUri(src.getLocationElement()));
168    if (src.hasEtagElement())
169      tgt.setEtagElement(String10_50.convertString(src.getEtagElement()));
170    if (src.hasLastModifiedElement())
171      tgt.setLastModifiedElement(Instant10_50.convertInstant(src.getLastModifiedElement()));
172    return tgt;
173  }
174
175  public static org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent src) throws FHIRException {
176    if (src == null || src.isEmpty())
177      return null;
178    org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent();
179    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyBackboneElement(src,tgt);
180    if (src.hasMode())
181      tgt.setModeElement(convertSearchEntryMode(src.getModeElement()));
182    if (src.hasScoreElement())
183      tgt.setScoreElement(Decimal10_50.convertDecimal(src.getScoreElement()));
184    return tgt;
185  }
186
187  public static org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent src) throws FHIRException {
188    if (src == null || src.isEmpty())
189      return null;
190    org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent();
191    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyBackboneElement(src,tgt);
192    if (src.hasMode())
193      tgt.setModeElement(convertSearchEntryMode(src.getModeElement()));
194    if (src.hasScoreElement())
195      tgt.setScoreElement(Decimal10_50.convertDecimal(src.getScoreElement()));
196    return tgt;
197  }
198
199  public static org.hl7.fhir.r5.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent src) throws FHIRException {
200    if (src == null || src.isEmpty())
201      return null;
202    org.hl7.fhir.r5.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleLinkComponent();
203    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyBackboneElement(src,tgt);
204    if (src.hasRelationElement())
205      tgt.setRelation(LinkRelationTypes.fromCode(src.getRelation()));
206    if (src.hasUrlElement())
207      tgt.setUrlElement(Uri10_50.convertUri(src.getUrlElement()));
208    return tgt;
209  }
210
211  public static org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r5.model.Bundle.BundleLinkComponent src) throws FHIRException {
212    if (src == null || src.isEmpty())
213      return null;
214    org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent();
215    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyBackboneElement(src,tgt);
216    if (src.hasRelationElement())
217      tgt.setRelation((src.getRelation().toCode()));
218    if (src.hasUrlElement())
219      tgt.setUrlElement(Uri10_50.convertUri(src.getUrlElement()));
220    return tgt;
221  }
222
223  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Bundle.BundleType> convertBundleType(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Bundle.BundleType> src) throws FHIRException {
224      if (src == null || src.isEmpty())
225          return null;
226      Enumeration<Bundle.BundleType> tgt = new Enumeration<>(new Bundle.BundleTypeEnumFactory());
227      ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt);
228      if (src.getValue() == null) {
229          tgt.setValue(null);
230      } else {
231          switch (src.getValue()) {
232              case DOCUMENT:
233                  tgt.setValue(Bundle.BundleType.DOCUMENT);
234                  break;
235              case MESSAGE:
236                  tgt.setValue(Bundle.BundleType.MESSAGE);
237                  break;
238              case TRANSACTION:
239                  tgt.setValue(Bundle.BundleType.TRANSACTION);
240                  break;
241              case TRANSACTIONRESPONSE:
242                  tgt.setValue(Bundle.BundleType.TRANSACTIONRESPONSE);
243                  break;
244              case BATCH:
245                  tgt.setValue(Bundle.BundleType.BATCH);
246                  break;
247              case BATCHRESPONSE:
248                  tgt.setValue(Bundle.BundleType.BATCHRESPONSE);
249                  break;
250              case HISTORY:
251                  tgt.setValue(Bundle.BundleType.HISTORY);
252                  break;
253              case SEARCHSET:
254                  tgt.setValue(Bundle.BundleType.SEARCHSET);
255                  break;
256              case COLLECTION:
257                  tgt.setValue(Bundle.BundleType.COLLECTION);
258                  break;
259              default:
260                  tgt.setValue(Bundle.BundleType.NULL);
261                  break;
262          }
263      }
264      return tgt;
265  }
266
267  static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Bundle.BundleType> convertBundleType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Bundle.BundleType> src) throws FHIRException {
268      if (src == null || src.isEmpty())
269          return null;
270      org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Bundle.BundleType> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Bundle.BundleTypeEnumFactory());
271      ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt);
272      if (src.getValue() == null) {
273          tgt.setValue(null);
274      } else {
275          switch (src.getValue()) {
276              case DOCUMENT:
277                  tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.BundleType.DOCUMENT);
278                  break;
279              case MESSAGE:
280                  tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.BundleType.MESSAGE);
281                  break;
282              case TRANSACTION:
283                  tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.BundleType.TRANSACTION);
284                  break;
285              case TRANSACTIONRESPONSE:
286                  tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.BundleType.TRANSACTIONRESPONSE);
287                  break;
288              case BATCH:
289                  tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.BundleType.BATCH);
290                  break;
291              case BATCHRESPONSE:
292                  tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.BundleType.BATCHRESPONSE);
293                  break;
294              case HISTORY:
295                  tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.BundleType.HISTORY);
296                  break;
297              case SEARCHSET:
298                  tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.BundleType.SEARCHSET);
299                  break;
300              case COLLECTION:
301                  tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.BundleType.COLLECTION);
302                  break;
303              default:
304                  tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.BundleType.NULL);
305                  break;
306          }
307      }
308      return tgt;
309  }
310
311  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Bundle.HTTPVerb> convertHTTPVerb(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Bundle.HTTPVerb> src) throws FHIRException {
312      if (src == null || src.isEmpty())
313          return null;
314      Enumeration<Bundle.HTTPVerb> tgt = new Enumeration<>(new Bundle.HTTPVerbEnumFactory());
315      ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt);
316      if (src.getValue() == null) {
317          tgt.setValue(null);
318      } else {
319          switch (src.getValue()) {
320              case GET:
321                  tgt.setValue(Bundle.HTTPVerb.GET);
322                  break;
323              case POST:
324                  tgt.setValue(Bundle.HTTPVerb.POST);
325                  break;
326              case PUT:
327                  tgt.setValue(Bundle.HTTPVerb.PUT);
328                  break;
329              case DELETE:
330                  tgt.setValue(Bundle.HTTPVerb.DELETE);
331                  break;
332              default:
333                  tgt.setValue(Bundle.HTTPVerb.NULL);
334                  break;
335          }
336      }
337      return tgt;
338  }
339
340  static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Bundle.HTTPVerb> convertHTTPVerb(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Bundle.HTTPVerb> src) throws FHIRException {
341      if (src == null || src.isEmpty())
342          return null;
343      org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Bundle.HTTPVerb> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Bundle.HTTPVerbEnumFactory());
344      ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt);
345      if (src.getValue() == null) {
346          tgt.setValue(null);
347      } else {
348          switch (src.getValue()) {
349              case GET:
350                  tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.GET);
351                  break;
352              case POST:
353                  tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.POST);
354                  break;
355              case PUT:
356                  tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.PUT);
357                  break;
358              case DELETE:
359                  tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.DELETE);
360                  break;
361              default:
362                  tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.NULL);
363                  break;
364          }
365      }
366      return tgt;
367  }
368
369  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Bundle.SearchEntryMode> convertSearchEntryMode(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode> src) throws FHIRException {
370      if (src == null || src.isEmpty())
371          return null;
372      Enumeration<Bundle.SearchEntryMode> tgt = new Enumeration<>(new Bundle.SearchEntryModeEnumFactory());
373      ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt);
374      if (src.getValue() == null) {
375          tgt.setValue(null);
376      } else {
377          switch (src.getValue()) {
378              case MATCH:
379                  tgt.setValue(Bundle.SearchEntryMode.MATCH);
380                  break;
381              case INCLUDE:
382                  tgt.setValue(Bundle.SearchEntryMode.INCLUDE);
383                  break;
384              case OUTCOME:
385                  tgt.setValue(Bundle.SearchEntryMode.OUTCOME);
386                  break;
387              default:
388                  tgt.setValue(Bundle.SearchEntryMode.NULL);
389                  break;
390          }
391      }
392      return tgt;
393  }
394
395  static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode> convertSearchEntryMode(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Bundle.SearchEntryMode> src) throws FHIRException {
396      if (src == null || src.isEmpty())
397          return null;
398      org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Bundle.SearchEntryModeEnumFactory());
399      ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt);
400      if (src.getValue() == null) {
401          tgt.setValue(null);
402      } else {
403          switch (src.getValue()) {
404              case MATCH:
405                  tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.MATCH);
406                  break;
407              case INCLUDE:
408                  tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.INCLUDE);
409                  break;
410              case OUTCOME:
411                  tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.OUTCOME);
412                  break;
413              default:
414                  tgt.setValue(org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.NULL);
415                  break;
416          }
417      }
418      return tgt;
419  }
420}