001package org.hl7.fhir.r4.model;
002
003import java.math.BigDecimal;
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
035import java.util.ArrayList;
036import java.util.Date;
037import java.util.List;
038
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
041import org.hl7.fhir.instance.model.api.IBaseBundle;
042import org.hl7.fhir.utilities.Utilities;
043
044import ca.uhn.fhir.model.api.annotation.Block;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.Description;
047import ca.uhn.fhir.model.api.annotation.ResourceDef;
048import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
049
050/**
051 * A container for a collection of resources.
052 */
053@ResourceDef(name = "Bundle", profile = "http://hl7.org/fhir/StructureDefinition/Bundle")
054public class Bundle extends Resource implements IBaseBundle {
055
056  public enum BundleType {
057    /**
058     * The bundle is a document. The first resource is a Composition.
059     */
060    DOCUMENT,
061    /**
062     * The bundle is a message. The first resource is a MessageHeader.
063     */
064    MESSAGE,
065    /**
066     * The bundle is a transaction - intended to be processed by a server as an
067     * atomic commit.
068     */
069    TRANSACTION,
070    /**
071     * The bundle is a transaction response. Because the response is a transaction
072     * response, the transaction has succeeded, and all responses are error free.
073     */
074    TRANSACTIONRESPONSE,
075    /**
076     * The bundle is a set of actions - intended to be processed by a server as a
077     * group of independent actions.
078     */
079    BATCH,
080    /**
081     * The bundle is a batch response. Note that as a batch, some responses may
082     * indicate failure and others success.
083     */
084    BATCHRESPONSE,
085    /**
086     * The bundle is a list of resources from a history interaction on a server.
087     */
088    HISTORY,
089    /**
090     * The bundle is a list of resources returned as a result of a search/query
091     * interaction, operation, or message.
092     */
093    SEARCHSET,
094    /**
095     * The bundle is a set of resources collected into a single package for ease of
096     * distribution that imposes no processing obligations or behavioral rules
097     * beyond persistence.
098     */
099    COLLECTION,
100    /**
101     * added to help the parsers with the generic types
102     */
103    NULL;
104
105    public static BundleType fromCode(String codeString) throws FHIRException {
106      if (codeString == null || "".equals(codeString))
107        return null;
108      if ("document".equals(codeString))
109        return DOCUMENT;
110      if ("message".equals(codeString))
111        return MESSAGE;
112      if ("transaction".equals(codeString))
113        return TRANSACTION;
114      if ("transaction-response".equals(codeString))
115        return TRANSACTIONRESPONSE;
116      if ("batch".equals(codeString))
117        return BATCH;
118      if ("batch-response".equals(codeString))
119        return BATCHRESPONSE;
120      if ("history".equals(codeString))
121        return HISTORY;
122      if ("searchset".equals(codeString))
123        return SEARCHSET;
124      if ("collection".equals(codeString))
125        return COLLECTION;
126      if (Configuration.isAcceptInvalidEnums())
127        return null;
128      else
129        throw new FHIRException("Unknown BundleType code '" + codeString + "'");
130    }
131
132    public String toCode() {
133      switch (this) {
134      case DOCUMENT:
135        return "document";
136      case MESSAGE:
137        return "message";
138      case TRANSACTION:
139        return "transaction";
140      case TRANSACTIONRESPONSE:
141        return "transaction-response";
142      case BATCH:
143        return "batch";
144      case BATCHRESPONSE:
145        return "batch-response";
146      case HISTORY:
147        return "history";
148      case SEARCHSET:
149        return "searchset";
150      case COLLECTION:
151        return "collection";
152      case NULL:
153        return null;
154      default:
155        return "?";
156      }
157    }
158
159    public String getSystem() {
160      switch (this) {
161      case DOCUMENT:
162        return "http://hl7.org/fhir/bundle-type";
163      case MESSAGE:
164        return "http://hl7.org/fhir/bundle-type";
165      case TRANSACTION:
166        return "http://hl7.org/fhir/bundle-type";
167      case TRANSACTIONRESPONSE:
168        return "http://hl7.org/fhir/bundle-type";
169      case BATCH:
170        return "http://hl7.org/fhir/bundle-type";
171      case BATCHRESPONSE:
172        return "http://hl7.org/fhir/bundle-type";
173      case HISTORY:
174        return "http://hl7.org/fhir/bundle-type";
175      case SEARCHSET:
176        return "http://hl7.org/fhir/bundle-type";
177      case COLLECTION:
178        return "http://hl7.org/fhir/bundle-type";
179      case NULL:
180        return null;
181      default:
182        return "?";
183      }
184    }
185
186    public String getDefinition() {
187      switch (this) {
188      case DOCUMENT:
189        return "The bundle is a document. The first resource is a Composition.";
190      case MESSAGE:
191        return "The bundle is a message. The first resource is a MessageHeader.";
192      case TRANSACTION:
193        return "The bundle is a transaction - intended to be processed by a server as an atomic commit.";
194      case TRANSACTIONRESPONSE:
195        return "The bundle is a transaction response. Because the response is a transaction response, the transaction has succeeded, and all responses are error free.";
196      case BATCH:
197        return "The bundle is a set of actions - intended to be processed by a server as a group of independent actions.";
198      case BATCHRESPONSE:
199        return "The bundle is a batch response. Note that as a batch, some responses may indicate failure and others success.";
200      case HISTORY:
201        return "The bundle is a list of resources from a history interaction on a server.";
202      case SEARCHSET:
203        return "The bundle is a list of resources returned as a result of a search/query interaction, operation, or message.";
204      case COLLECTION:
205        return "The bundle is a set of resources collected into a single package for ease of distribution that imposes no processing obligations or behavioral rules beyond persistence.";
206      case NULL:
207        return null;
208      default:
209        return "?";
210      }
211    }
212
213    public String getDisplay() {
214      switch (this) {
215      case DOCUMENT:
216        return "Document";
217      case MESSAGE:
218        return "Message";
219      case TRANSACTION:
220        return "Transaction";
221      case TRANSACTIONRESPONSE:
222        return "Transaction Response";
223      case BATCH:
224        return "Batch";
225      case BATCHRESPONSE:
226        return "Batch Response";
227      case HISTORY:
228        return "History List";
229      case SEARCHSET:
230        return "Search Results";
231      case COLLECTION:
232        return "Collection";
233      case NULL:
234        return null;
235      default:
236        return "?";
237      }
238    }
239  }
240
241  public static class BundleTypeEnumFactory implements EnumFactory<BundleType> {
242    public BundleType fromCode(String codeString) throws IllegalArgumentException {
243      if (codeString == null || "".equals(codeString))
244        if (codeString == null || "".equals(codeString))
245          return null;
246      if ("document".equals(codeString))
247        return BundleType.DOCUMENT;
248      if ("message".equals(codeString))
249        return BundleType.MESSAGE;
250      if ("transaction".equals(codeString))
251        return BundleType.TRANSACTION;
252      if ("transaction-response".equals(codeString))
253        return BundleType.TRANSACTIONRESPONSE;
254      if ("batch".equals(codeString))
255        return BundleType.BATCH;
256      if ("batch-response".equals(codeString))
257        return BundleType.BATCHRESPONSE;
258      if ("history".equals(codeString))
259        return BundleType.HISTORY;
260      if ("searchset".equals(codeString))
261        return BundleType.SEARCHSET;
262      if ("collection".equals(codeString))
263        return BundleType.COLLECTION;
264      throw new IllegalArgumentException("Unknown BundleType code '" + codeString + "'");
265    }
266
267    public Enumeration<BundleType> fromType(PrimitiveType<?> code) throws FHIRException {
268      if (code == null)
269        return null;
270      if (code.isEmpty())
271        return new Enumeration<BundleType>(this, BundleType.NULL, code);
272      String codeString = code.asStringValue();
273      if (codeString == null || "".equals(codeString))
274        return new Enumeration<BundleType>(this, BundleType.NULL, code);
275      if ("document".equals(codeString))
276        return new Enumeration<BundleType>(this, BundleType.DOCUMENT, code);
277      if ("message".equals(codeString))
278        return new Enumeration<BundleType>(this, BundleType.MESSAGE, code);
279      if ("transaction".equals(codeString))
280        return new Enumeration<BundleType>(this, BundleType.TRANSACTION, code);
281      if ("transaction-response".equals(codeString))
282        return new Enumeration<BundleType>(this, BundleType.TRANSACTIONRESPONSE, code);
283      if ("batch".equals(codeString))
284        return new Enumeration<BundleType>(this, BundleType.BATCH, code);
285      if ("batch-response".equals(codeString))
286        return new Enumeration<BundleType>(this, BundleType.BATCHRESPONSE, code);
287      if ("history".equals(codeString))
288        return new Enumeration<BundleType>(this, BundleType.HISTORY, code);
289      if ("searchset".equals(codeString))
290        return new Enumeration<BundleType>(this, BundleType.SEARCHSET, code);
291      if ("collection".equals(codeString))
292        return new Enumeration<BundleType>(this, BundleType.COLLECTION, code);
293      throw new FHIRException("Unknown BundleType code '" + codeString + "'");
294    }
295
296    public String toCode(BundleType code) {
297      if (code == BundleType.DOCUMENT)
298        return "document";
299      if (code == BundleType.MESSAGE)
300        return "message";
301      if (code == BundleType.TRANSACTION)
302        return "transaction";
303      if (code == BundleType.TRANSACTIONRESPONSE)
304        return "transaction-response";
305      if (code == BundleType.BATCH)
306        return "batch";
307      if (code == BundleType.BATCHRESPONSE)
308        return "batch-response";
309      if (code == BundleType.HISTORY)
310        return "history";
311      if (code == BundleType.SEARCHSET)
312        return "searchset";
313      if (code == BundleType.COLLECTION)
314        return "collection";
315      return "?";
316    }
317
318    public String toSystem(BundleType code) {
319      return code.getSystem();
320    }
321  }
322
323  public enum SearchEntryMode {
324    /**
325     * This resource matched the search specification.
326     */
327    MATCH,
328    /**
329     * This resource is returned because it is referred to from another resource in
330     * the search set.
331     */
332    INCLUDE,
333    /**
334     * An OperationOutcome that provides additional information about the processing
335     * of a search.
336     */
337    OUTCOME,
338    /**
339     * added to help the parsers with the generic types
340     */
341    NULL;
342
343    public static SearchEntryMode fromCode(String codeString) throws FHIRException {
344      if (codeString == null || "".equals(codeString))
345        return null;
346      if ("match".equals(codeString))
347        return MATCH;
348      if ("include".equals(codeString))
349        return INCLUDE;
350      if ("outcome".equals(codeString))
351        return OUTCOME;
352      if (Configuration.isAcceptInvalidEnums())
353        return null;
354      else
355        throw new FHIRException("Unknown SearchEntryMode code '" + codeString + "'");
356    }
357
358    public String toCode() {
359      switch (this) {
360      case MATCH:
361        return "match";
362      case INCLUDE:
363        return "include";
364      case OUTCOME:
365        return "outcome";
366      case NULL:
367        return null;
368      default:
369        return "?";
370      }
371    }
372
373    public String getSystem() {
374      switch (this) {
375      case MATCH:
376        return "http://hl7.org/fhir/search-entry-mode";
377      case INCLUDE:
378        return "http://hl7.org/fhir/search-entry-mode";
379      case OUTCOME:
380        return "http://hl7.org/fhir/search-entry-mode";
381      case NULL:
382        return null;
383      default:
384        return "?";
385      }
386    }
387
388    public String getDefinition() {
389      switch (this) {
390      case MATCH:
391        return "This resource matched the search specification.";
392      case INCLUDE:
393        return "This resource is returned because it is referred to from another resource in the search set.";
394      case OUTCOME:
395        return "An OperationOutcome that provides additional information about the processing of a search.";
396      case NULL:
397        return null;
398      default:
399        return "?";
400      }
401    }
402
403    public String getDisplay() {
404      switch (this) {
405      case MATCH:
406        return "Match";
407      case INCLUDE:
408        return "Include";
409      case OUTCOME:
410        return "Outcome";
411      case NULL:
412        return null;
413      default:
414        return "?";
415      }
416    }
417  }
418
419  public static class SearchEntryModeEnumFactory implements EnumFactory<SearchEntryMode> {
420    public SearchEntryMode fromCode(String codeString) throws IllegalArgumentException {
421      if (codeString == null || "".equals(codeString))
422        if (codeString == null || "".equals(codeString))
423          return null;
424      if ("match".equals(codeString))
425        return SearchEntryMode.MATCH;
426      if ("include".equals(codeString))
427        return SearchEntryMode.INCLUDE;
428      if ("outcome".equals(codeString))
429        return SearchEntryMode.OUTCOME;
430      throw new IllegalArgumentException("Unknown SearchEntryMode code '" + codeString + "'");
431    }
432
433    public Enumeration<SearchEntryMode> fromType(PrimitiveType<?> code) throws FHIRException {
434      if (code == null)
435        return null;
436      if (code.isEmpty())
437        return new Enumeration<SearchEntryMode>(this, SearchEntryMode.NULL, code);
438      String codeString = code.asStringValue();
439      if (codeString == null || "".equals(codeString))
440        return new Enumeration<SearchEntryMode>(this, SearchEntryMode.NULL, code);
441      if ("match".equals(codeString))
442        return new Enumeration<SearchEntryMode>(this, SearchEntryMode.MATCH, code);
443      if ("include".equals(codeString))
444        return new Enumeration<SearchEntryMode>(this, SearchEntryMode.INCLUDE, code);
445      if ("outcome".equals(codeString))
446        return new Enumeration<SearchEntryMode>(this, SearchEntryMode.OUTCOME, code);
447      throw new FHIRException("Unknown SearchEntryMode code '" + codeString + "'");
448    }
449
450    public String toCode(SearchEntryMode code) {
451      if (code == SearchEntryMode.MATCH)
452        return "match";
453      if (code == SearchEntryMode.INCLUDE)
454        return "include";
455      if (code == SearchEntryMode.OUTCOME)
456        return "outcome";
457      return "?";
458    }
459
460    public String toSystem(SearchEntryMode code) {
461      return code.getSystem();
462    }
463  }
464
465  public enum HTTPVerb {
466    /**
467     * HTTP GET Command.
468     */
469    GET,
470    /**
471     * HTTP HEAD Command.
472     */
473    HEAD,
474    /**
475     * HTTP POST Command.
476     */
477    POST,
478    /**
479     * HTTP PUT Command.
480     */
481    PUT,
482    /**
483     * HTTP DELETE Command.
484     */
485    DELETE,
486    /**
487     * HTTP PATCH Command.
488     */
489    PATCH,
490    /**
491     * added to help the parsers with the generic types
492     */
493    NULL;
494
495    public static HTTPVerb fromCode(String codeString) throws FHIRException {
496      if (codeString == null || "".equals(codeString))
497        return null;
498      if ("GET".equals(codeString))
499        return GET;
500      if ("HEAD".equals(codeString))
501        return HEAD;
502      if ("POST".equals(codeString))
503        return POST;
504      if ("PUT".equals(codeString))
505        return PUT;
506      if ("DELETE".equals(codeString))
507        return DELETE;
508      if ("PATCH".equals(codeString))
509        return PATCH;
510      if (Configuration.isAcceptInvalidEnums())
511        return null;
512      else
513        throw new FHIRException("Unknown HTTPVerb code '" + codeString + "'");
514    }
515
516    public String toCode() {
517      switch (this) {
518      case GET:
519        return "GET";
520      case HEAD:
521        return "HEAD";
522      case POST:
523        return "POST";
524      case PUT:
525        return "PUT";
526      case DELETE:
527        return "DELETE";
528      case PATCH:
529        return "PATCH";
530      case NULL:
531        return null;
532      default:
533        return "?";
534      }
535    }
536
537    public String getSystem() {
538      switch (this) {
539      case GET:
540        return "http://hl7.org/fhir/http-verb";
541      case HEAD:
542        return "http://hl7.org/fhir/http-verb";
543      case POST:
544        return "http://hl7.org/fhir/http-verb";
545      case PUT:
546        return "http://hl7.org/fhir/http-verb";
547      case DELETE:
548        return "http://hl7.org/fhir/http-verb";
549      case PATCH:
550        return "http://hl7.org/fhir/http-verb";
551      case NULL:
552        return null;
553      default:
554        return "?";
555      }
556    }
557
558    public String getDefinition() {
559      switch (this) {
560      case GET:
561        return "HTTP GET Command.";
562      case HEAD:
563        return "HTTP HEAD Command.";
564      case POST:
565        return "HTTP POST Command.";
566      case PUT:
567        return "HTTP PUT Command.";
568      case DELETE:
569        return "HTTP DELETE Command.";
570      case PATCH:
571        return "HTTP PATCH Command.";
572      case NULL:
573        return null;
574      default:
575        return "?";
576      }
577    }
578
579    public String getDisplay() {
580      switch (this) {
581      case GET:
582        return "GET";
583      case HEAD:
584        return "HEAD";
585      case POST:
586        return "POST";
587      case PUT:
588        return "PUT";
589      case DELETE:
590        return "DELETE";
591      case PATCH:
592        return "PATCH";
593      case NULL:
594        return null;
595      default:
596        return "?";
597      }
598    }
599  }
600
601  public static class HTTPVerbEnumFactory implements EnumFactory<HTTPVerb> {
602    public HTTPVerb fromCode(String codeString) throws IllegalArgumentException {
603      if (codeString == null || "".equals(codeString))
604        if (codeString == null || "".equals(codeString))
605          return null;
606      if ("GET".equals(codeString))
607        return HTTPVerb.GET;
608      if ("HEAD".equals(codeString))
609        return HTTPVerb.HEAD;
610      if ("POST".equals(codeString))
611        return HTTPVerb.POST;
612      if ("PUT".equals(codeString))
613        return HTTPVerb.PUT;
614      if ("DELETE".equals(codeString))
615        return HTTPVerb.DELETE;
616      if ("PATCH".equals(codeString))
617        return HTTPVerb.PATCH;
618      throw new IllegalArgumentException("Unknown HTTPVerb code '" + codeString + "'");
619    }
620
621    public Enumeration<HTTPVerb> fromType(PrimitiveType<?> code) throws FHIRException {
622      if (code == null)
623        return null;
624      if (code.isEmpty())
625        return new Enumeration<HTTPVerb>(this, HTTPVerb.NULL, code);
626      String codeString = code.asStringValue();
627      if (codeString == null || "".equals(codeString))
628        return new Enumeration<HTTPVerb>(this, HTTPVerb.NULL, code);
629      if ("GET".equals(codeString))
630        return new Enumeration<HTTPVerb>(this, HTTPVerb.GET, code);
631      if ("HEAD".equals(codeString))
632        return new Enumeration<HTTPVerb>(this, HTTPVerb.HEAD, code);
633      if ("POST".equals(codeString))
634        return new Enumeration<HTTPVerb>(this, HTTPVerb.POST, code);
635      if ("PUT".equals(codeString))
636        return new Enumeration<HTTPVerb>(this, HTTPVerb.PUT, code);
637      if ("DELETE".equals(codeString))
638        return new Enumeration<HTTPVerb>(this, HTTPVerb.DELETE, code);
639      if ("PATCH".equals(codeString))
640        return new Enumeration<HTTPVerb>(this, HTTPVerb.PATCH, code);
641      throw new FHIRException("Unknown HTTPVerb code '" + codeString + "'");
642    }
643
644    public String toCode(HTTPVerb code) {
645      if (code == HTTPVerb.GET)
646        return "GET";
647      if (code == HTTPVerb.HEAD)
648        return "HEAD";
649      if (code == HTTPVerb.POST)
650        return "POST";
651      if (code == HTTPVerb.PUT)
652        return "PUT";
653      if (code == HTTPVerb.DELETE)
654        return "DELETE";
655      if (code == HTTPVerb.PATCH)
656        return "PATCH";
657      return "?";
658    }
659
660    public String toSystem(HTTPVerb code) {
661      return code.getSystem();
662    }
663  }
664
665  @Block()
666  public static class BundleLinkComponent extends BackboneElement implements IBaseBackboneElement {
667    /**
668     * A name which details the functional use for this link - see
669     * [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1).
670     */
671    @Child(name = "relation", type = {
672        StringType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
673    @Description(shortDefinition = "See http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1", formalDefinition = "A name which details the functional use for this link - see [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1).")
674    protected StringType relation;
675
676    /**
677     * The reference details for the link.
678     */
679    @Child(name = "url", type = { UriType.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
680    @Description(shortDefinition = "Reference details for the link", formalDefinition = "The reference details for the link.")
681    protected UriType url;
682
683    private static final long serialVersionUID = -1010386066L;
684
685    /**
686     * Constructor
687     */
688    public BundleLinkComponent() {
689      super();
690    }
691
692    /**
693     * Constructor
694     */
695    public BundleLinkComponent(StringType relation, UriType url) {
696      super();
697      this.relation = relation;
698      this.url = url;
699    }
700
701    /**
702     * @return {@link #relation} (A name which details the functional use for this
703     *         link - see
704     *         [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1).).
705     *         This is the underlying object with id, value and extensions. The
706     *         accessor "getRelation" gives direct access to the value
707     */
708    public StringType getRelationElement() {
709      if (this.relation == null)
710        if (Configuration.errorOnAutoCreate())
711          throw new Error("Attempt to auto-create BundleLinkComponent.relation");
712        else if (Configuration.doAutoCreate())
713          this.relation = new StringType(); // bb
714      return this.relation;
715    }
716
717    public boolean hasRelationElement() {
718      return this.relation != null && !this.relation.isEmpty();
719    }
720
721    public boolean hasRelation() {
722      return this.relation != null && !this.relation.isEmpty();
723    }
724
725    /**
726     * @param value {@link #relation} (A name which details the functional use for
727     *              this link - see
728     *              [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1).).
729     *              This is the underlying object with id, value and extensions. The
730     *              accessor "getRelation" gives direct access to the value
731     */
732    public BundleLinkComponent setRelationElement(StringType value) {
733      this.relation = value;
734      return this;
735    }
736
737    /**
738     * @return A name which details the functional use for this link - see
739     *         [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1).
740     */
741    public String getRelation() {
742      return this.relation == null ? null : this.relation.getValue();
743    }
744
745    /**
746     * @param value A name which details the functional use for this link - see
747     *              [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1).
748     */
749    public BundleLinkComponent setRelation(String value) {
750      if (this.relation == null)
751        this.relation = new StringType();
752      this.relation.setValue(value);
753      return this;
754    }
755
756    /**
757     * @return {@link #url} (The reference details for the link.). This is the
758     *         underlying object with id, value and extensions. The accessor
759     *         "getUrl" gives direct access to the value
760     */
761    public UriType getUrlElement() {
762      if (this.url == null)
763        if (Configuration.errorOnAutoCreate())
764          throw new Error("Attempt to auto-create BundleLinkComponent.url");
765        else if (Configuration.doAutoCreate())
766          this.url = new UriType(); // bb
767      return this.url;
768    }
769
770    public boolean hasUrlElement() {
771      return this.url != null && !this.url.isEmpty();
772    }
773
774    public boolean hasUrl() {
775      return this.url != null && !this.url.isEmpty();
776    }
777
778    /**
779     * @param value {@link #url} (The reference details for the link.). This is the
780     *              underlying object with id, value and extensions. The accessor
781     *              "getUrl" gives direct access to the value
782     */
783    public BundleLinkComponent setUrlElement(UriType value) {
784      this.url = value;
785      return this;
786    }
787
788    /**
789     * @return The reference details for the link.
790     */
791    public String getUrl() {
792      return this.url == null ? null : this.url.getValue();
793    }
794
795    /**
796     * @param value The reference details for the link.
797     */
798    public BundleLinkComponent setUrl(String value) {
799      if (this.url == null)
800        this.url = new UriType();
801      this.url.setValue(value);
802      return this;
803    }
804
805    protected void listChildren(List<Property> children) {
806      super.listChildren(children);
807      children.add(new Property("relation", "string",
808          "A name which details the functional use for this link - see [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1).",
809          0, 1, relation));
810      children.add(new Property("url", "uri", "The reference details for the link.", 0, 1, url));
811    }
812
813    @Override
814    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
815      switch (_hash) {
816      case -554436100:
817        /* relation */ return new Property("relation", "string",
818            "A name which details the functional use for this link - see [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1).",
819            0, 1, relation);
820      case 116079:
821        /* url */ return new Property("url", "uri", "The reference details for the link.", 0, 1, url);
822      default:
823        return super.getNamedProperty(_hash, _name, _checkValid);
824      }
825
826    }
827
828    @Override
829    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
830      switch (hash) {
831      case -554436100:
832        /* relation */ return this.relation == null ? new Base[0] : new Base[] { this.relation }; // StringType
833      case 116079:
834        /* url */ return this.url == null ? new Base[0] : new Base[] { this.url }; // UriType
835      default:
836        return super.getProperty(hash, name, checkValid);
837      }
838
839    }
840
841    @Override
842    public Base setProperty(int hash, String name, Base value) throws FHIRException {
843      switch (hash) {
844      case -554436100: // relation
845        this.relation = castToString(value); // StringType
846        return value;
847      case 116079: // url
848        this.url = castToUri(value); // UriType
849        return value;
850      default:
851        return super.setProperty(hash, name, value);
852      }
853
854    }
855
856    @Override
857    public Base setProperty(String name, Base value) throws FHIRException {
858      if (name.equals("relation")) {
859        this.relation = castToString(value); // StringType
860      } else if (name.equals("url")) {
861        this.url = castToUri(value); // UriType
862      } else
863        return super.setProperty(name, value);
864      return value;
865    }
866
867  @Override
868  public void removeChild(String name, Base value) throws FHIRException {
869      if (name.equals("relation")) {
870        this.relation = null;
871      } else if (name.equals("url")) {
872        this.url = null;
873      } else
874        super.removeChild(name, value);
875      
876    }
877
878    @Override
879    public Base makeProperty(int hash, String name) throws FHIRException {
880      switch (hash) {
881      case -554436100:
882        return getRelationElement();
883      case 116079:
884        return getUrlElement();
885      default:
886        return super.makeProperty(hash, name);
887      }
888
889    }
890
891    @Override
892    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
893      switch (hash) {
894      case -554436100:
895        /* relation */ return new String[] { "string" };
896      case 116079:
897        /* url */ return new String[] { "uri" };
898      default:
899        return super.getTypesForProperty(hash, name);
900      }
901
902    }
903
904    @Override
905    public Base addChild(String name) throws FHIRException {
906      if (name.equals("relation")) {
907        throw new FHIRException("Cannot call addChild on a singleton property Bundle.relation");
908      } else if (name.equals("url")) {
909        throw new FHIRException("Cannot call addChild on a singleton property Bundle.url");
910      } else
911        return super.addChild(name);
912    }
913
914    public BundleLinkComponent copy() {
915      BundleLinkComponent dst = new BundleLinkComponent();
916      copyValues(dst);
917      return dst;
918    }
919
920    public void copyValues(BundleLinkComponent dst) {
921      super.copyValues(dst);
922      dst.relation = relation == null ? null : relation.copy();
923      dst.url = url == null ? null : url.copy();
924    }
925
926    @Override
927    public boolean equalsDeep(Base other_) {
928      if (!super.equalsDeep(other_))
929        return false;
930      if (!(other_ instanceof BundleLinkComponent))
931        return false;
932      BundleLinkComponent o = (BundleLinkComponent) other_;
933      return compareDeep(relation, o.relation, true) && compareDeep(url, o.url, true);
934    }
935
936    @Override
937    public boolean equalsShallow(Base other_) {
938      if (!super.equalsShallow(other_))
939        return false;
940      if (!(other_ instanceof BundleLinkComponent))
941        return false;
942      BundleLinkComponent o = (BundleLinkComponent) other_;
943      return compareValues(relation, o.relation, true) && compareValues(url, o.url, true);
944    }
945
946    public boolean isEmpty() {
947      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(relation, url);
948    }
949
950    public String fhirType() {
951      return "Bundle.link";
952
953    }
954
955  }
956
957  @Block()
958  public static class BundleEntryComponent extends BackboneElement implements IBaseBackboneElement {
959    /**
960     * A series of links that provide context to this entry.
961     */
962    @Child(name = "link", type = {
963        BundleLinkComponent.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
964    @Description(shortDefinition = "Links related to this entry", formalDefinition = "A series of links that provide context to this entry.")
965    protected List<BundleLinkComponent> link;
966
967    /**
968     * The Absolute URL for the resource. The fullUrl SHALL NOT disagree with the id
969     * in the resource - i.e. if the fullUrl is not a urn:uuid, the URL shall be
970     * version-independent URL consistent with the Resource.id. The fullUrl is a
971     * version independent reference to the resource. The fullUrl element SHALL have
972     * a value except that: fullUrl can be empty on a POST (although it does not
973     * need to when specifying a temporary id for reference in the bundle) Results
974     * from operations might involve resources that are not identified.
975     */
976    @Child(name = "fullUrl", type = { UriType.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
977    @Description(shortDefinition = "URI for resource (Absolute URL server address or URI for UUID/OID)", formalDefinition = "The Absolute URL for the resource.  The fullUrl SHALL NOT disagree with the id in the resource - i.e. if the fullUrl is not a urn:uuid, the URL shall be version-independent URL consistent with the Resource.id. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: \n* fullUrl can be empty on a POST (although it does not need to when specifying a temporary id for reference in the bundle)\n* Results from operations might involve resources that are not identified.")
978    protected UriType fullUrl;
979
980    /**
981     * The Resource for the entry. The purpose/meaning of the resource is determined
982     * by the Bundle.type.
983     */
984    @Child(name = "resource", type = { Resource.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
985    @Description(shortDefinition = "A resource in the bundle", formalDefinition = "The Resource for the entry. The purpose/meaning of the resource is determined by the Bundle.type.")
986    protected Resource resource;
987
988    /**
989     * Information about the search process that lead to the creation of this entry.
990     */
991    @Child(name = "search", type = {}, order = 4, min = 0, max = 1, modifier = false, summary = true)
992    @Description(shortDefinition = "Search related information", formalDefinition = "Information about the search process that lead to the creation of this entry.")
993    protected BundleEntrySearchComponent search;
994
995    /**
996     * Additional information about how this entry should be processed as part of a
997     * transaction or batch. For history, it shows how the entry was processed to
998     * create the version contained in the entry.
999     */
1000    @Child(name = "request", type = {}, order = 5, min = 0, max = 1, modifier = false, summary = true)
1001    @Description(shortDefinition = "Additional execution information (transaction/batch/history)", formalDefinition = "Additional information about how this entry should be processed as part of a transaction or batch.  For history, it shows how the entry was processed to create the version contained in the entry.")
1002    protected BundleEntryRequestComponent request;
1003
1004    /**
1005     * Indicates the results of processing the corresponding 'request' entry in the
1006     * batch or transaction being responded to or what the results of an operation
1007     * where when returning history.
1008     */
1009    @Child(name = "response", type = {}, order = 6, min = 0, max = 1, modifier = false, summary = true)
1010    @Description(shortDefinition = "Results of execution (transaction/batch/history)", formalDefinition = "Indicates the results of processing the corresponding 'request' entry in the batch or transaction being responded to or what the results of an operation where when returning history.")
1011    protected BundleEntryResponseComponent response;
1012
1013    private static final long serialVersionUID = 517783054L;
1014
1015    /**
1016     * Constructor
1017     */
1018    public BundleEntryComponent() {
1019      super();
1020    }
1021
1022    /**
1023     * @return {@link #link} (A series of links that provide context to this entry.)
1024     */
1025    public List<BundleLinkComponent> getLink() {
1026      if (this.link == null)
1027        this.link = new ArrayList<BundleLinkComponent>();
1028      return this.link;
1029    }
1030
1031    /**
1032     * @return Returns a reference to <code>this</code> for easy method chaining
1033     */
1034    public BundleEntryComponent setLink(List<BundleLinkComponent> theLink) {
1035      this.link = theLink;
1036      return this;
1037    }
1038
1039    public boolean hasLink() {
1040      if (this.link == null)
1041        return false;
1042      for (BundleLinkComponent item : this.link)
1043        if (!item.isEmpty())
1044          return true;
1045      return false;
1046    }
1047
1048    public BundleLinkComponent addLink() { // 3
1049      BundleLinkComponent t = new BundleLinkComponent();
1050      if (this.link == null)
1051        this.link = new ArrayList<BundleLinkComponent>();
1052      this.link.add(t);
1053      return t;
1054    }
1055
1056    public BundleEntryComponent addLink(BundleLinkComponent t) { // 3
1057      if (t == null)
1058        return this;
1059      if (this.link == null)
1060        this.link = new ArrayList<BundleLinkComponent>();
1061      this.link.add(t);
1062      return this;
1063    }
1064
1065    /**
1066     * @return The first repetition of repeating field {@link #link}, creating it if
1067     *         it does not already exist
1068     */
1069    public BundleLinkComponent getLinkFirstRep() {
1070      if (getLink().isEmpty()) {
1071        addLink();
1072      }
1073      return getLink().get(0);
1074    }
1075
1076    /**
1077     * @return {@link #fullUrl} (The Absolute URL for the resource. The fullUrl
1078     *         SHALL NOT disagree with the id in the resource - i.e. if the fullUrl
1079     *         is not a urn:uuid, the URL shall be version-independent URL
1080     *         consistent with the Resource.id. The fullUrl is a version independent
1081     *         reference to the resource. The fullUrl element SHALL have a value
1082     *         except that: fullUrl can be empty on a POST (although it does not
1083     *         need to when specifying a temporary id for reference in the bundle)
1084     *         Results from operations might involve resources that are not
1085     *         identified.). This is the underlying object with id, value and
1086     *         extensions. The accessor "getFullUrl" gives direct access to the
1087     *         value
1088     */
1089    public UriType getFullUrlElement() {
1090      if (this.fullUrl == null)
1091        if (Configuration.errorOnAutoCreate())
1092          throw new Error("Attempt to auto-create BundleEntryComponent.fullUrl");
1093        else if (Configuration.doAutoCreate())
1094          this.fullUrl = new UriType(); // bb
1095      return this.fullUrl;
1096    }
1097
1098    public boolean hasFullUrlElement() {
1099      return this.fullUrl != null && !this.fullUrl.isEmpty();
1100    }
1101
1102    public boolean hasFullUrl() {
1103      return this.fullUrl != null && !this.fullUrl.isEmpty();
1104    }
1105
1106    /**
1107     * @param value {@link #fullUrl} (The Absolute URL for the resource. The fullUrl
1108     *              SHALL NOT disagree with the id in the resource - i.e. if the
1109     *              fullUrl is not a urn:uuid, the URL shall be version-independent
1110     *              URL consistent with the Resource.id. The fullUrl is a version
1111     *              independent reference to the resource. The fullUrl element SHALL
1112     *              have a value except that: fullUrl can be empty on a POST
1113     *              (although it does not need to when specifying a temporary id for
1114     *              reference in the bundle) Results from operations might involve
1115     *              resources that are not identified.). This is the underlying
1116     *              object with id, value and extensions. The accessor "getFullUrl"
1117     *              gives direct access to the value
1118     */
1119    public BundleEntryComponent setFullUrlElement(UriType value) {
1120      this.fullUrl = value;
1121      return this;
1122    }
1123
1124    /**
1125     * @return The Absolute URL for the resource. The fullUrl SHALL NOT disagree
1126     *         with the id in the resource - i.e. if the fullUrl is not a urn:uuid,
1127     *         the URL shall be version-independent URL consistent with the
1128     *         Resource.id. The fullUrl is a version independent reference to the
1129     *         resource. The fullUrl element SHALL have a value except that: fullUrl
1130     *         can be empty on a POST (although it does not need to when specifying
1131     *         a temporary id for reference in the bundle) Results from operations
1132     *         might involve resources that are not identified.
1133     */
1134    public String getFullUrl() {
1135      return this.fullUrl == null ? null : this.fullUrl.getValue();
1136    }
1137
1138    /**
1139     * @param value The Absolute URL for the resource. The fullUrl SHALL NOT
1140     *              disagree with the id in the resource - i.e. if the fullUrl is
1141     *              not a urn:uuid, the URL shall be version-independent URL
1142     *              consistent with the Resource.id. The fullUrl is a version
1143     *              independent reference to the resource. The fullUrl element SHALL
1144     *              have a value except that: fullUrl can be empty on a POST
1145     *              (although it does not need to when specifying a temporary id for
1146     *              reference in the bundle) Results from operations might involve
1147     *              resources that are not identified.
1148     */
1149    public BundleEntryComponent setFullUrl(String value) {
1150      if (Utilities.noString(value))
1151        this.fullUrl = null;
1152      else {
1153        if (this.fullUrl == null)
1154          this.fullUrl = new UriType();
1155        this.fullUrl.setValue(value);
1156      }
1157      return this;
1158    }
1159
1160    /**
1161     * @return {@link #resource} (The Resource for the entry. The purpose/meaning of
1162     *         the resource is determined by the Bundle.type.)
1163     */
1164    public Resource getResource() {
1165      return this.resource;
1166    }
1167
1168    public boolean hasResource() {
1169      return this.resource != null && !this.resource.isEmpty();
1170    }
1171
1172    /**
1173     * @param value {@link #resource} (The Resource for the entry. The
1174     *              purpose/meaning of the resource is determined by the
1175     *              Bundle.type.)
1176     */
1177    public BundleEntryComponent setResource(Resource value) {
1178      this.resource = value;
1179      return this;
1180    }
1181
1182    /**
1183     * @return {@link #search} (Information about the search process that lead to
1184     *         the creation of this entry.)
1185     */
1186    public BundleEntrySearchComponent getSearch() {
1187      if (this.search == null)
1188        if (Configuration.errorOnAutoCreate())
1189          throw new Error("Attempt to auto-create BundleEntryComponent.search");
1190        else if (Configuration.doAutoCreate())
1191          this.search = new BundleEntrySearchComponent(); // cc
1192      return this.search;
1193    }
1194
1195    public boolean hasSearch() {
1196      return this.search != null && !this.search.isEmpty();
1197    }
1198
1199    /**
1200     * @param value {@link #search} (Information about the search process that lead
1201     *              to the creation of this entry.)
1202     */
1203    public BundleEntryComponent setSearch(BundleEntrySearchComponent value) {
1204      this.search = value;
1205      return this;
1206    }
1207
1208    /**
1209     * @return {@link #request} (Additional information about how this entry should
1210     *         be processed as part of a transaction or batch. For history, it shows
1211     *         how the entry was processed to create the version contained in the
1212     *         entry.)
1213     */
1214    public BundleEntryRequestComponent getRequest() {
1215      if (this.request == null)
1216        if (Configuration.errorOnAutoCreate())
1217          throw new Error("Attempt to auto-create BundleEntryComponent.request");
1218        else if (Configuration.doAutoCreate())
1219          this.request = new BundleEntryRequestComponent(); // cc
1220      return this.request;
1221    }
1222
1223    public boolean hasRequest() {
1224      return this.request != null && !this.request.isEmpty();
1225    }
1226
1227    /**
1228     * @param value {@link #request} (Additional information about how this entry
1229     *              should be processed as part of a transaction or batch. For
1230     *              history, it shows how the entry was processed to create the
1231     *              version contained in the entry.)
1232     */
1233    public BundleEntryComponent setRequest(BundleEntryRequestComponent value) {
1234      this.request = value;
1235      return this;
1236    }
1237
1238    /**
1239     * @return {@link #response} (Indicates the results of processing the
1240     *         corresponding 'request' entry in the batch or transaction being
1241     *         responded to or what the results of an operation where when returning
1242     *         history.)
1243     */
1244    public BundleEntryResponseComponent getResponse() {
1245      if (this.response == null)
1246        if (Configuration.errorOnAutoCreate())
1247          throw new Error("Attempt to auto-create BundleEntryComponent.response");
1248        else if (Configuration.doAutoCreate())
1249          this.response = new BundleEntryResponseComponent(); // cc
1250      return this.response;
1251    }
1252
1253    public boolean hasResponse() {
1254      return this.response != null && !this.response.isEmpty();
1255    }
1256
1257    /**
1258     * @param value {@link #response} (Indicates the results of processing the
1259     *              corresponding 'request' entry in the batch or transaction being
1260     *              responded to or what the results of an operation where when
1261     *              returning history.)
1262     */
1263    public BundleEntryComponent setResponse(BundleEntryResponseComponent value) {
1264      this.response = value;
1265      return this;
1266    }
1267
1268    /**
1269     * Returns the {@link #getLink() link} which matches a given
1270     * {@link BundleLinkComponent#getRelation() relation}. If no link is found which
1271     * matches the given relation, returns <code>null</code>. If more than one link
1272     * is found which matches the given relation, returns the first matching
1273     * BundleLinkComponent.
1274     * 
1275     * @param theRelation The relation, such as "next", or "self. See the constants
1276     *                    such as {@link IBaseBundle#LINK_SELF} and
1277     *                    {@link IBaseBundle#LINK_NEXT}.
1278     * @return Returns a matching BundleLinkComponent, or <code>null</code>
1279     * @see IBaseBundle#LINK_NEXT
1280     * @see IBaseBundle#LINK_PREV
1281     * @see IBaseBundle#LINK_SELF
1282     */
1283    public BundleLinkComponent getLink(String theRelation) {
1284      org.apache.commons.lang3.Validate.notBlank(theRelation, "theRelation may not be null or empty");
1285      for (BundleLinkComponent next : getLink()) {
1286        if (theRelation.equals(next.getRelation())) {
1287          return next;
1288        }
1289      }
1290      return null;
1291    }
1292
1293    /**
1294     * Returns the {@link #getLink() link} which matches a given
1295     * {@link BundleLinkComponent#getRelation() relation}. If no link is found which
1296     * matches the given relation, creates a new BundleLinkComponent with the given
1297     * relation and adds it to this Bundle. If more than one link is found which
1298     * matches the given relation, returns the first matching BundleLinkComponent.
1299     * 
1300     * @param theRelation The relation, such as "next", or "self. See the constants
1301     *                    such as {@link IBaseBundle#LINK_SELF} and
1302     *                    {@link IBaseBundle#LINK_NEXT}.
1303     * @return Returns a matching BundleLinkComponent, or <code>null</code>
1304     * @see IBaseBundle#LINK_NEXT
1305     * @see IBaseBundle#LINK_PREV
1306     * @see IBaseBundle#LINK_SELF
1307     */
1308    public BundleLinkComponent getLinkOrCreate(String theRelation) {
1309      org.apache.commons.lang3.Validate.notBlank(theRelation, "theRelation may not be null or empty");
1310      for (BundleLinkComponent next : getLink()) {
1311        if (theRelation.equals(next.getRelation())) {
1312          return next;
1313        }
1314      }
1315      BundleLinkComponent retVal = new BundleLinkComponent();
1316      retVal.setRelation(theRelation);
1317      getLink().add(retVal);
1318      return retVal;
1319    }
1320
1321    protected void listChildren(List<Property> children) {
1322      super.listChildren(children);
1323      children.add(new Property("link", "@Bundle.link", "A series of links that provide context to this entry.", 0,
1324          java.lang.Integer.MAX_VALUE, link));
1325      children.add(new Property("fullUrl", "uri",
1326          "The Absolute URL for the resource.  The fullUrl SHALL NOT disagree with the id in the resource - i.e. if the fullUrl is not a urn:uuid, the URL shall be version-independent URL consistent with the Resource.id. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: \n* fullUrl can be empty on a POST (although it does not need to when specifying a temporary id for reference in the bundle)\n* Results from operations might involve resources that are not identified.",
1327          0, 1, fullUrl));
1328      children.add(new Property("resource", "Resource",
1329          "The Resource for the entry. The purpose/meaning of the resource is determined by the Bundle.type.", 0, 1,
1330          resource));
1331      children.add(new Property("search", "",
1332          "Information about the search process that lead to the creation of this entry.", 0, 1, search));
1333      children.add(new Property("request", "",
1334          "Additional information about how this entry should be processed as part of a transaction or batch.  For history, it shows how the entry was processed to create the version contained in the entry.",
1335          0, 1, request));
1336      children.add(new Property("response", "",
1337          "Indicates the results of processing the corresponding 'request' entry in the batch or transaction being responded to or what the results of an operation where when returning history.",
1338          0, 1, response));
1339    }
1340
1341    @Override
1342    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1343      switch (_hash) {
1344      case 3321850:
1345        /* link */ return new Property("link", "@Bundle.link", "A series of links that provide context to this entry.",
1346            0, java.lang.Integer.MAX_VALUE, link);
1347      case -511251360:
1348        /* fullUrl */ return new Property("fullUrl", "uri",
1349            "The Absolute URL for the resource.  The fullUrl SHALL NOT disagree with the id in the resource - i.e. if the fullUrl is not a urn:uuid, the URL shall be version-independent URL consistent with the Resource.id. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: \n* fullUrl can be empty on a POST (although it does not need to when specifying a temporary id for reference in the bundle)\n* Results from operations might involve resources that are not identified.",
1350            0, 1, fullUrl);
1351      case -341064690:
1352        /* resource */ return new Property("resource", "Resource",
1353            "The Resource for the entry. The purpose/meaning of the resource is determined by the Bundle.type.", 0, 1,
1354            resource);
1355      case -906336856:
1356        /* search */ return new Property("search", "",
1357            "Information about the search process that lead to the creation of this entry.", 0, 1, search);
1358      case 1095692943:
1359        /* request */ return new Property("request", "",
1360            "Additional information about how this entry should be processed as part of a transaction or batch.  For history, it shows how the entry was processed to create the version contained in the entry.",
1361            0, 1, request);
1362      case -340323263:
1363        /* response */ return new Property("response", "",
1364            "Indicates the results of processing the corresponding 'request' entry in the batch or transaction being responded to or what the results of an operation where when returning history.",
1365            0, 1, response);
1366      default:
1367        return super.getNamedProperty(_hash, _name, _checkValid);
1368      }
1369
1370    }
1371
1372    @Override
1373    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1374      switch (hash) {
1375      case 3321850:
1376        /* link */ return this.link == null ? new Base[0] : this.link.toArray(new Base[this.link.size()]); // BundleLinkComponent
1377      case -511251360:
1378        /* fullUrl */ return this.fullUrl == null ? new Base[0] : new Base[] { this.fullUrl }; // UriType
1379      case -341064690:
1380        /* resource */ return this.resource == null ? new Base[0] : new Base[] { this.resource }; // Resource
1381      case -906336856:
1382        /* search */ return this.search == null ? new Base[0] : new Base[] { this.search }; // BundleEntrySearchComponent
1383      case 1095692943:
1384        /* request */ return this.request == null ? new Base[0] : new Base[] { this.request }; // BundleEntryRequestComponent
1385      case -340323263:
1386        /* response */ return this.response == null ? new Base[0] : new Base[] { this.response }; // BundleEntryResponseComponent
1387      default:
1388        return super.getProperty(hash, name, checkValid);
1389      }
1390
1391    }
1392
1393    @Override
1394    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1395      switch (hash) {
1396      case 3321850: // link
1397        this.getLink().add((BundleLinkComponent) value); // BundleLinkComponent
1398        return value;
1399      case -511251360: // fullUrl
1400        this.fullUrl = castToUri(value); // UriType
1401        return value;
1402      case -341064690: // resource
1403        this.resource = castToResource(value); // Resource
1404        return value;
1405      case -906336856: // search
1406        this.search = (BundleEntrySearchComponent) value; // BundleEntrySearchComponent
1407        return value;
1408      case 1095692943: // request
1409        this.request = (BundleEntryRequestComponent) value; // BundleEntryRequestComponent
1410        return value;
1411      case -340323263: // response
1412        this.response = (BundleEntryResponseComponent) value; // BundleEntryResponseComponent
1413        return value;
1414      default:
1415        return super.setProperty(hash, name, value);
1416      }
1417
1418    }
1419
1420    @Override
1421    public Base setProperty(String name, Base value) throws FHIRException {
1422      if (name.equals("link")) {
1423        this.getLink().add((BundleLinkComponent) value);
1424      } else if (name.equals("fullUrl")) {
1425        this.fullUrl = castToUri(value); // UriType
1426      } else if (name.equals("resource")) {
1427        this.resource = castToResource(value); // Resource
1428      } else if (name.equals("search")) {
1429        this.search = (BundleEntrySearchComponent) value; // BundleEntrySearchComponent
1430      } else if (name.equals("request")) {
1431        this.request = (BundleEntryRequestComponent) value; // BundleEntryRequestComponent
1432      } else if (name.equals("response")) {
1433        this.response = (BundleEntryResponseComponent) value; // BundleEntryResponseComponent
1434      } else
1435        return super.setProperty(name, value);
1436      return value;
1437    }
1438
1439  @Override
1440  public void removeChild(String name, Base value) throws FHIRException {
1441      if (name.equals("link")) {
1442        this.getLink().remove((BundleLinkComponent) value);
1443      } else if (name.equals("fullUrl")) {
1444        this.fullUrl = null;
1445      } else if (name.equals("resource")) {
1446        this.resource = null;
1447      } else if (name.equals("search")) {
1448        this.search = (BundleEntrySearchComponent) value; // BundleEntrySearchComponent
1449      } else if (name.equals("request")) {
1450        this.request = (BundleEntryRequestComponent) value; // BundleEntryRequestComponent
1451      } else if (name.equals("response")) {
1452        this.response = (BundleEntryResponseComponent) value; // BundleEntryResponseComponent
1453      } else
1454        super.removeChild(name, value);
1455      
1456    }
1457
1458    @Override
1459    public Base makeProperty(int hash, String name) throws FHIRException {
1460      switch (hash) {
1461      case 3321850:
1462        return addLink();
1463      case -511251360:
1464        return getFullUrlElement();
1465      case -341064690:
1466        throw new FHIRException("Cannot make property resource as it is not a complex type"); // Resource
1467      case -906336856:
1468        return getSearch();
1469      case 1095692943:
1470        return getRequest();
1471      case -340323263:
1472        return getResponse();
1473      default:
1474        return super.makeProperty(hash, name);
1475      }
1476
1477    }
1478
1479    @Override
1480    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1481      switch (hash) {
1482      case 3321850:
1483        /* link */ return new String[] { "@Bundle.link" };
1484      case -511251360:
1485        /* fullUrl */ return new String[] { "uri" };
1486      case -341064690:
1487        /* resource */ return new String[] { "Resource" };
1488      case -906336856:
1489        /* search */ return new String[] {};
1490      case 1095692943:
1491        /* request */ return new String[] {};
1492      case -340323263:
1493        /* response */ return new String[] {};
1494      default:
1495        return super.getTypesForProperty(hash, name);
1496      }
1497
1498    }
1499
1500    @Override
1501    public Base addChild(String name) throws FHIRException {
1502      if (name.equals("link")) {
1503        return addLink();
1504      } else if (name.equals("fullUrl")) {
1505        throw new FHIRException("Cannot call addChild on a singleton property Bundle.fullUrl");
1506      } else if (name.equals("resource")) {
1507        throw new FHIRException("Cannot call addChild on an abstract type Bundle.resource");
1508      } else if (name.equals("search")) {
1509        this.search = new BundleEntrySearchComponent();
1510        return this.search;
1511      } else if (name.equals("request")) {
1512        this.request = new BundleEntryRequestComponent();
1513        return this.request;
1514      } else if (name.equals("response")) {
1515        this.response = new BundleEntryResponseComponent();
1516        return this.response;
1517      } else
1518        return super.addChild(name);
1519    }
1520
1521    public BundleEntryComponent copy() {
1522      BundleEntryComponent dst = new BundleEntryComponent();
1523      copyValues(dst);
1524      return dst;
1525    }
1526
1527    public void copyValues(BundleEntryComponent dst) {
1528      super.copyValues(dst);
1529      if (link != null) {
1530        dst.link = new ArrayList<BundleLinkComponent>();
1531        for (BundleLinkComponent i : link)
1532          dst.link.add(i.copy());
1533      }
1534      ;
1535      dst.fullUrl = fullUrl == null ? null : fullUrl.copy();
1536      dst.resource = resource == null ? null : resource.copy();
1537      dst.search = search == null ? null : search.copy();
1538      dst.request = request == null ? null : request.copy();
1539      dst.response = response == null ? null : response.copy();
1540    }
1541
1542    @Override
1543    public boolean equalsDeep(Base other_) {
1544      if (!super.equalsDeep(other_))
1545        return false;
1546      if (!(other_ instanceof BundleEntryComponent))
1547        return false;
1548      BundleEntryComponent o = (BundleEntryComponent) other_;
1549      return compareDeep(link, o.link, true) && compareDeep(fullUrl, o.fullUrl, true)
1550          && compareDeep(resource, o.resource, true) && compareDeep(search, o.search, true)
1551          && compareDeep(request, o.request, true) && compareDeep(response, o.response, true);
1552    }
1553
1554    @Override
1555    public boolean equalsShallow(Base other_) {
1556      if (!super.equalsShallow(other_))
1557        return false;
1558      if (!(other_ instanceof BundleEntryComponent))
1559        return false;
1560      BundleEntryComponent o = (BundleEntryComponent) other_;
1561      return compareValues(fullUrl, o.fullUrl, true);
1562    }
1563
1564    public boolean isEmpty() {
1565      return super.isEmpty()
1566          && ca.uhn.fhir.util.ElementUtil.isEmpty(link, fullUrl, resource, search, request, response);
1567    }
1568
1569    public String fhirType() {
1570      return "Bundle.entry";
1571
1572    }
1573
1574  }
1575
1576  @Block()
1577  public static class BundleEntrySearchComponent extends BackboneElement implements IBaseBackboneElement {
1578    /**
1579     * Why this entry is in the result set - whether it's included as a match or
1580     * because of an _include requirement, or to convey information or warning
1581     * information about the search process.
1582     */
1583    @Child(name = "mode", type = { CodeType.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
1584    @Description(shortDefinition = "match | include | outcome - why this is in the result set", formalDefinition = "Why this entry is in the result set - whether it's included as a match or because of an _include requirement, or to convey information or warning information about the search process.")
1585    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/search-entry-mode")
1586    protected Enumeration<SearchEntryMode> mode;
1587
1588    /**
1589     * When searching, the server's search ranking score for the entry.
1590     */
1591    @Child(name = "score", type = { DecimalType.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
1592    @Description(shortDefinition = "Search ranking (between 0 and 1)", formalDefinition = "When searching, the server's search ranking score for the entry.")
1593    protected DecimalType score;
1594
1595    private static final long serialVersionUID = 837739866L;
1596
1597    /**
1598     * Constructor
1599     */
1600    public BundleEntrySearchComponent() {
1601      super();
1602    }
1603
1604    /**
1605     * @return {@link #mode} (Why this entry is in the result set - whether it's
1606     *         included as a match or because of an _include requirement, or to
1607     *         convey information or warning information about the search process.).
1608     *         This is the underlying object with id, value and extensions. The
1609     *         accessor "getMode" gives direct access to the value
1610     */
1611    public Enumeration<SearchEntryMode> getModeElement() {
1612      if (this.mode == null)
1613        if (Configuration.errorOnAutoCreate())
1614          throw new Error("Attempt to auto-create BundleEntrySearchComponent.mode");
1615        else if (Configuration.doAutoCreate())
1616          this.mode = new Enumeration<SearchEntryMode>(new SearchEntryModeEnumFactory()); // bb
1617      return this.mode;
1618    }
1619
1620    public boolean hasModeElement() {
1621      return this.mode != null && !this.mode.isEmpty();
1622    }
1623
1624    public boolean hasMode() {
1625      return this.mode != null && !this.mode.isEmpty();
1626    }
1627
1628    /**
1629     * @param value {@link #mode} (Why this entry is in the result set - whether
1630     *              it's included as a match or because of an _include requirement,
1631     *              or to convey information or warning information about the search
1632     *              process.). This is the underlying object with id, value and
1633     *              extensions. The accessor "getMode" gives direct access to the
1634     *              value
1635     */
1636    public BundleEntrySearchComponent setModeElement(Enumeration<SearchEntryMode> value) {
1637      this.mode = value;
1638      return this;
1639    }
1640
1641    /**
1642     * @return Why this entry is in the result set - whether it's included as a
1643     *         match or because of an _include requirement, or to convey information
1644     *         or warning information about the search process.
1645     */
1646    public SearchEntryMode getMode() {
1647      return this.mode == null ? null : this.mode.getValue();
1648    }
1649
1650    /**
1651     * @param value Why this entry is in the result set - whether it's included as a
1652     *              match or because of an _include requirement, or to convey
1653     *              information or warning information about the search process.
1654     */
1655    public BundleEntrySearchComponent setMode(SearchEntryMode value) {
1656      if (value == null)
1657        this.mode = null;
1658      else {
1659        if (this.mode == null)
1660          this.mode = new Enumeration<SearchEntryMode>(new SearchEntryModeEnumFactory());
1661        this.mode.setValue(value);
1662      }
1663      return this;
1664    }
1665
1666    /**
1667     * @return {@link #score} (When searching, the server's search ranking score for
1668     *         the entry.). This is the underlying object with id, value and
1669     *         extensions. The accessor "getScore" gives direct access to the value
1670     */
1671    public DecimalType getScoreElement() {
1672      if (this.score == null)
1673        if (Configuration.errorOnAutoCreate())
1674          throw new Error("Attempt to auto-create BundleEntrySearchComponent.score");
1675        else if (Configuration.doAutoCreate())
1676          this.score = new DecimalType(); // bb
1677      return this.score;
1678    }
1679
1680    public boolean hasScoreElement() {
1681      return this.score != null && !this.score.isEmpty();
1682    }
1683
1684    public boolean hasScore() {
1685      return this.score != null && !this.score.isEmpty();
1686    }
1687
1688    /**
1689     * @param value {@link #score} (When searching, the server's search ranking
1690     *              score for the entry.). This is the underlying object with id,
1691     *              value and extensions. The accessor "getScore" gives direct
1692     *              access to the value
1693     */
1694    public BundleEntrySearchComponent setScoreElement(DecimalType value) {
1695      this.score = value;
1696      return this;
1697    }
1698
1699    /**
1700     * @return When searching, the server's search ranking score for the entry.
1701     */
1702    public BigDecimal getScore() {
1703      return this.score == null ? null : this.score.getValue();
1704    }
1705
1706    /**
1707     * @param value When searching, the server's search ranking score for the entry.
1708     */
1709    public BundleEntrySearchComponent setScore(BigDecimal value) {
1710      if (value == null)
1711        this.score = null;
1712      else {
1713        if (this.score == null)
1714          this.score = new DecimalType();
1715        this.score.setValue(value);
1716      }
1717      return this;
1718    }
1719
1720    /**
1721     * @param value When searching, the server's search ranking score for the entry.
1722     */
1723    public BundleEntrySearchComponent setScore(long value) {
1724      this.score = new DecimalType();
1725      this.score.setValue(value);
1726      return this;
1727    }
1728
1729    /**
1730     * @param value When searching, the server's search ranking score for the entry.
1731     */
1732    public BundleEntrySearchComponent setScore(double value) {
1733      this.score = new DecimalType();
1734      this.score.setValue(value);
1735      return this;
1736    }
1737
1738    protected void listChildren(List<Property> children) {
1739      super.listChildren(children);
1740      children.add(new Property("mode", "code",
1741          "Why this entry is in the result set - whether it's included as a match or because of an _include requirement, or to convey information or warning information about the search process.",
1742          0, 1, mode));
1743      children.add(new Property("score", "decimal", "When searching, the server's search ranking score for the entry.",
1744          0, 1, score));
1745    }
1746
1747    @Override
1748    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1749      switch (_hash) {
1750      case 3357091:
1751        /* mode */ return new Property("mode", "code",
1752            "Why this entry is in the result set - whether it's included as a match or because of an _include requirement, or to convey information or warning information about the search process.",
1753            0, 1, mode);
1754      case 109264530:
1755        /* score */ return new Property("score", "decimal",
1756            "When searching, the server's search ranking score for the entry.", 0, 1, score);
1757      default:
1758        return super.getNamedProperty(_hash, _name, _checkValid);
1759      }
1760
1761    }
1762
1763    @Override
1764    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1765      switch (hash) {
1766      case 3357091:
1767        /* mode */ return this.mode == null ? new Base[0] : new Base[] { this.mode }; // Enumeration<SearchEntryMode>
1768      case 109264530:
1769        /* score */ return this.score == null ? new Base[0] : new Base[] { this.score }; // DecimalType
1770      default:
1771        return super.getProperty(hash, name, checkValid);
1772      }
1773
1774    }
1775
1776    @Override
1777    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1778      switch (hash) {
1779      case 3357091: // mode
1780        value = new SearchEntryModeEnumFactory().fromType(castToCode(value));
1781        this.mode = (Enumeration) value; // Enumeration<SearchEntryMode>
1782        return value;
1783      case 109264530: // score
1784        this.score = castToDecimal(value); // DecimalType
1785        return value;
1786      default:
1787        return super.setProperty(hash, name, value);
1788      }
1789
1790    }
1791
1792    @Override
1793    public Base setProperty(String name, Base value) throws FHIRException {
1794      if (name.equals("mode")) {
1795        value = new SearchEntryModeEnumFactory().fromType(castToCode(value));
1796        this.mode = (Enumeration) value; // Enumeration<SearchEntryMode>
1797      } else if (name.equals("score")) {
1798        this.score = castToDecimal(value); // DecimalType
1799      } else
1800        return super.setProperty(name, value);
1801      return value;
1802    }
1803
1804  @Override
1805  public void removeChild(String name, Base value) throws FHIRException {
1806      if (name.equals("mode")) {
1807        this.mode = null;
1808      } else if (name.equals("score")) {
1809        this.score = null;
1810      } else
1811        super.removeChild(name, value);
1812      
1813    }
1814
1815    @Override
1816    public Base makeProperty(int hash, String name) throws FHIRException {
1817      switch (hash) {
1818      case 3357091:
1819        return getModeElement();
1820      case 109264530:
1821        return getScoreElement();
1822      default:
1823        return super.makeProperty(hash, name);
1824      }
1825
1826    }
1827
1828    @Override
1829    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1830      switch (hash) {
1831      case 3357091:
1832        /* mode */ return new String[] { "code" };
1833      case 109264530:
1834        /* score */ return new String[] { "decimal" };
1835      default:
1836        return super.getTypesForProperty(hash, name);
1837      }
1838
1839    }
1840
1841    @Override
1842    public Base addChild(String name) throws FHIRException {
1843      if (name.equals("mode")) {
1844        throw new FHIRException("Cannot call addChild on a singleton property Bundle.mode");
1845      } else if (name.equals("score")) {
1846        throw new FHIRException("Cannot call addChild on a singleton property Bundle.score");
1847      } else
1848        return super.addChild(name);
1849    }
1850
1851    public BundleEntrySearchComponent copy() {
1852      BundleEntrySearchComponent dst = new BundleEntrySearchComponent();
1853      copyValues(dst);
1854      return dst;
1855    }
1856
1857    public void copyValues(BundleEntrySearchComponent dst) {
1858      super.copyValues(dst);
1859      dst.mode = mode == null ? null : mode.copy();
1860      dst.score = score == null ? null : score.copy();
1861    }
1862
1863    @Override
1864    public boolean equalsDeep(Base other_) {
1865      if (!super.equalsDeep(other_))
1866        return false;
1867      if (!(other_ instanceof BundleEntrySearchComponent))
1868        return false;
1869      BundleEntrySearchComponent o = (BundleEntrySearchComponent) other_;
1870      return compareDeep(mode, o.mode, true) && compareDeep(score, o.score, true);
1871    }
1872
1873    @Override
1874    public boolean equalsShallow(Base other_) {
1875      if (!super.equalsShallow(other_))
1876        return false;
1877      if (!(other_ instanceof BundleEntrySearchComponent))
1878        return false;
1879      BundleEntrySearchComponent o = (BundleEntrySearchComponent) other_;
1880      return compareValues(mode, o.mode, true) && compareValues(score, o.score, true);
1881    }
1882
1883    public boolean isEmpty() {
1884      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(mode, score);
1885    }
1886
1887    public String fhirType() {
1888      return "Bundle.entry.search";
1889
1890    }
1891
1892  }
1893
1894  @Block()
1895  public static class BundleEntryRequestComponent extends BackboneElement implements IBaseBackboneElement {
1896    /**
1897     * In a transaction or batch, this is the HTTP action to be executed for this
1898     * entry. In a history bundle, this indicates the HTTP action that occurred.
1899     */
1900    @Child(name = "method", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
1901    @Description(shortDefinition = "GET | HEAD | POST | PUT | DELETE | PATCH", formalDefinition = "In a transaction or batch, this is the HTTP action to be executed for this entry. In a history bundle, this indicates the HTTP action that occurred.")
1902    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/http-verb")
1903    protected Enumeration<HTTPVerb> method;
1904
1905    /**
1906     * The URL for this entry, relative to the root (the address to which the
1907     * request is posted).
1908     */
1909    @Child(name = "url", type = { UriType.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
1910    @Description(shortDefinition = "URL for HTTP equivalent of this entry", formalDefinition = "The URL for this entry, relative to the root (the address to which the request is posted).")
1911    protected UriType url;
1912
1913    /**
1914     * If the ETag values match, return a 304 Not Modified status. See the API
1915     * documentation for ["Conditional Read"](http.html#cread).
1916     */
1917    @Child(name = "ifNoneMatch", type = {
1918        StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
1919    @Description(shortDefinition = "For managing cache currency", formalDefinition = "If the ETag values match, return a 304 Not Modified status. See the API documentation for [\"Conditional Read\"](http.html#cread).")
1920    protected StringType ifNoneMatch;
1921
1922    /**
1923     * Only perform the operation if the last updated date matches. See the API
1924     * documentation for ["Conditional Read"](http.html#cread).
1925     */
1926    @Child(name = "ifModifiedSince", type = {
1927        InstantType.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
1928    @Description(shortDefinition = "For managing cache currency", formalDefinition = "Only perform the operation if the last updated date matches. See the API documentation for [\"Conditional Read\"](http.html#cread).")
1929    protected InstantType ifModifiedSince;
1930
1931    /**
1932     * Only perform the operation if the Etag value matches. For more information,
1933     * see the API section ["Managing Resource Contention"](http.html#concurrency).
1934     */
1935    @Child(name = "ifMatch", type = { StringType.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
1936    @Description(shortDefinition = "For managing update contention", formalDefinition = "Only perform the operation if the Etag value matches. For more information, see the API section [\"Managing Resource Contention\"](http.html#concurrency).")
1937    protected StringType ifMatch;
1938
1939    /**
1940     * Instruct the server not to perform the create if a specified resource already
1941     * exists. For further information, see the API documentation for ["Conditional
1942     * Create"](http.html#ccreate). This is just the query portion of the URL - what
1943     * follows the "?" (not including the "?").
1944     */
1945    @Child(name = "ifNoneExist", type = {
1946        StringType.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
1947    @Description(shortDefinition = "For conditional creates", formalDefinition = "Instruct the server not to perform the create if a specified resource already exists. For further information, see the API documentation for [\"Conditional Create\"](http.html#ccreate). This is just the query portion of the URL - what follows the \"?\" (not including the \"?\").")
1948    protected StringType ifNoneExist;
1949
1950    private static final long serialVersionUID = -1349769744L;
1951
1952    /**
1953     * Constructor
1954     */
1955    public BundleEntryRequestComponent() {
1956      super();
1957    }
1958
1959    /**
1960     * Constructor
1961     */
1962    public BundleEntryRequestComponent(Enumeration<HTTPVerb> method, UriType url) {
1963      super();
1964      this.method = method;
1965      this.url = url;
1966    }
1967
1968    /**
1969     * @return {@link #method} (In a transaction or batch, this is the HTTP action
1970     *         to be executed for this entry. In a history bundle, this indicates
1971     *         the HTTP action that occurred.). This is the underlying object with
1972     *         id, value and extensions. The accessor "getMethod" gives direct
1973     *         access to the value
1974     */
1975    public Enumeration<HTTPVerb> getMethodElement() {
1976      if (this.method == null)
1977        if (Configuration.errorOnAutoCreate())
1978          throw new Error("Attempt to auto-create BundleEntryRequestComponent.method");
1979        else if (Configuration.doAutoCreate())
1980          this.method = new Enumeration<HTTPVerb>(new HTTPVerbEnumFactory()); // bb
1981      return this.method;
1982    }
1983
1984    public boolean hasMethodElement() {
1985      return this.method != null && !this.method.isEmpty();
1986    }
1987
1988    public boolean hasMethod() {
1989      return this.method != null && !this.method.isEmpty();
1990    }
1991
1992    /**
1993     * @param value {@link #method} (In a transaction or batch, this is the HTTP
1994     *              action to be executed for this entry. In a history bundle, this
1995     *              indicates the HTTP action that occurred.). This is the
1996     *              underlying object with id, value and extensions. The accessor
1997     *              "getMethod" gives direct access to the value
1998     */
1999    public BundleEntryRequestComponent setMethodElement(Enumeration<HTTPVerb> value) {
2000      this.method = value;
2001      return this;
2002    }
2003
2004    /**
2005     * @return In a transaction or batch, this is the HTTP action to be executed for
2006     *         this entry. In a history bundle, this indicates the HTTP action that
2007     *         occurred.
2008     */
2009    public HTTPVerb getMethod() {
2010      return this.method == null ? null : this.method.getValue();
2011    }
2012
2013    /**
2014     * @param value In a transaction or batch, this is the HTTP action to be
2015     *              executed for this entry. In a history bundle, this indicates the
2016     *              HTTP action that occurred.
2017     */
2018    public BundleEntryRequestComponent setMethod(HTTPVerb value) {
2019      if (this.method == null)
2020        this.method = new Enumeration<HTTPVerb>(new HTTPVerbEnumFactory());
2021      this.method.setValue(value);
2022      return this;
2023    }
2024
2025    /**
2026     * @return {@link #url} (The URL for this entry, relative to the root (the
2027     *         address to which the request is posted).). This is the underlying
2028     *         object with id, value and extensions. The accessor "getUrl" gives
2029     *         direct access to the value
2030     */
2031    public UriType getUrlElement() {
2032      if (this.url == null)
2033        if (Configuration.errorOnAutoCreate())
2034          throw new Error("Attempt to auto-create BundleEntryRequestComponent.url");
2035        else if (Configuration.doAutoCreate())
2036          this.url = new UriType(); // bb
2037      return this.url;
2038    }
2039
2040    public boolean hasUrlElement() {
2041      return this.url != null && !this.url.isEmpty();
2042    }
2043
2044    public boolean hasUrl() {
2045      return this.url != null && !this.url.isEmpty();
2046    }
2047
2048    /**
2049     * @param value {@link #url} (The URL for this entry, relative to the root (the
2050     *              address to which the request is posted).). This is the
2051     *              underlying object with id, value and extensions. The accessor
2052     *              "getUrl" gives direct access to the value
2053     */
2054    public BundleEntryRequestComponent setUrlElement(UriType value) {
2055      this.url = value;
2056      return this;
2057    }
2058
2059    /**
2060     * @return The URL for this entry, relative to the root (the address to which
2061     *         the request is posted).
2062     */
2063    public String getUrl() {
2064      return this.url == null ? null : this.url.getValue();
2065    }
2066
2067    /**
2068     * @param value The URL for this entry, relative to the root (the address to
2069     *              which the request is posted).
2070     */
2071    public BundleEntryRequestComponent setUrl(String value) {
2072      if (this.url == null)
2073        this.url = new UriType();
2074      this.url.setValue(value);
2075      return this;
2076    }
2077
2078    /**
2079     * @return {@link #ifNoneMatch} (If the ETag values match, return a 304 Not
2080     *         Modified status. See the API documentation for ["Conditional
2081     *         Read"](http.html#cread).). This is the underlying object with id,
2082     *         value and extensions. The accessor "getIfNoneMatch" gives direct
2083     *         access to the value
2084     */
2085    public StringType getIfNoneMatchElement() {
2086      if (this.ifNoneMatch == null)
2087        if (Configuration.errorOnAutoCreate())
2088          throw new Error("Attempt to auto-create BundleEntryRequestComponent.ifNoneMatch");
2089        else if (Configuration.doAutoCreate())
2090          this.ifNoneMatch = new StringType(); // bb
2091      return this.ifNoneMatch;
2092    }
2093
2094    public boolean hasIfNoneMatchElement() {
2095      return this.ifNoneMatch != null && !this.ifNoneMatch.isEmpty();
2096    }
2097
2098    public boolean hasIfNoneMatch() {
2099      return this.ifNoneMatch != null && !this.ifNoneMatch.isEmpty();
2100    }
2101
2102    /**
2103     * @param value {@link #ifNoneMatch} (If the ETag values match, return a 304 Not
2104     *              Modified status. See the API documentation for ["Conditional
2105     *              Read"](http.html#cread).). This is the underlying object with
2106     *              id, value and extensions. The accessor "getIfNoneMatch" gives
2107     *              direct access to the value
2108     */
2109    public BundleEntryRequestComponent setIfNoneMatchElement(StringType value) {
2110      this.ifNoneMatch = value;
2111      return this;
2112    }
2113
2114    /**
2115     * @return If the ETag values match, return a 304 Not Modified status. See the
2116     *         API documentation for ["Conditional Read"](http.html#cread).
2117     */
2118    public String getIfNoneMatch() {
2119      return this.ifNoneMatch == null ? null : this.ifNoneMatch.getValue();
2120    }
2121
2122    /**
2123     * @param value If the ETag values match, return a 304 Not Modified status. See
2124     *              the API documentation for ["Conditional Read"](http.html#cread).
2125     */
2126    public BundleEntryRequestComponent setIfNoneMatch(String value) {
2127      if (Utilities.noString(value))
2128        this.ifNoneMatch = null;
2129      else {
2130        if (this.ifNoneMatch == null)
2131          this.ifNoneMatch = new StringType();
2132        this.ifNoneMatch.setValue(value);
2133      }
2134      return this;
2135    }
2136
2137    /**
2138     * @return {@link #ifModifiedSince} (Only perform the operation if the last
2139     *         updated date matches. See the API documentation for ["Conditional
2140     *         Read"](http.html#cread).). This is the underlying object with id,
2141     *         value and extensions. The accessor "getIfModifiedSince" gives direct
2142     *         access to the value
2143     */
2144    public InstantType getIfModifiedSinceElement() {
2145      if (this.ifModifiedSince == null)
2146        if (Configuration.errorOnAutoCreate())
2147          throw new Error("Attempt to auto-create BundleEntryRequestComponent.ifModifiedSince");
2148        else if (Configuration.doAutoCreate())
2149          this.ifModifiedSince = new InstantType(); // bb
2150      return this.ifModifiedSince;
2151    }
2152
2153    public boolean hasIfModifiedSinceElement() {
2154      return this.ifModifiedSince != null && !this.ifModifiedSince.isEmpty();
2155    }
2156
2157    public boolean hasIfModifiedSince() {
2158      return this.ifModifiedSince != null && !this.ifModifiedSince.isEmpty();
2159    }
2160
2161    /**
2162     * @param value {@link #ifModifiedSince} (Only perform the operation if the last
2163     *              updated date matches. See the API documentation for
2164     *              ["Conditional Read"](http.html#cread).). This is the underlying
2165     *              object with id, value and extensions. The accessor
2166     *              "getIfModifiedSince" gives direct access to the value
2167     */
2168    public BundleEntryRequestComponent setIfModifiedSinceElement(InstantType value) {
2169      this.ifModifiedSince = value;
2170      return this;
2171    }
2172
2173    /**
2174     * @return Only perform the operation if the last updated date matches. See the
2175     *         API documentation for ["Conditional Read"](http.html#cread).
2176     */
2177    public Date getIfModifiedSince() {
2178      return this.ifModifiedSince == null ? null : this.ifModifiedSince.getValue();
2179    }
2180
2181    /**
2182     * @param value Only perform the operation if the last updated date matches. See
2183     *              the API documentation for ["Conditional Read"](http.html#cread).
2184     */
2185    public BundleEntryRequestComponent setIfModifiedSince(Date value) {
2186      if (value == null)
2187        this.ifModifiedSince = null;
2188      else {
2189        if (this.ifModifiedSince == null)
2190          this.ifModifiedSince = new InstantType();
2191        this.ifModifiedSince.setValue(value);
2192      }
2193      return this;
2194    }
2195
2196    /**
2197     * @return {@link #ifMatch} (Only perform the operation if the Etag value
2198     *         matches. For more information, see the API section ["Managing
2199     *         Resource Contention"](http.html#concurrency).). This is the
2200     *         underlying object with id, value and extensions. The accessor
2201     *         "getIfMatch" gives direct access to the value
2202     */
2203    public StringType getIfMatchElement() {
2204      if (this.ifMatch == null)
2205        if (Configuration.errorOnAutoCreate())
2206          throw new Error("Attempt to auto-create BundleEntryRequestComponent.ifMatch");
2207        else if (Configuration.doAutoCreate())
2208          this.ifMatch = new StringType(); // bb
2209      return this.ifMatch;
2210    }
2211
2212    public boolean hasIfMatchElement() {
2213      return this.ifMatch != null && !this.ifMatch.isEmpty();
2214    }
2215
2216    public boolean hasIfMatch() {
2217      return this.ifMatch != null && !this.ifMatch.isEmpty();
2218    }
2219
2220    /**
2221     * @param value {@link #ifMatch} (Only perform the operation if the Etag value
2222     *              matches. For more information, see the API section ["Managing
2223     *              Resource Contention"](http.html#concurrency).). This is the
2224     *              underlying object with id, value and extensions. The accessor
2225     *              "getIfMatch" gives direct access to the value
2226     */
2227    public BundleEntryRequestComponent setIfMatchElement(StringType value) {
2228      this.ifMatch = value;
2229      return this;
2230    }
2231
2232    /**
2233     * @return Only perform the operation if the Etag value matches. For more
2234     *         information, see the API section ["Managing Resource
2235     *         Contention"](http.html#concurrency).
2236     */
2237    public String getIfMatch() {
2238      return this.ifMatch == null ? null : this.ifMatch.getValue();
2239    }
2240
2241    /**
2242     * @param value Only perform the operation if the Etag value matches. For more
2243     *              information, see the API section ["Managing Resource
2244     *              Contention"](http.html#concurrency).
2245     */
2246    public BundleEntryRequestComponent setIfMatch(String value) {
2247      if (Utilities.noString(value))
2248        this.ifMatch = null;
2249      else {
2250        if (this.ifMatch == null)
2251          this.ifMatch = new StringType();
2252        this.ifMatch.setValue(value);
2253      }
2254      return this;
2255    }
2256
2257    /**
2258     * @return {@link #ifNoneExist} (Instruct the server not to perform the create
2259     *         if a specified resource already exists. For further information, see
2260     *         the API documentation for ["Conditional Create"](http.html#ccreate).
2261     *         This is just the query portion of the URL - what follows the "?" (not
2262     *         including the "?").). This is the underlying object with id, value
2263     *         and extensions. The accessor "getIfNoneExist" gives direct access to
2264     *         the value
2265     */
2266    public StringType getIfNoneExistElement() {
2267      if (this.ifNoneExist == null)
2268        if (Configuration.errorOnAutoCreate())
2269          throw new Error("Attempt to auto-create BundleEntryRequestComponent.ifNoneExist");
2270        else if (Configuration.doAutoCreate())
2271          this.ifNoneExist = new StringType(); // bb
2272      return this.ifNoneExist;
2273    }
2274
2275    public boolean hasIfNoneExistElement() {
2276      return this.ifNoneExist != null && !this.ifNoneExist.isEmpty();
2277    }
2278
2279    public boolean hasIfNoneExist() {
2280      return this.ifNoneExist != null && !this.ifNoneExist.isEmpty();
2281    }
2282
2283    /**
2284     * @param value {@link #ifNoneExist} (Instruct the server not to perform the
2285     *              create if a specified resource already exists. For further
2286     *              information, see the API documentation for ["Conditional
2287     *              Create"](http.html#ccreate). This is just the query portion of
2288     *              the URL - what follows the "?" (not including the "?").). This
2289     *              is the underlying object with id, value and extensions. The
2290     *              accessor "getIfNoneExist" gives direct access to the value
2291     */
2292    public BundleEntryRequestComponent setIfNoneExistElement(StringType value) {
2293      this.ifNoneExist = value;
2294      return this;
2295    }
2296
2297    /**
2298     * @return Instruct the server not to perform the create if a specified resource
2299     *         already exists. For further information, see the API documentation
2300     *         for ["Conditional Create"](http.html#ccreate). This is just the query
2301     *         portion of the URL - what follows the "?" (not including the "?").
2302     */
2303    public String getIfNoneExist() {
2304      return this.ifNoneExist == null ? null : this.ifNoneExist.getValue();
2305    }
2306
2307    /**
2308     * @param value Instruct the server not to perform the create if a specified
2309     *              resource already exists. For further information, see the API
2310     *              documentation for ["Conditional Create"](http.html#ccreate).
2311     *              This is just the query portion of the URL - what follows the "?"
2312     *              (not including the "?").
2313     */
2314    public BundleEntryRequestComponent setIfNoneExist(String value) {
2315      if (Utilities.noString(value))
2316        this.ifNoneExist = null;
2317      else {
2318        if (this.ifNoneExist == null)
2319          this.ifNoneExist = new StringType();
2320        this.ifNoneExist.setValue(value);
2321      }
2322      return this;
2323    }
2324
2325    protected void listChildren(List<Property> children) {
2326      super.listChildren(children);
2327      children.add(new Property("method", "code",
2328          "In a transaction or batch, this is the HTTP action to be executed for this entry. In a history bundle, this indicates the HTTP action that occurred.",
2329          0, 1, method));
2330      children.add(new Property("url", "uri",
2331          "The URL for this entry, relative to the root (the address to which the request is posted).", 0, 1, url));
2332      children.add(new Property("ifNoneMatch", "string",
2333          "If the ETag values match, return a 304 Not Modified status. See the API documentation for [\"Conditional Read\"](http.html#cread).",
2334          0, 1, ifNoneMatch));
2335      children.add(new Property("ifModifiedSince", "instant",
2336          "Only perform the operation if the last updated date matches. See the API documentation for [\"Conditional Read\"](http.html#cread).",
2337          0, 1, ifModifiedSince));
2338      children.add(new Property("ifMatch", "string",
2339          "Only perform the operation if the Etag value matches. For more information, see the API section [\"Managing Resource Contention\"](http.html#concurrency).",
2340          0, 1, ifMatch));
2341      children.add(new Property("ifNoneExist", "string",
2342          "Instruct the server not to perform the create if a specified resource already exists. For further information, see the API documentation for [\"Conditional Create\"](http.html#ccreate). This is just the query portion of the URL - what follows the \"?\" (not including the \"?\").",
2343          0, 1, ifNoneExist));
2344    }
2345
2346    @Override
2347    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2348      switch (_hash) {
2349      case -1077554975:
2350        /* method */ return new Property("method", "code",
2351            "In a transaction or batch, this is the HTTP action to be executed for this entry. In a history bundle, this indicates the HTTP action that occurred.",
2352            0, 1, method);
2353      case 116079:
2354        /* url */ return new Property("url", "uri",
2355            "The URL for this entry, relative to the root (the address to which the request is posted).", 0, 1, url);
2356      case 171868368:
2357        /* ifNoneMatch */ return new Property("ifNoneMatch", "string",
2358            "If the ETag values match, return a 304 Not Modified status. See the API documentation for [\"Conditional Read\"](http.html#cread).",
2359            0, 1, ifNoneMatch);
2360      case -2061602860:
2361        /* ifModifiedSince */ return new Property("ifModifiedSince", "instant",
2362            "Only perform the operation if the last updated date matches. See the API documentation for [\"Conditional Read\"](http.html#cread).",
2363            0, 1, ifModifiedSince);
2364      case 1692894888:
2365        /* ifMatch */ return new Property("ifMatch", "string",
2366            "Only perform the operation if the Etag value matches. For more information, see the API section [\"Managing Resource Contention\"](http.html#concurrency).",
2367            0, 1, ifMatch);
2368      case 165155330:
2369        /* ifNoneExist */ return new Property("ifNoneExist", "string",
2370            "Instruct the server not to perform the create if a specified resource already exists. For further information, see the API documentation for [\"Conditional Create\"](http.html#ccreate). This is just the query portion of the URL - what follows the \"?\" (not including the \"?\").",
2371            0, 1, ifNoneExist);
2372      default:
2373        return super.getNamedProperty(_hash, _name, _checkValid);
2374      }
2375
2376    }
2377
2378    @Override
2379    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2380      switch (hash) {
2381      case -1077554975:
2382        /* method */ return this.method == null ? new Base[0] : new Base[] { this.method }; // Enumeration<HTTPVerb>
2383      case 116079:
2384        /* url */ return this.url == null ? new Base[0] : new Base[] { this.url }; // UriType
2385      case 171868368:
2386        /* ifNoneMatch */ return this.ifNoneMatch == null ? new Base[0] : new Base[] { this.ifNoneMatch }; // StringType
2387      case -2061602860:
2388        /* ifModifiedSince */ return this.ifModifiedSince == null ? new Base[0] : new Base[] { this.ifModifiedSince }; // InstantType
2389      case 1692894888:
2390        /* ifMatch */ return this.ifMatch == null ? new Base[0] : new Base[] { this.ifMatch }; // StringType
2391      case 165155330:
2392        /* ifNoneExist */ return this.ifNoneExist == null ? new Base[0] : new Base[] { this.ifNoneExist }; // StringType
2393      default:
2394        return super.getProperty(hash, name, checkValid);
2395      }
2396
2397    }
2398
2399    @Override
2400    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2401      switch (hash) {
2402      case -1077554975: // method
2403        value = new HTTPVerbEnumFactory().fromType(castToCode(value));
2404        this.method = (Enumeration) value; // Enumeration<HTTPVerb>
2405        return value;
2406      case 116079: // url
2407        this.url = castToUri(value); // UriType
2408        return value;
2409      case 171868368: // ifNoneMatch
2410        this.ifNoneMatch = castToString(value); // StringType
2411        return value;
2412      case -2061602860: // ifModifiedSince
2413        this.ifModifiedSince = castToInstant(value); // InstantType
2414        return value;
2415      case 1692894888: // ifMatch
2416        this.ifMatch = castToString(value); // StringType
2417        return value;
2418      case 165155330: // ifNoneExist
2419        this.ifNoneExist = castToString(value); // StringType
2420        return value;
2421      default:
2422        return super.setProperty(hash, name, value);
2423      }
2424
2425    }
2426
2427    @Override
2428    public Base setProperty(String name, Base value) throws FHIRException {
2429      if (name.equals("method")) {
2430        value = new HTTPVerbEnumFactory().fromType(castToCode(value));
2431        this.method = (Enumeration) value; // Enumeration<HTTPVerb>
2432      } else if (name.equals("url")) {
2433        this.url = castToUri(value); // UriType
2434      } else if (name.equals("ifNoneMatch")) {
2435        this.ifNoneMatch = castToString(value); // StringType
2436      } else if (name.equals("ifModifiedSince")) {
2437        this.ifModifiedSince = castToInstant(value); // InstantType
2438      } else if (name.equals("ifMatch")) {
2439        this.ifMatch = castToString(value); // StringType
2440      } else if (name.equals("ifNoneExist")) {
2441        this.ifNoneExist = castToString(value); // StringType
2442      } else
2443        return super.setProperty(name, value);
2444      return value;
2445    }
2446
2447  @Override
2448  public void removeChild(String name, Base value) throws FHIRException {
2449      if (name.equals("method")) {
2450        this.method = null;
2451      } else if (name.equals("url")) {
2452        this.url = null;
2453      } else if (name.equals("ifNoneMatch")) {
2454        this.ifNoneMatch = null;
2455      } else if (name.equals("ifModifiedSince")) {
2456        this.ifModifiedSince = null;
2457      } else if (name.equals("ifMatch")) {
2458        this.ifMatch = null;
2459      } else if (name.equals("ifNoneExist")) {
2460        this.ifNoneExist = null;
2461      } else
2462        super.removeChild(name, value);
2463      
2464    }
2465
2466    @Override
2467    public Base makeProperty(int hash, String name) throws FHIRException {
2468      switch (hash) {
2469      case -1077554975:
2470        return getMethodElement();
2471      case 116079:
2472        return getUrlElement();
2473      case 171868368:
2474        return getIfNoneMatchElement();
2475      case -2061602860:
2476        return getIfModifiedSinceElement();
2477      case 1692894888:
2478        return getIfMatchElement();
2479      case 165155330:
2480        return getIfNoneExistElement();
2481      default:
2482        return super.makeProperty(hash, name);
2483      }
2484
2485    }
2486
2487    @Override
2488    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2489      switch (hash) {
2490      case -1077554975:
2491        /* method */ return new String[] { "code" };
2492      case 116079:
2493        /* url */ return new String[] { "uri" };
2494      case 171868368:
2495        /* ifNoneMatch */ return new String[] { "string" };
2496      case -2061602860:
2497        /* ifModifiedSince */ return new String[] { "instant" };
2498      case 1692894888:
2499        /* ifMatch */ return new String[] { "string" };
2500      case 165155330:
2501        /* ifNoneExist */ return new String[] { "string" };
2502      default:
2503        return super.getTypesForProperty(hash, name);
2504      }
2505
2506    }
2507
2508    @Override
2509    public Base addChild(String name) throws FHIRException {
2510      if (name.equals("method")) {
2511        throw new FHIRException("Cannot call addChild on a singleton property Bundle.method");
2512      } else if (name.equals("url")) {
2513        throw new FHIRException("Cannot call addChild on a singleton property Bundle.url");
2514      } else if (name.equals("ifNoneMatch")) {
2515        throw new FHIRException("Cannot call addChild on a singleton property Bundle.ifNoneMatch");
2516      } else if (name.equals("ifModifiedSince")) {
2517        throw new FHIRException("Cannot call addChild on a singleton property Bundle.ifModifiedSince");
2518      } else if (name.equals("ifMatch")) {
2519        throw new FHIRException("Cannot call addChild on a singleton property Bundle.ifMatch");
2520      } else if (name.equals("ifNoneExist")) {
2521        throw new FHIRException("Cannot call addChild on a singleton property Bundle.ifNoneExist");
2522      } else
2523        return super.addChild(name);
2524    }
2525
2526    public BundleEntryRequestComponent copy() {
2527      BundleEntryRequestComponent dst = new BundleEntryRequestComponent();
2528      copyValues(dst);
2529      return dst;
2530    }
2531
2532    public void copyValues(BundleEntryRequestComponent dst) {
2533      super.copyValues(dst);
2534      dst.method = method == null ? null : method.copy();
2535      dst.url = url == null ? null : url.copy();
2536      dst.ifNoneMatch = ifNoneMatch == null ? null : ifNoneMatch.copy();
2537      dst.ifModifiedSince = ifModifiedSince == null ? null : ifModifiedSince.copy();
2538      dst.ifMatch = ifMatch == null ? null : ifMatch.copy();
2539      dst.ifNoneExist = ifNoneExist == null ? null : ifNoneExist.copy();
2540    }
2541
2542    @Override
2543    public boolean equalsDeep(Base other_) {
2544      if (!super.equalsDeep(other_))
2545        return false;
2546      if (!(other_ instanceof BundleEntryRequestComponent))
2547        return false;
2548      BundleEntryRequestComponent o = (BundleEntryRequestComponent) other_;
2549      return compareDeep(method, o.method, true) && compareDeep(url, o.url, true)
2550          && compareDeep(ifNoneMatch, o.ifNoneMatch, true) && compareDeep(ifModifiedSince, o.ifModifiedSince, true)
2551          && compareDeep(ifMatch, o.ifMatch, true) && compareDeep(ifNoneExist, o.ifNoneExist, true);
2552    }
2553
2554    @Override
2555    public boolean equalsShallow(Base other_) {
2556      if (!super.equalsShallow(other_))
2557        return false;
2558      if (!(other_ instanceof BundleEntryRequestComponent))
2559        return false;
2560      BundleEntryRequestComponent o = (BundleEntryRequestComponent) other_;
2561      return compareValues(method, o.method, true) && compareValues(url, o.url, true)
2562          && compareValues(ifNoneMatch, o.ifNoneMatch, true) && compareValues(ifModifiedSince, o.ifModifiedSince, true)
2563          && compareValues(ifMatch, o.ifMatch, true) && compareValues(ifNoneExist, o.ifNoneExist, true);
2564    }
2565
2566    public boolean isEmpty() {
2567      return super.isEmpty()
2568          && ca.uhn.fhir.util.ElementUtil.isEmpty(method, url, ifNoneMatch, ifModifiedSince, ifMatch, ifNoneExist);
2569    }
2570
2571    public String fhirType() {
2572      return "Bundle.entry.request";
2573
2574    }
2575
2576  }
2577
2578  @Block()
2579  public static class BundleEntryResponseComponent extends BackboneElement implements IBaseBackboneElement {
2580    /**
2581     * The status code returned by processing this entry. The status SHALL start
2582     * with a 3 digit HTTP code (e.g. 404) and may contain the standard HTTP
2583     * description associated with the status code.
2584     */
2585    @Child(name = "status", type = { StringType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
2586    @Description(shortDefinition = "Status response code (text optional)", formalDefinition = "The status code returned by processing this entry. The status SHALL start with a 3 digit HTTP code (e.g. 404) and may contain the standard HTTP description associated with the status code.")
2587    protected StringType status;
2588
2589    /**
2590     * The location header created by processing this operation, populated if the
2591     * operation returns a location.
2592     */
2593    @Child(name = "location", type = { UriType.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
2594    @Description(shortDefinition = "The location (if the operation returns a location)", formalDefinition = "The location header created by processing this operation, populated if the operation returns a location.")
2595    protected UriType location;
2596
2597    /**
2598     * The Etag for the resource, if the operation for the entry produced a
2599     * versioned resource (see [Resource Metadata and
2600     * Versioning](http.html#versioning) and [Managing Resource
2601     * Contention](http.html#concurrency)).
2602     */
2603    @Child(name = "etag", type = { StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
2604    @Description(shortDefinition = "The Etag for the resource (if relevant)", formalDefinition = "The Etag for the resource, if the operation for the entry produced a versioned resource (see [Resource Metadata and Versioning](http.html#versioning) and [Managing Resource Contention](http.html#concurrency)).")
2605    protected StringType etag;
2606
2607    /**
2608     * The date/time that the resource was modified on the server.
2609     */
2610    @Child(name = "lastModified", type = {
2611        InstantType.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
2612    @Description(shortDefinition = "Server's date time modified", formalDefinition = "The date/time that the resource was modified on the server.")
2613    protected InstantType lastModified;
2614
2615    /**
2616     * An OperationOutcome containing hints and warnings produced as part of
2617     * processing this entry in a batch or transaction.
2618     */
2619    @Child(name = "outcome", type = { Resource.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
2620    @Description(shortDefinition = "OperationOutcome with hints and warnings (for batch/transaction)", formalDefinition = "An OperationOutcome containing hints and warnings produced as part of processing this entry in a batch or transaction.")
2621    protected Resource outcome;
2622
2623    private static final long serialVersionUID = 923278008L;
2624
2625    /**
2626     * Constructor
2627     */
2628    public BundleEntryResponseComponent() {
2629      super();
2630    }
2631
2632    /**
2633     * Constructor
2634     */
2635    public BundleEntryResponseComponent(StringType status) {
2636      super();
2637      this.status = status;
2638    }
2639
2640    /**
2641     * @return {@link #status} (The status code returned by processing this entry.
2642     *         The status SHALL start with a 3 digit HTTP code (e.g. 404) and may
2643     *         contain the standard HTTP description associated with the status
2644     *         code.). This is the underlying object with id, value and extensions.
2645     *         The accessor "getStatus" gives direct access to the value
2646     */
2647    public StringType getStatusElement() {
2648      if (this.status == null)
2649        if (Configuration.errorOnAutoCreate())
2650          throw new Error("Attempt to auto-create BundleEntryResponseComponent.status");
2651        else if (Configuration.doAutoCreate())
2652          this.status = new StringType(); // bb
2653      return this.status;
2654    }
2655
2656    public boolean hasStatusElement() {
2657      return this.status != null && !this.status.isEmpty();
2658    }
2659
2660    public boolean hasStatus() {
2661      return this.status != null && !this.status.isEmpty();
2662    }
2663
2664    /**
2665     * @param value {@link #status} (The status code returned by processing this
2666     *              entry. The status SHALL start with a 3 digit HTTP code (e.g.
2667     *              404) and may contain the standard HTTP description associated
2668     *              with the status code.). This is the underlying object with id,
2669     *              value and extensions. The accessor "getStatus" gives direct
2670     *              access to the value
2671     */
2672    public BundleEntryResponseComponent setStatusElement(StringType value) {
2673      this.status = value;
2674      return this;
2675    }
2676
2677    /**
2678     * @return The status code returned by processing this entry. The status SHALL
2679     *         start with a 3 digit HTTP code (e.g. 404) and may contain the
2680     *         standard HTTP description associated with the status code.
2681     */
2682    public String getStatus() {
2683      return this.status == null ? null : this.status.getValue();
2684    }
2685
2686    /**
2687     * @param value The status code returned by processing this entry. The status
2688     *              SHALL start with a 3 digit HTTP code (e.g. 404) and may contain
2689     *              the standard HTTP description associated with the status code.
2690     */
2691    public BundleEntryResponseComponent setStatus(String value) {
2692      if (this.status == null)
2693        this.status = new StringType();
2694      this.status.setValue(value);
2695      return this;
2696    }
2697
2698    /**
2699     * @return {@link #location} (The location header created by processing this
2700     *         operation, populated if the operation returns a location.). This is
2701     *         the underlying object with id, value and extensions. The accessor
2702     *         "getLocation" gives direct access to the value
2703     */
2704    public UriType getLocationElement() {
2705      if (this.location == null)
2706        if (Configuration.errorOnAutoCreate())
2707          throw new Error("Attempt to auto-create BundleEntryResponseComponent.location");
2708        else if (Configuration.doAutoCreate())
2709          this.location = new UriType(); // bb
2710      return this.location;
2711    }
2712
2713    public boolean hasLocationElement() {
2714      return this.location != null && !this.location.isEmpty();
2715    }
2716
2717    public boolean hasLocation() {
2718      return this.location != null && !this.location.isEmpty();
2719    }
2720
2721    /**
2722     * @param value {@link #location} (The location header created by processing
2723     *              this operation, populated if the operation returns a location.).
2724     *              This is the underlying object with id, value and extensions. The
2725     *              accessor "getLocation" gives direct access to the value
2726     */
2727    public BundleEntryResponseComponent setLocationElement(UriType value) {
2728      this.location = value;
2729      return this;
2730    }
2731
2732    /**
2733     * @return The location header created by processing this operation, populated
2734     *         if the operation returns a location.
2735     */
2736    public String getLocation() {
2737      return this.location == null ? null : this.location.getValue();
2738    }
2739
2740    /**
2741     * @param value The location header created by processing this operation,
2742     *              populated if the operation returns a location.
2743     */
2744    public BundleEntryResponseComponent setLocation(String value) {
2745      if (Utilities.noString(value))
2746        this.location = null;
2747      else {
2748        if (this.location == null)
2749          this.location = new UriType();
2750        this.location.setValue(value);
2751      }
2752      return this;
2753    }
2754
2755    /**
2756     * @return {@link #etag} (The Etag for the resource, if the operation for the
2757     *         entry produced a versioned resource (see [Resource Metadata and
2758     *         Versioning](http.html#versioning) and [Managing Resource
2759     *         Contention](http.html#concurrency)).). This is the underlying object
2760     *         with id, value and extensions. The accessor "getEtag" gives direct
2761     *         access to the value
2762     */
2763    public StringType getEtagElement() {
2764      if (this.etag == null)
2765        if (Configuration.errorOnAutoCreate())
2766          throw new Error("Attempt to auto-create BundleEntryResponseComponent.etag");
2767        else if (Configuration.doAutoCreate())
2768          this.etag = new StringType(); // bb
2769      return this.etag;
2770    }
2771
2772    public boolean hasEtagElement() {
2773      return this.etag != null && !this.etag.isEmpty();
2774    }
2775
2776    public boolean hasEtag() {
2777      return this.etag != null && !this.etag.isEmpty();
2778    }
2779
2780    /**
2781     * @param value {@link #etag} (The Etag for the resource, if the operation for
2782     *              the entry produced a versioned resource (see [Resource Metadata
2783     *              and Versioning](http.html#versioning) and [Managing Resource
2784     *              Contention](http.html#concurrency)).). This is the underlying
2785     *              object with id, value and extensions. The accessor "getEtag"
2786     *              gives direct access to the value
2787     */
2788    public BundleEntryResponseComponent setEtagElement(StringType value) {
2789      this.etag = value;
2790      return this;
2791    }
2792
2793    /**
2794     * @return The Etag for the resource, if the operation for the entry produced a
2795     *         versioned resource (see [Resource Metadata and
2796     *         Versioning](http.html#versioning) and [Managing Resource
2797     *         Contention](http.html#concurrency)).
2798     */
2799    public String getEtag() {
2800      return this.etag == null ? null : this.etag.getValue();
2801    }
2802
2803    /**
2804     * @param value The Etag for the resource, if the operation for the entry
2805     *              produced a versioned resource (see [Resource Metadata and
2806     *              Versioning](http.html#versioning) and [Managing Resource
2807     *              Contention](http.html#concurrency)).
2808     */
2809    public BundleEntryResponseComponent setEtag(String value) {
2810      if (Utilities.noString(value))
2811        this.etag = null;
2812      else {
2813        if (this.etag == null)
2814          this.etag = new StringType();
2815        this.etag.setValue(value);
2816      }
2817      return this;
2818    }
2819
2820    /**
2821     * @return {@link #lastModified} (The date/time that the resource was modified
2822     *         on the server.). This is the underlying object with id, value and
2823     *         extensions. The accessor "getLastModified" gives direct access to the
2824     *         value
2825     */
2826    public InstantType getLastModifiedElement() {
2827      if (this.lastModified == null)
2828        if (Configuration.errorOnAutoCreate())
2829          throw new Error("Attempt to auto-create BundleEntryResponseComponent.lastModified");
2830        else if (Configuration.doAutoCreate())
2831          this.lastModified = new InstantType(); // bb
2832      return this.lastModified;
2833    }
2834
2835    public boolean hasLastModifiedElement() {
2836      return this.lastModified != null && !this.lastModified.isEmpty();
2837    }
2838
2839    public boolean hasLastModified() {
2840      return this.lastModified != null && !this.lastModified.isEmpty();
2841    }
2842
2843    /**
2844     * @param value {@link #lastModified} (The date/time that the resource was
2845     *              modified on the server.). This is the underlying object with id,
2846     *              value and extensions. The accessor "getLastModified" gives
2847     *              direct access to the value
2848     */
2849    public BundleEntryResponseComponent setLastModifiedElement(InstantType value) {
2850      this.lastModified = value;
2851      return this;
2852    }
2853
2854    /**
2855     * @return The date/time that the resource was modified on the server.
2856     */
2857    public Date getLastModified() {
2858      return this.lastModified == null ? null : this.lastModified.getValue();
2859    }
2860
2861    /**
2862     * @param value The date/time that the resource was modified on the server.
2863     */
2864    public BundleEntryResponseComponent setLastModified(Date value) {
2865      if (value == null)
2866        this.lastModified = null;
2867      else {
2868        if (this.lastModified == null)
2869          this.lastModified = new InstantType();
2870        this.lastModified.setValue(value);
2871      }
2872      return this;
2873    }
2874
2875    /**
2876     * @return {@link #outcome} (An OperationOutcome containing hints and warnings
2877     *         produced as part of processing this entry in a batch or transaction.)
2878     */
2879    public Resource getOutcome() {
2880      return this.outcome;
2881    }
2882
2883    public boolean hasOutcome() {
2884      return this.outcome != null && !this.outcome.isEmpty();
2885    }
2886
2887    /**
2888     * @param value {@link #outcome} (An OperationOutcome containing hints and
2889     *              warnings produced as part of processing this entry in a batch or
2890     *              transaction.)
2891     */
2892    public BundleEntryResponseComponent setOutcome(Resource value) {
2893      this.outcome = value;
2894      return this;
2895    }
2896
2897    protected void listChildren(List<Property> children) {
2898      super.listChildren(children);
2899      children.add(new Property("status", "string",
2900          "The status code returned by processing this entry. The status SHALL start with a 3 digit HTTP code (e.g. 404) and may contain the standard HTTP description associated with the status code.",
2901          0, 1, status));
2902      children.add(new Property("location", "uri",
2903          "The location header created by processing this operation, populated if the operation returns a location.", 0,
2904          1, location));
2905      children.add(new Property("etag", "string",
2906          "The Etag for the resource, if the operation for the entry produced a versioned resource (see [Resource Metadata and Versioning](http.html#versioning) and [Managing Resource Contention](http.html#concurrency)).",
2907          0, 1, etag));
2908      children.add(new Property("lastModified", "instant",
2909          "The date/time that the resource was modified on the server.", 0, 1, lastModified));
2910      children.add(new Property("outcome", "Resource",
2911          "An OperationOutcome containing hints and warnings produced as part of processing this entry in a batch or transaction.",
2912          0, 1, outcome));
2913    }
2914
2915    @Override
2916    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2917      switch (_hash) {
2918      case -892481550:
2919        /* status */ return new Property("status", "string",
2920            "The status code returned by processing this entry. The status SHALL start with a 3 digit HTTP code (e.g. 404) and may contain the standard HTTP description associated with the status code.",
2921            0, 1, status);
2922      case 1901043637:
2923        /* location */ return new Property("location", "uri",
2924            "The location header created by processing this operation, populated if the operation returns a location.",
2925            0, 1, location);
2926      case 3123477:
2927        /* etag */ return new Property("etag", "string",
2928            "The Etag for the resource, if the operation for the entry produced a versioned resource (see [Resource Metadata and Versioning](http.html#versioning) and [Managing Resource Contention](http.html#concurrency)).",
2929            0, 1, etag);
2930      case 1959003007:
2931        /* lastModified */ return new Property("lastModified", "instant",
2932            "The date/time that the resource was modified on the server.", 0, 1, lastModified);
2933      case -1106507950:
2934        /* outcome */ return new Property("outcome", "Resource",
2935            "An OperationOutcome containing hints and warnings produced as part of processing this entry in a batch or transaction.",
2936            0, 1, outcome);
2937      default:
2938        return super.getNamedProperty(_hash, _name, _checkValid);
2939      }
2940
2941    }
2942
2943    @Override
2944    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2945      switch (hash) {
2946      case -892481550:
2947        /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // StringType
2948      case 1901043637:
2949        /* location */ return this.location == null ? new Base[0] : new Base[] { this.location }; // UriType
2950      case 3123477:
2951        /* etag */ return this.etag == null ? new Base[0] : new Base[] { this.etag }; // StringType
2952      case 1959003007:
2953        /* lastModified */ return this.lastModified == null ? new Base[0] : new Base[] { this.lastModified }; // InstantType
2954      case -1106507950:
2955        /* outcome */ return this.outcome == null ? new Base[0] : new Base[] { this.outcome }; // Resource
2956      default:
2957        return super.getProperty(hash, name, checkValid);
2958      }
2959
2960    }
2961
2962    @Override
2963    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2964      switch (hash) {
2965      case -892481550: // status
2966        this.status = castToString(value); // StringType
2967        return value;
2968      case 1901043637: // location
2969        this.location = castToUri(value); // UriType
2970        return value;
2971      case 3123477: // etag
2972        this.etag = castToString(value); // StringType
2973        return value;
2974      case 1959003007: // lastModified
2975        this.lastModified = castToInstant(value); // InstantType
2976        return value;
2977      case -1106507950: // outcome
2978        this.outcome = castToResource(value); // Resource
2979        return value;
2980      default:
2981        return super.setProperty(hash, name, value);
2982      }
2983
2984    }
2985
2986    @Override
2987    public Base setProperty(String name, Base value) throws FHIRException {
2988      if (name.equals("status")) {
2989        this.status = castToString(value); // StringType
2990      } else if (name.equals("location")) {
2991        this.location = castToUri(value); // UriType
2992      } else if (name.equals("etag")) {
2993        this.etag = castToString(value); // StringType
2994      } else if (name.equals("lastModified")) {
2995        this.lastModified = castToInstant(value); // InstantType
2996      } else if (name.equals("outcome")) {
2997        this.outcome = castToResource(value); // Resource
2998      } else
2999        return super.setProperty(name, value);
3000      return value;
3001    }
3002
3003  @Override
3004  public void removeChild(String name, Base value) throws FHIRException {
3005      if (name.equals("status")) {
3006        this.status = null;
3007      } else if (name.equals("location")) {
3008        this.location = null;
3009      } else if (name.equals("etag")) {
3010        this.etag = null;
3011      } else if (name.equals("lastModified")) {
3012        this.lastModified = null;
3013      } else if (name.equals("outcome")) {
3014        this.outcome = null;
3015      } else
3016        super.removeChild(name, value);
3017      
3018    }
3019
3020    @Override
3021    public Base makeProperty(int hash, String name) throws FHIRException {
3022      switch (hash) {
3023      case -892481550:
3024        return getStatusElement();
3025      case 1901043637:
3026        return getLocationElement();
3027      case 3123477:
3028        return getEtagElement();
3029      case 1959003007:
3030        return getLastModifiedElement();
3031      case -1106507950:
3032        throw new FHIRException("Cannot make property outcome as it is not a complex type"); // Resource
3033      default:
3034        return super.makeProperty(hash, name);
3035      }
3036
3037    }
3038
3039    @Override
3040    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3041      switch (hash) {
3042      case -892481550:
3043        /* status */ return new String[] { "string" };
3044      case 1901043637:
3045        /* location */ return new String[] { "uri" };
3046      case 3123477:
3047        /* etag */ return new String[] { "string" };
3048      case 1959003007:
3049        /* lastModified */ return new String[] { "instant" };
3050      case -1106507950:
3051        /* outcome */ return new String[] { "Resource" };
3052      default:
3053        return super.getTypesForProperty(hash, name);
3054      }
3055
3056    }
3057
3058    @Override
3059    public Base addChild(String name) throws FHIRException {
3060      if (name.equals("status")) {
3061        throw new FHIRException("Cannot call addChild on a singleton property Bundle.status");
3062      } else if (name.equals("location")) {
3063        throw new FHIRException("Cannot call addChild on a singleton property Bundle.location");
3064      } else if (name.equals("etag")) {
3065        throw new FHIRException("Cannot call addChild on a singleton property Bundle.etag");
3066      } else if (name.equals("lastModified")) {
3067        throw new FHIRException("Cannot call addChild on a singleton property Bundle.lastModified");
3068      } else if (name.equals("outcome")) {
3069        throw new FHIRException("Cannot call addChild on an abstract type Bundle.outcome");
3070      } else
3071        return super.addChild(name);
3072    }
3073
3074    public BundleEntryResponseComponent copy() {
3075      BundleEntryResponseComponent dst = new BundleEntryResponseComponent();
3076      copyValues(dst);
3077      return dst;
3078    }
3079
3080    public void copyValues(BundleEntryResponseComponent dst) {
3081      super.copyValues(dst);
3082      dst.status = status == null ? null : status.copy();
3083      dst.location = location == null ? null : location.copy();
3084      dst.etag = etag == null ? null : etag.copy();
3085      dst.lastModified = lastModified == null ? null : lastModified.copy();
3086      dst.outcome = outcome == null ? null : outcome.copy();
3087    }
3088
3089    @Override
3090    public boolean equalsDeep(Base other_) {
3091      if (!super.equalsDeep(other_))
3092        return false;
3093      if (!(other_ instanceof BundleEntryResponseComponent))
3094        return false;
3095      BundleEntryResponseComponent o = (BundleEntryResponseComponent) other_;
3096      return compareDeep(status, o.status, true) && compareDeep(location, o.location, true)
3097          && compareDeep(etag, o.etag, true) && compareDeep(lastModified, o.lastModified, true)
3098          && compareDeep(outcome, o.outcome, true);
3099    }
3100
3101    @Override
3102    public boolean equalsShallow(Base other_) {
3103      if (!super.equalsShallow(other_))
3104        return false;
3105      if (!(other_ instanceof BundleEntryResponseComponent))
3106        return false;
3107      BundleEntryResponseComponent o = (BundleEntryResponseComponent) other_;
3108      return compareValues(status, o.status, true) && compareValues(location, o.location, true)
3109          && compareValues(etag, o.etag, true) && compareValues(lastModified, o.lastModified, true);
3110    }
3111
3112    public boolean isEmpty() {
3113      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(status, location, etag, lastModified, outcome);
3114    }
3115
3116    public String fhirType() {
3117      return "Bundle.entry.response";
3118
3119    }
3120
3121  }
3122
3123  /**
3124   * A persistent identifier for the bundle that won't change as a bundle is
3125   * copied from server to server.
3126   */
3127  @Child(name = "identifier", type = {
3128      Identifier.class }, order = 0, min = 0, max = 1, modifier = false, summary = true)
3129  @Description(shortDefinition = "Persistent identifier for the bundle", formalDefinition = "A persistent identifier for the bundle that won't change as a bundle is copied from server to server.")
3130  protected Identifier identifier;
3131
3132  /**
3133   * Indicates the purpose of this bundle - how it is intended to be used.
3134   */
3135  @Child(name = "type", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
3136  @Description(shortDefinition = "document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection", formalDefinition = "Indicates the purpose of this bundle - how it is intended to be used.")
3137  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/bundle-type")
3138  protected Enumeration<BundleType> type;
3139
3140  /**
3141   * The date/time that the bundle was assembled - i.e. when the resources were
3142   * placed in the bundle.
3143   */
3144  @Child(name = "timestamp", type = {
3145      InstantType.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
3146  @Description(shortDefinition = "When the bundle was assembled", formalDefinition = "The date/time that the bundle was assembled - i.e. when the resources were placed in the bundle.")
3147  protected InstantType timestamp;
3148
3149  /**
3150   * If a set of search matches, this is the total number of entries of type
3151   * 'match' across all pages in the search. It does not include search.mode =
3152   * 'include' or 'outcome' entries and it does not provide a count of the number
3153   * of entries in the Bundle.
3154   */
3155  @Child(name = "total", type = {
3156      UnsignedIntType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
3157  @Description(shortDefinition = "If search, the total number of matches", formalDefinition = "If a set of search matches, this is the total number of entries of type 'match' across all pages in the search.  It does not include search.mode = 'include' or 'outcome' entries and it does not provide a count of the number of entries in the Bundle.")
3158  protected UnsignedIntType total;
3159
3160  /**
3161   * A series of links that provide context to this bundle.
3162   */
3163  @Child(name = "link", type = {}, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
3164  @Description(shortDefinition = "Links related to this Bundle", formalDefinition = "A series of links that provide context to this bundle.")
3165  protected List<BundleLinkComponent> link;
3166
3167  /**
3168   * An entry in a bundle resource - will either contain a resource or information
3169   * about a resource (transactions and history only).
3170   */
3171  @Child(name = "entry", type = {}, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
3172  @Description(shortDefinition = "Entry in the bundle - will have a resource or information", formalDefinition = "An entry in a bundle resource - will either contain a resource or information about a resource (transactions and history only).")
3173  protected List<BundleEntryComponent> entry;
3174
3175  /**
3176   * Digital Signature - base64 encoded. XML-DSig or a JWT.
3177   */
3178  @Child(name = "signature", type = { Signature.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
3179  @Description(shortDefinition = "Digital Signature", formalDefinition = "Digital Signature - base64 encoded. XML-DSig or a JWT.")
3180  protected Signature signature;
3181
3182  private static final long serialVersionUID = 1740470158L;
3183
3184  /**
3185   * Constructor
3186   */
3187  public Bundle() {
3188    super();
3189  }
3190
3191  /**
3192   * Constructor
3193   */
3194  public Bundle(Enumeration<BundleType> type) {
3195    super();
3196    this.type = type;
3197  }
3198
3199  /**
3200   * @return {@link #identifier} (A persistent identifier for the bundle that
3201   *         won't change as a bundle is copied from server to server.)
3202   */
3203  public Identifier getIdentifier() {
3204    if (this.identifier == null)
3205      if (Configuration.errorOnAutoCreate())
3206        throw new Error("Attempt to auto-create Bundle.identifier");
3207      else if (Configuration.doAutoCreate())
3208        this.identifier = new Identifier(); // cc
3209    return this.identifier;
3210  }
3211
3212  public boolean hasIdentifier() {
3213    return this.identifier != null && !this.identifier.isEmpty();
3214  }
3215
3216  /**
3217   * @param value {@link #identifier} (A persistent identifier for the bundle that
3218   *              won't change as a bundle is copied from server to server.)
3219   */
3220  public Bundle setIdentifier(Identifier value) {
3221    this.identifier = value;
3222    return this;
3223  }
3224
3225  /**
3226   * @return {@link #type} (Indicates the purpose of this bundle - how it is
3227   *         intended to be used.). This is the underlying object with id, value
3228   *         and extensions. The accessor "getType" gives direct access to the
3229   *         value
3230   */
3231  public Enumeration<BundleType> getTypeElement() {
3232    if (this.type == null)
3233      if (Configuration.errorOnAutoCreate())
3234        throw new Error("Attempt to auto-create Bundle.type");
3235      else if (Configuration.doAutoCreate())
3236        this.type = new Enumeration<BundleType>(new BundleTypeEnumFactory()); // bb
3237    return this.type;
3238  }
3239
3240  public boolean hasTypeElement() {
3241    return this.type != null && !this.type.isEmpty();
3242  }
3243
3244  public boolean hasType() {
3245    return this.type != null && !this.type.isEmpty();
3246  }
3247
3248  /**
3249   * @param value {@link #type} (Indicates the purpose of this bundle - how it is
3250   *              intended to be used.). This is the underlying object with id,
3251   *              value and extensions. The accessor "getType" gives direct access
3252   *              to the value
3253   */
3254  public Bundle setTypeElement(Enumeration<BundleType> value) {
3255    this.type = value;
3256    return this;
3257  }
3258
3259  /**
3260   * @return Indicates the purpose of this bundle - how it is intended to be used.
3261   */
3262  public BundleType getType() {
3263    return this.type == null ? null : this.type.getValue();
3264  }
3265
3266  /**
3267   * @param value Indicates the purpose of this bundle - how it is intended to be
3268   *              used.
3269   */
3270  public Bundle setType(BundleType value) {
3271    if (this.type == null)
3272      this.type = new Enumeration<BundleType>(new BundleTypeEnumFactory());
3273    this.type.setValue(value);
3274    return this;
3275  }
3276
3277  /**
3278   * @return {@link #timestamp} (The date/time that the bundle was assembled -
3279   *         i.e. when the resources were placed in the bundle.). This is the
3280   *         underlying object with id, value and extensions. The accessor
3281   *         "getTimestamp" gives direct access to the value
3282   */
3283  public InstantType getTimestampElement() {
3284    if (this.timestamp == null)
3285      if (Configuration.errorOnAutoCreate())
3286        throw new Error("Attempt to auto-create Bundle.timestamp");
3287      else if (Configuration.doAutoCreate())
3288        this.timestamp = new InstantType(); // bb
3289    return this.timestamp;
3290  }
3291
3292  public boolean hasTimestampElement() {
3293    return this.timestamp != null && !this.timestamp.isEmpty();
3294  }
3295
3296  public boolean hasTimestamp() {
3297    return this.timestamp != null && !this.timestamp.isEmpty();
3298  }
3299
3300  /**
3301   * @param value {@link #timestamp} (The date/time that the bundle was assembled
3302   *              - i.e. when the resources were placed in the bundle.). This is
3303   *              the underlying object with id, value and extensions. The
3304   *              accessor "getTimestamp" gives direct access to the value
3305   */
3306  public Bundle setTimestampElement(InstantType value) {
3307    this.timestamp = value;
3308    return this;
3309  }
3310
3311  /**
3312   * @return The date/time that the bundle was assembled - i.e. when the resources
3313   *         were placed in the bundle.
3314   */
3315  public Date getTimestamp() {
3316    return this.timestamp == null ? null : this.timestamp.getValue();
3317  }
3318
3319  /**
3320   * @param value The date/time that the bundle was assembled - i.e. when the
3321   *              resources were placed in the bundle.
3322   */
3323  public Bundle setTimestamp(Date value) {
3324    if (value == null)
3325      this.timestamp = null;
3326    else {
3327      if (this.timestamp == null)
3328        this.timestamp = new InstantType();
3329      this.timestamp.setValue(value);
3330    }
3331    return this;
3332  }
3333
3334  /**
3335   * @return {@link #total} (If a set of search matches, this is the total number
3336   *         of entries of type 'match' across all pages in the search. It does
3337   *         not include search.mode = 'include' or 'outcome' entries and it does
3338   *         not provide a count of the number of entries in the Bundle.). This is
3339   *         the underlying object with id, value and extensions. The accessor
3340   *         "getTotal" gives direct access to the value
3341   */
3342  public UnsignedIntType getTotalElement() {
3343    if (this.total == null)
3344      if (Configuration.errorOnAutoCreate())
3345        throw new Error("Attempt to auto-create Bundle.total");
3346      else if (Configuration.doAutoCreate())
3347        this.total = new UnsignedIntType(); // bb
3348    return this.total;
3349  }
3350
3351  public boolean hasTotalElement() {
3352    return this.total != null && !this.total.isEmpty();
3353  }
3354
3355  public boolean hasTotal() {
3356    return this.total != null && !this.total.isEmpty();
3357  }
3358
3359  /**
3360   * @param value {@link #total} (If a set of search matches, this is the total
3361   *              number of entries of type 'match' across all pages in the
3362   *              search. It does not include search.mode = 'include' or 'outcome'
3363   *              entries and it does not provide a count of the number of entries
3364   *              in the Bundle.). This is the underlying object with id, value
3365   *              and extensions. The accessor "getTotal" gives direct access to
3366   *              the value
3367   */
3368  public Bundle setTotalElement(UnsignedIntType value) {
3369    this.total = value;
3370    return this;
3371  }
3372
3373  /**
3374   * @return If a set of search matches, this is the total number of entries of
3375   *         type 'match' across all pages in the search. It does not include
3376   *         search.mode = 'include' or 'outcome' entries and it does not provide
3377   *         a count of the number of entries in the Bundle.
3378   */
3379  public int getTotal() {
3380    return this.total == null || this.total.isEmpty() ? 0 : this.total.getValue();
3381  }
3382
3383  /**
3384   * @param value If a set of search matches, this is the total number of entries
3385   *              of type 'match' across all pages in the search. It does not
3386   *              include search.mode = 'include' or 'outcome' entries and it does
3387   *              not provide a count of the number of entries in the Bundle.
3388   */
3389  public Bundle setTotal(int value) {
3390    if (this.total == null)
3391      this.total = new UnsignedIntType();
3392    this.total.setValue(value);
3393    return this;
3394  }
3395
3396  /**
3397   * @return {@link #link} (A series of links that provide context to this
3398   *         bundle.)
3399   */
3400  public List<BundleLinkComponent> getLink() {
3401    if (this.link == null)
3402      this.link = new ArrayList<BundleLinkComponent>();
3403    return this.link;
3404  }
3405
3406  /**
3407   * @return Returns a reference to <code>this</code> for easy method chaining
3408   */
3409  public Bundle setLink(List<BundleLinkComponent> theLink) {
3410    this.link = theLink;
3411    return this;
3412  }
3413
3414  public boolean hasLink() {
3415    if (this.link == null)
3416      return false;
3417    for (BundleLinkComponent item : this.link)
3418      if (!item.isEmpty())
3419        return true;
3420    return false;
3421  }
3422
3423  public BundleLinkComponent addLink() { // 3
3424    BundleLinkComponent t = new BundleLinkComponent();
3425    if (this.link == null)
3426      this.link = new ArrayList<BundleLinkComponent>();
3427    this.link.add(t);
3428    return t;
3429  }
3430
3431  public Bundle addLink(BundleLinkComponent t) { // 3
3432    if (t == null)
3433      return this;
3434    if (this.link == null)
3435      this.link = new ArrayList<BundleLinkComponent>();
3436    this.link.add(t);
3437    return this;
3438  }
3439
3440  /**
3441   * @return The first repetition of repeating field {@link #link}, creating it if
3442   *         it does not already exist
3443   */
3444  public BundleLinkComponent getLinkFirstRep() {
3445    if (getLink().isEmpty()) {
3446      addLink();
3447    }
3448    return getLink().get(0);
3449  }
3450
3451  /**
3452   * @return {@link #entry} (An entry in a bundle resource - will either contain a
3453   *         resource or information about a resource (transactions and history
3454   *         only).)
3455   */
3456  public List<BundleEntryComponent> getEntry() {
3457    if (this.entry == null)
3458      this.entry = new ArrayList<BundleEntryComponent>();
3459    return this.entry;
3460  }
3461
3462  /**
3463   * @return Returns a reference to <code>this</code> for easy method chaining
3464   */
3465  public Bundle setEntry(List<BundleEntryComponent> theEntry) {
3466    this.entry = theEntry;
3467    return this;
3468  }
3469
3470  public boolean hasEntry() {
3471    if (this.entry == null)
3472      return false;
3473    for (BundleEntryComponent item : this.entry)
3474      if (!item.isEmpty())
3475        return true;
3476    return false;
3477  }
3478
3479  public BundleEntryComponent addEntry() { // 3
3480    BundleEntryComponent t = new BundleEntryComponent();
3481    if (this.entry == null)
3482      this.entry = new ArrayList<BundleEntryComponent>();
3483    this.entry.add(t);
3484    return t;
3485  }
3486
3487  public Bundle addEntry(BundleEntryComponent t) { // 3
3488    if (t == null)
3489      return this;
3490    if (this.entry == null)
3491      this.entry = new ArrayList<BundleEntryComponent>();
3492    this.entry.add(t);
3493    return this;
3494  }
3495
3496  /**
3497   * @return The first repetition of repeating field {@link #entry}, creating it
3498   *         if it does not already exist
3499   */
3500  public BundleEntryComponent getEntryFirstRep() {
3501    if (getEntry().isEmpty()) {
3502      addEntry();
3503    }
3504    return getEntry().get(0);
3505  }
3506
3507  /**
3508   * @return {@link #signature} (Digital Signature - base64 encoded. XML-DSig or a
3509   *         JWT.)
3510   */
3511  public Signature getSignature() {
3512    if (this.signature == null)
3513      if (Configuration.errorOnAutoCreate())
3514        throw new Error("Attempt to auto-create Bundle.signature");
3515      else if (Configuration.doAutoCreate())
3516        this.signature = new Signature(); // cc
3517    return this.signature;
3518  }
3519
3520  public boolean hasSignature() {
3521    return this.signature != null && !this.signature.isEmpty();
3522  }
3523
3524  /**
3525   * @param value {@link #signature} (Digital Signature - base64 encoded. XML-DSig
3526   *              or a JWT.)
3527   */
3528  public Bundle setSignature(Signature value) {
3529    this.signature = value;
3530    return this;
3531  }
3532
3533  /**
3534   * Returns the {@link #getLink() link} which matches a given
3535   * {@link BundleLinkComponent#getRelation() relation}. If no link is found which
3536   * matches the given relation, returns <code>null</code>. If more than one link
3537   * is found which matches the given relation, returns the first matching
3538   * BundleLinkComponent.
3539   * 
3540   * @param theRelation The relation, such as "next", or "self. See the constants
3541   *                    such as {@link IBaseBundle#LINK_SELF} and
3542   *                    {@link IBaseBundle#LINK_NEXT}.
3543   * @return Returns a matching BundleLinkComponent, or <code>null</code>
3544   * @see IBaseBundle#LINK_NEXT
3545   * @see IBaseBundle#LINK_PREV
3546   * @see IBaseBundle#LINK_SELF
3547   */
3548  public BundleLinkComponent getLink(String theRelation) {
3549    org.apache.commons.lang3.Validate.notBlank(theRelation, "theRelation may not be null or empty");
3550    for (BundleLinkComponent next : getLink()) {
3551      if (theRelation.equals(next.getRelation())) {
3552        return next;
3553      }
3554    }
3555    return null;
3556  }
3557
3558  /**
3559   * Returns the {@link #getLink() link} which matches a given
3560   * {@link BundleLinkComponent#getRelation() relation}. If no link is found which
3561   * matches the given relation, creates a new BundleLinkComponent with the given
3562   * relation and adds it to this Bundle. If more than one link is found which
3563   * matches the given relation, returns the first matching BundleLinkComponent.
3564   * 
3565   * @param theRelation The relation, such as "next", or "self. See the constants
3566   *                    such as {@link IBaseBundle#LINK_SELF} and
3567   *                    {@link IBaseBundle#LINK_NEXT}.
3568   * @return Returns a matching BundleLinkComponent, or <code>null</code>
3569   * @see IBaseBundle#LINK_NEXT
3570   * @see IBaseBundle#LINK_PREV
3571   * @see IBaseBundle#LINK_SELF
3572   */
3573  public BundleLinkComponent getLinkOrCreate(String theRelation) {
3574    org.apache.commons.lang3.Validate.notBlank(theRelation, "theRelation may not be null or empty");
3575    for (BundleLinkComponent next : getLink()) {
3576      if (theRelation.equals(next.getRelation())) {
3577        return next;
3578      }
3579    }
3580    BundleLinkComponent retVal = new BundleLinkComponent();
3581    retVal.setRelation(theRelation);
3582    getLink().add(retVal);
3583    return retVal;
3584  }
3585
3586  protected void listChildren(List<Property> children) {
3587    super.listChildren(children);
3588    children.add(new Property("identifier", "Identifier",
3589        "A persistent identifier for the bundle that won't change as a bundle is copied from server to server.", 0, 1,
3590        identifier));
3591    children.add(new Property("type", "code", "Indicates the purpose of this bundle - how it is intended to be used.",
3592        0, 1, type));
3593    children.add(new Property("timestamp", "instant",
3594        "The date/time that the bundle was assembled - i.e. when the resources were placed in the bundle.", 0, 1,
3595        timestamp));
3596    children.add(new Property("total", "unsignedInt",
3597        "If a set of search matches, this is the total number of entries of type 'match' across all pages in the search.  It does not include search.mode = 'include' or 'outcome' entries and it does not provide a count of the number of entries in the Bundle.",
3598        0, 1, total));
3599    children.add(new Property("link", "", "A series of links that provide context to this bundle.", 0,
3600        java.lang.Integer.MAX_VALUE, link));
3601    children.add(new Property("entry", "",
3602        "An entry in a bundle resource - will either contain a resource or information about a resource (transactions and history only).",
3603        0, java.lang.Integer.MAX_VALUE, entry));
3604    children.add(new Property("signature", "Signature", "Digital Signature - base64 encoded. XML-DSig or a JWT.", 0, 1,
3605        signature));
3606  }
3607
3608  @Override
3609  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3610    switch (_hash) {
3611    case -1618432855:
3612      /* identifier */ return new Property("identifier", "Identifier",
3613          "A persistent identifier for the bundle that won't change as a bundle is copied from server to server.", 0, 1,
3614          identifier);
3615    case 3575610:
3616      /* type */ return new Property("type", "code",
3617          "Indicates the purpose of this bundle - how it is intended to be used.", 0, 1, type);
3618    case 55126294:
3619      /* timestamp */ return new Property("timestamp", "instant",
3620          "The date/time that the bundle was assembled - i.e. when the resources were placed in the bundle.", 0, 1,
3621          timestamp);
3622    case 110549828:
3623      /* total */ return new Property("total", "unsignedInt",
3624          "If a set of search matches, this is the total number of entries of type 'match' across all pages in the search.  It does not include search.mode = 'include' or 'outcome' entries and it does not provide a count of the number of entries in the Bundle.",
3625          0, 1, total);
3626    case 3321850:
3627      /* link */ return new Property("link", "", "A series of links that provide context to this bundle.", 0,
3628          java.lang.Integer.MAX_VALUE, link);
3629    case 96667762:
3630      /* entry */ return new Property("entry", "",
3631          "An entry in a bundle resource - will either contain a resource or information about a resource (transactions and history only).",
3632          0, java.lang.Integer.MAX_VALUE, entry);
3633    case 1073584312:
3634      /* signature */ return new Property("signature", "Signature",
3635          "Digital Signature - base64 encoded. XML-DSig or a JWT.", 0, 1, signature);
3636    default:
3637      return super.getNamedProperty(_hash, _name, _checkValid);
3638    }
3639
3640  }
3641
3642  @Override
3643  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3644    switch (hash) {
3645    case -1618432855:
3646      /* identifier */ return this.identifier == null ? new Base[0] : new Base[] { this.identifier }; // Identifier
3647    case 3575610:
3648      /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // Enumeration<BundleType>
3649    case 55126294:
3650      /* timestamp */ return this.timestamp == null ? new Base[0] : new Base[] { this.timestamp }; // InstantType
3651    case 110549828:
3652      /* total */ return this.total == null ? new Base[0] : new Base[] { this.total }; // UnsignedIntType
3653    case 3321850:
3654      /* link */ return this.link == null ? new Base[0] : this.link.toArray(new Base[this.link.size()]); // BundleLinkComponent
3655    case 96667762:
3656      /* entry */ return this.entry == null ? new Base[0] : this.entry.toArray(new Base[this.entry.size()]); // BundleEntryComponent
3657    case 1073584312:
3658      /* signature */ return this.signature == null ? new Base[0] : new Base[] { this.signature }; // Signature
3659    default:
3660      return super.getProperty(hash, name, checkValid);
3661    }
3662
3663  }
3664
3665  @Override
3666  public Base setProperty(int hash, String name, Base value) throws FHIRException {
3667    switch (hash) {
3668    case -1618432855: // identifier
3669      this.identifier = castToIdentifier(value); // Identifier
3670      return value;
3671    case 3575610: // type
3672      value = new BundleTypeEnumFactory().fromType(castToCode(value));
3673      this.type = (Enumeration) value; // Enumeration<BundleType>
3674      return value;
3675    case 55126294: // timestamp
3676      this.timestamp = castToInstant(value); // InstantType
3677      return value;
3678    case 110549828: // total
3679      this.total = castToUnsignedInt(value); // UnsignedIntType
3680      return value;
3681    case 3321850: // link
3682      this.getLink().add((BundleLinkComponent) value); // BundleLinkComponent
3683      return value;
3684    case 96667762: // entry
3685      this.getEntry().add((BundleEntryComponent) value); // BundleEntryComponent
3686      return value;
3687    case 1073584312: // signature
3688      this.signature = castToSignature(value); // Signature
3689      return value;
3690    default:
3691      return super.setProperty(hash, name, value);
3692    }
3693
3694  }
3695
3696  @Override
3697  public Base setProperty(String name, Base value) throws FHIRException {
3698    if (name.equals("identifier")) {
3699      this.identifier = castToIdentifier(value); // Identifier
3700    } else if (name.equals("type")) {
3701      value = new BundleTypeEnumFactory().fromType(castToCode(value));
3702      this.type = (Enumeration) value; // Enumeration<BundleType>
3703    } else if (name.equals("timestamp")) {
3704      this.timestamp = castToInstant(value); // InstantType
3705    } else if (name.equals("total")) {
3706      this.total = castToUnsignedInt(value); // UnsignedIntType
3707    } else if (name.equals("link")) {
3708      this.getLink().add((BundleLinkComponent) value);
3709    } else if (name.equals("entry")) {
3710      this.getEntry().add((BundleEntryComponent) value);
3711    } else if (name.equals("signature")) {
3712      this.signature = castToSignature(value); // Signature
3713    } else
3714      return super.setProperty(name, value);
3715    return value;
3716  }
3717
3718  @Override
3719  public void removeChild(String name, Base value) throws FHIRException {
3720    if (name.equals("identifier")) {
3721      this.identifier = null;
3722    } else if (name.equals("type")) {
3723      this.type = null;
3724    } else if (name.equals("timestamp")) {
3725      this.timestamp = null;
3726    } else if (name.equals("total")) {
3727      this.total = null;
3728    } else if (name.equals("link")) {
3729      this.getLink().remove((BundleLinkComponent) value);
3730    } else if (name.equals("entry")) {
3731      this.getEntry().remove((BundleEntryComponent) value);
3732    } else if (name.equals("signature")) {
3733      this.signature = null;
3734    } else
3735      super.removeChild(name, value);
3736    
3737  }
3738
3739  @Override
3740  public Base makeProperty(int hash, String name) throws FHIRException {
3741    switch (hash) {
3742    case -1618432855:
3743      return getIdentifier();
3744    case 3575610:
3745      return getTypeElement();
3746    case 55126294:
3747      return getTimestampElement();
3748    case 110549828:
3749      return getTotalElement();
3750    case 3321850:
3751      return addLink();
3752    case 96667762:
3753      return addEntry();
3754    case 1073584312:
3755      return getSignature();
3756    default:
3757      return super.makeProperty(hash, name);
3758    }
3759
3760  }
3761
3762  @Override
3763  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3764    switch (hash) {
3765    case -1618432855:
3766      /* identifier */ return new String[] { "Identifier" };
3767    case 3575610:
3768      /* type */ return new String[] { "code" };
3769    case 55126294:
3770      /* timestamp */ return new String[] { "instant" };
3771    case 110549828:
3772      /* total */ return new String[] { "unsignedInt" };
3773    case 3321850:
3774      /* link */ return new String[] {};
3775    case 96667762:
3776      /* entry */ return new String[] {};
3777    case 1073584312:
3778      /* signature */ return new String[] { "Signature" };
3779    default:
3780      return super.getTypesForProperty(hash, name);
3781    }
3782
3783  }
3784
3785  @Override
3786  public Base addChild(String name) throws FHIRException {
3787    if (name.equals("identifier")) {
3788      this.identifier = new Identifier();
3789      return this.identifier;
3790    } else if (name.equals("type")) {
3791      throw new FHIRException("Cannot call addChild on a singleton property Bundle.type");
3792    } else if (name.equals("timestamp")) {
3793      throw new FHIRException("Cannot call addChild on a singleton property Bundle.timestamp");
3794    } else if (name.equals("total")) {
3795      throw new FHIRException("Cannot call addChild on a singleton property Bundle.total");
3796    } else if (name.equals("link")) {
3797      return addLink();
3798    } else if (name.equals("entry")) {
3799      return addEntry();
3800    } else if (name.equals("signature")) {
3801      this.signature = new Signature();
3802      return this.signature;
3803    } else
3804      return super.addChild(name);
3805  }
3806
3807  public String fhirType() {
3808    return "Bundle";
3809
3810  }
3811
3812  public Bundle copy() {
3813    Bundle dst = new Bundle();
3814    copyValues(dst);
3815    return dst;
3816  }
3817
3818  public void copyValues(Bundle dst) {
3819    super.copyValues(dst);
3820    dst.identifier = identifier == null ? null : identifier.copy();
3821    dst.type = type == null ? null : type.copy();
3822    dst.timestamp = timestamp == null ? null : timestamp.copy();
3823    dst.total = total == null ? null : total.copy();
3824    if (link != null) {
3825      dst.link = new ArrayList<BundleLinkComponent>();
3826      for (BundleLinkComponent i : link)
3827        dst.link.add(i.copy());
3828    }
3829    ;
3830    if (entry != null) {
3831      dst.entry = new ArrayList<BundleEntryComponent>();
3832      for (BundleEntryComponent i : entry)
3833        dst.entry.add(i.copy());
3834    }
3835    ;
3836    dst.signature = signature == null ? null : signature.copy();
3837  }
3838
3839  protected Bundle typedCopy() {
3840    return copy();
3841  }
3842
3843  @Override
3844  public boolean equalsDeep(Base other_) {
3845    if (!super.equalsDeep(other_))
3846      return false;
3847    if (!(other_ instanceof Bundle))
3848      return false;
3849    Bundle o = (Bundle) other_;
3850    return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true)
3851        && compareDeep(timestamp, o.timestamp, true) && compareDeep(total, o.total, true)
3852        && compareDeep(link, o.link, true) && compareDeep(entry, o.entry, true)
3853        && compareDeep(signature, o.signature, true);
3854  }
3855
3856  @Override
3857  public boolean equalsShallow(Base other_) {
3858    if (!super.equalsShallow(other_))
3859      return false;
3860    if (!(other_ instanceof Bundle))
3861      return false;
3862    Bundle o = (Bundle) other_;
3863    return compareValues(type, o.type, true) && compareValues(timestamp, o.timestamp, true)
3864        && compareValues(total, o.total, true);
3865  }
3866
3867  public boolean isEmpty() {
3868    return super.isEmpty()
3869        && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, timestamp, total, link, entry, signature);
3870  }
3871
3872  @Override
3873  public ResourceType getResourceType() {
3874    return ResourceType.Bundle;
3875  }
3876
3877  /**
3878   * Search parameter: <b>identifier</b>
3879   * <p>
3880   * Description: <b>Persistent identifier for the bundle</b><br>
3881   * Type: <b>token</b><br>
3882   * Path: <b>Bundle.identifier</b><br>
3883   * </p>
3884   */
3885  @SearchParamDefinition(name = "identifier", path = "Bundle.identifier", description = "Persistent identifier for the bundle", type = "token")
3886  public static final String SP_IDENTIFIER = "identifier";
3887  /**
3888   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3889   * <p>
3890   * Description: <b>Persistent identifier for the bundle</b><br>
3891   * Type: <b>token</b><br>
3892   * Path: <b>Bundle.identifier</b><br>
3893   * </p>
3894   */
3895  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3896      SP_IDENTIFIER);
3897
3898  /**
3899   * Search parameter: <b>composition</b>
3900   * <p>
3901   * Description: <b>The first resource in the bundle, if the bundle type is
3902   * "document" - this is a composition, and this parameter provides access to
3903   * search its contents</b><br>
3904   * Type: <b>reference</b><br>
3905   * Path: <b>Bundle.entry(0).resource</b><br>
3906   * </p>
3907   */
3908  @SearchParamDefinition(name = "composition", path = "Bundle.entry[0].resource", description = "The first resource in the bundle, if the bundle type is \"document\" - this is a composition, and this parameter provides access to search its contents", type = "reference", target = {
3909      Composition.class })
3910  public static final String SP_COMPOSITION = "composition";
3911  /**
3912   * <b>Fluent Client</b> search parameter constant for <b>composition</b>
3913   * <p>
3914   * Description: <b>The first resource in the bundle, if the bundle type is
3915   * "document" - this is a composition, and this parameter provides access to
3916   * search its contents</b><br>
3917   * Type: <b>reference</b><br>
3918   * Path: <b>Bundle.entry(0).resource</b><br>
3919   * </p>
3920   */
3921  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COMPOSITION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3922      SP_COMPOSITION);
3923
3924  /**
3925   * Constant for fluent queries to be used to add include statements. Specifies
3926   * the path value of "<b>Bundle:composition</b>".
3927   */
3928  public static final ca.uhn.fhir.model.api.Include INCLUDE_COMPOSITION = new ca.uhn.fhir.model.api.Include(
3929      "Bundle:composition").toLocked();
3930
3931  /**
3932   * Search parameter: <b>type</b>
3933   * <p>
3934   * Description: <b>document | message | transaction | transaction-response |
3935   * batch | batch-response | history | searchset | collection</b><br>
3936   * Type: <b>token</b><br>
3937   * Path: <b>Bundle.type</b><br>
3938   * </p>
3939   */
3940  @SearchParamDefinition(name = "type", path = "Bundle.type", description = "document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection", type = "token")
3941  public static final String SP_TYPE = "type";
3942  /**
3943   * <b>Fluent Client</b> search parameter constant for <b>type</b>
3944   * <p>
3945   * Description: <b>document | message | transaction | transaction-response |
3946   * batch | batch-response | history | searchset | collection</b><br>
3947   * Type: <b>token</b><br>
3948   * Path: <b>Bundle.type</b><br>
3949   * </p>
3950   */
3951  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3952      SP_TYPE);
3953
3954  /**
3955   * Search parameter: <b>message</b>
3956   * <p>
3957   * Description: <b>The first resource in the bundle, if the bundle type is
3958   * "message" - this is a message header, and this parameter provides access to
3959   * search its contents</b><br>
3960   * Type: <b>reference</b><br>
3961   * Path: <b>Bundle.entry(0).resource</b><br>
3962   * </p>
3963   */
3964  @SearchParamDefinition(name = "message", path = "Bundle.entry[0].resource", description = "The first resource in the bundle, if the bundle type is \"message\" - this is a message header, and this parameter provides access to search its contents", type = "reference", target = {
3965      MessageHeader.class })
3966  public static final String SP_MESSAGE = "message";
3967  /**
3968   * <b>Fluent Client</b> search parameter constant for <b>message</b>
3969   * <p>
3970   * Description: <b>The first resource in the bundle, if the bundle type is
3971   * "message" - this is a message header, and this parameter provides access to
3972   * search its contents</b><br>
3973   * Type: <b>reference</b><br>
3974   * Path: <b>Bundle.entry(0).resource</b><br>
3975   * </p>
3976   */
3977  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MESSAGE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3978      SP_MESSAGE);
3979
3980  /**
3981   * Constant for fluent queries to be used to add include statements. Specifies
3982   * the path value of "<b>Bundle:message</b>".
3983   */
3984  public static final ca.uhn.fhir.model.api.Include INCLUDE_MESSAGE = new ca.uhn.fhir.model.api.Include(
3985      "Bundle:message").toLocked();
3986
3987  /**
3988   * Search parameter: <b>timestamp</b>
3989   * <p>
3990   * Description: <b>When the bundle was assembled</b><br>
3991   * Type: <b>date</b><br>
3992   * Path: <b>Bundle.timestamp</b><br>
3993   * </p>
3994   */
3995  @SearchParamDefinition(name = "timestamp", path = "Bundle.timestamp", description = "When the bundle was assembled", type = "date")
3996  public static final String SP_TIMESTAMP = "timestamp";
3997  /**
3998   * <b>Fluent Client</b> search parameter constant for <b>timestamp</b>
3999   * <p>
4000   * Description: <b>When the bundle was assembled</b><br>
4001   * Type: <b>date</b><br>
4002   * Path: <b>Bundle.timestamp</b><br>
4003   * </p>
4004   */
4005  public static final ca.uhn.fhir.rest.gclient.DateClientParam TIMESTAMP = new ca.uhn.fhir.rest.gclient.DateClientParam(
4006      SP_TIMESTAMP);
4007
4008}