001package org.hl7.fhir.dstu2.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
035import java.util.ArrayList;
036import java.util.Date;
037import java.util.List;
038
039import ca.uhn.fhir.model.api.annotation.Block;
040import ca.uhn.fhir.model.api.annotation.Child;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import org.hl7.fhir.instance.model.api.IBaseBundle;
046import org.hl7.fhir.exceptions.FHIRException;
047import org.hl7.fhir.utilities.Utilities;
048
049/**
050 * A container for a collection of resources.
051 */
052@ResourceDef(name = "Bundle", profile = "http://hl7.org/fhir/Profile/Bundle")
053public class Bundle extends Resource implements IBaseBundle {
054
055  public enum BundleType {
056    /**
057     * The bundle is a document. The first resource is a Composition.
058     */
059    DOCUMENT,
060    /**
061     * The bundle is a message. The first resource is a MessageHeader.
062     */
063    MESSAGE,
064    /**
065     * The bundle is a transaction - intended to be processed by a server as an
066     * atomic commit.
067     */
068    TRANSACTION,
069    /**
070     * The bundle is a transaction response. Because the response is a transaction
071     * response, the transactionhas succeeded, and all responses are error free.
072     */
073    TRANSACTIONRESPONSE,
074    /**
075     * The bundle is a transaction - intended to be processed by a server as a group
076     * of actions.
077     */
078    BATCH,
079    /**
080     * The bundle is a batch response. Note that as a batch, some responses may
081     * indicate failure and others success.
082     */
083    BATCHRESPONSE,
084    /**
085     * The bundle is a list of resources from a history interaction on a server.
086     */
087    HISTORY,
088    /**
089     * The bundle is a list of resources returned as a result of a search/query
090     * interaction, operation, or message.
091     */
092    SEARCHSET,
093    /**
094     * The bundle is a set of resources collected into a single document for ease of
095     * distribution.
096     */
097    COLLECTION,
098    /**
099     * added to help the parsers
100     */
101    NULL;
102
103    public static BundleType fromCode(String codeString) throws FHIRException {
104      if (codeString == null || "".equals(codeString))
105        return null;
106      if ("document".equals(codeString))
107        return DOCUMENT;
108      if ("message".equals(codeString))
109        return MESSAGE;
110      if ("transaction".equals(codeString))
111        return TRANSACTION;
112      if ("transaction-response".equals(codeString))
113        return TRANSACTIONRESPONSE;
114      if ("batch".equals(codeString))
115        return BATCH;
116      if ("batch-response".equals(codeString))
117        return BATCHRESPONSE;
118      if ("history".equals(codeString))
119        return HISTORY;
120      if ("searchset".equals(codeString))
121        return SEARCHSET;
122      if ("collection".equals(codeString))
123        return COLLECTION;
124      throw new FHIRException("Unknown BundleType code '" + codeString + "'");
125    }
126
127    public String toCode() {
128      switch (this) {
129      case DOCUMENT:
130        return "document";
131      case MESSAGE:
132        return "message";
133      case TRANSACTION:
134        return "transaction";
135      case TRANSACTIONRESPONSE:
136        return "transaction-response";
137      case BATCH:
138        return "batch";
139      case BATCHRESPONSE:
140        return "batch-response";
141      case HISTORY:
142        return "history";
143      case SEARCHSET:
144        return "searchset";
145      case COLLECTION:
146        return "collection";
147      case NULL:
148        return null;
149      default:
150        return "?";
151      }
152    }
153
154    public String getSystem() {
155      switch (this) {
156      case DOCUMENT:
157        return "http://hl7.org/fhir/bundle-type";
158      case MESSAGE:
159        return "http://hl7.org/fhir/bundle-type";
160      case TRANSACTION:
161        return "http://hl7.org/fhir/bundle-type";
162      case TRANSACTIONRESPONSE:
163        return "http://hl7.org/fhir/bundle-type";
164      case BATCH:
165        return "http://hl7.org/fhir/bundle-type";
166      case BATCHRESPONSE:
167        return "http://hl7.org/fhir/bundle-type";
168      case HISTORY:
169        return "http://hl7.org/fhir/bundle-type";
170      case SEARCHSET:
171        return "http://hl7.org/fhir/bundle-type";
172      case COLLECTION:
173        return "http://hl7.org/fhir/bundle-type";
174      case NULL:
175        return null;
176      default:
177        return "?";
178      }
179    }
180
181    public String getDefinition() {
182      switch (this) {
183      case DOCUMENT:
184        return "The bundle is a document. The first resource is a Composition.";
185      case MESSAGE:
186        return "The bundle is a message. The first resource is a MessageHeader.";
187      case TRANSACTION:
188        return "The bundle is a transaction - intended to be processed by a server as an atomic commit.";
189      case TRANSACTIONRESPONSE:
190        return "The bundle is a transaction response. Because the response is a transaction response, the transactionhas succeeded, and all responses are error free.";
191      case BATCH:
192        return "The bundle is a transaction - intended to be processed by a server as a group of actions.";
193      case BATCHRESPONSE:
194        return "The bundle is a batch response. Note that as a batch, some responses may indicate failure and others success.";
195      case HISTORY:
196        return "The bundle is a list of resources from a history interaction on a server.";
197      case SEARCHSET:
198        return "The bundle is a list of resources returned as a result of a search/query interaction, operation, or message.";
199      case COLLECTION:
200        return "The bundle is a set of resources collected into a single document for ease of distribution.";
201      case NULL:
202        return null;
203      default:
204        return "?";
205      }
206    }
207
208    public String getDisplay() {
209      switch (this) {
210      case DOCUMENT:
211        return "Document";
212      case MESSAGE:
213        return "Message";
214      case TRANSACTION:
215        return "Transaction";
216      case TRANSACTIONRESPONSE:
217        return "Transaction Response";
218      case BATCH:
219        return "Batch";
220      case BATCHRESPONSE:
221        return "Batch Response";
222      case HISTORY:
223        return "History List";
224      case SEARCHSET:
225        return "Search Results";
226      case COLLECTION:
227        return "Collection";
228      case NULL:
229        return null;
230      default:
231        return "?";
232      }
233    }
234  }
235
236  public static class BundleTypeEnumFactory implements EnumFactory<BundleType> {
237    public BundleType fromCode(String codeString) throws IllegalArgumentException {
238      if (codeString == null || "".equals(codeString))
239        if (codeString == null || "".equals(codeString))
240          return null;
241      if ("document".equals(codeString))
242        return BundleType.DOCUMENT;
243      if ("message".equals(codeString))
244        return BundleType.MESSAGE;
245      if ("transaction".equals(codeString))
246        return BundleType.TRANSACTION;
247      if ("transaction-response".equals(codeString))
248        return BundleType.TRANSACTIONRESPONSE;
249      if ("batch".equals(codeString))
250        return BundleType.BATCH;
251      if ("batch-response".equals(codeString))
252        return BundleType.BATCHRESPONSE;
253      if ("history".equals(codeString))
254        return BundleType.HISTORY;
255      if ("searchset".equals(codeString))
256        return BundleType.SEARCHSET;
257      if ("collection".equals(codeString))
258        return BundleType.COLLECTION;
259      throw new IllegalArgumentException("Unknown BundleType code '" + codeString + "'");
260    }
261
262    public Enumeration<BundleType> fromType(Base code) throws FHIRException {
263      if (code == null || code.isEmpty())
264        return null;
265      String codeString = ((PrimitiveType) code).asStringValue();
266      if (codeString == null || "".equals(codeString))
267        return null;
268      if ("document".equals(codeString))
269        return new Enumeration<BundleType>(this, BundleType.DOCUMENT);
270      if ("message".equals(codeString))
271        return new Enumeration<BundleType>(this, BundleType.MESSAGE);
272      if ("transaction".equals(codeString))
273        return new Enumeration<BundleType>(this, BundleType.TRANSACTION);
274      if ("transaction-response".equals(codeString))
275        return new Enumeration<BundleType>(this, BundleType.TRANSACTIONRESPONSE);
276      if ("batch".equals(codeString))
277        return new Enumeration<BundleType>(this, BundleType.BATCH);
278      if ("batch-response".equals(codeString))
279        return new Enumeration<BundleType>(this, BundleType.BATCHRESPONSE);
280      if ("history".equals(codeString))
281        return new Enumeration<BundleType>(this, BundleType.HISTORY);
282      if ("searchset".equals(codeString))
283        return new Enumeration<BundleType>(this, BundleType.SEARCHSET);
284      if ("collection".equals(codeString))
285        return new Enumeration<BundleType>(this, BundleType.COLLECTION);
286      throw new FHIRException("Unknown BundleType code '" + codeString + "'");
287    }
288
289    public String toCode(BundleType code) {
290      if (code == BundleType.DOCUMENT)
291        return "document";
292      if (code == BundleType.MESSAGE)
293        return "message";
294      if (code == BundleType.TRANSACTION)
295        return "transaction";
296      if (code == BundleType.TRANSACTIONRESPONSE)
297        return "transaction-response";
298      if (code == BundleType.BATCH)
299        return "batch";
300      if (code == BundleType.BATCHRESPONSE)
301        return "batch-response";
302      if (code == BundleType.HISTORY)
303        return "history";
304      if (code == BundleType.SEARCHSET)
305        return "searchset";
306      if (code == BundleType.COLLECTION)
307        return "collection";
308      return "?";
309    }
310  }
311
312  public enum SearchEntryMode {
313    /**
314     * This resource matched the search specification.
315     */
316    MATCH,
317    /**
318     * This resource is returned because it is referred to from another resource in
319     * the search set.
320     */
321    INCLUDE,
322    /**
323     * An OperationOutcome that provides additional information about the processing
324     * of a search.
325     */
326    OUTCOME,
327    /**
328     * added to help the parsers
329     */
330    NULL;
331
332    public static SearchEntryMode fromCode(String codeString) throws FHIRException {
333      if (codeString == null || "".equals(codeString))
334        return null;
335      if ("match".equals(codeString))
336        return MATCH;
337      if ("include".equals(codeString))
338        return INCLUDE;
339      if ("outcome".equals(codeString))
340        return OUTCOME;
341      throw new FHIRException("Unknown SearchEntryMode code '" + codeString + "'");
342    }
343
344    public String toCode() {
345      switch (this) {
346      case MATCH:
347        return "match";
348      case INCLUDE:
349        return "include";
350      case OUTCOME:
351        return "outcome";
352      case NULL:
353        return null;
354      default:
355        return "?";
356      }
357    }
358
359    public String getSystem() {
360      switch (this) {
361      case MATCH:
362        return "http://hl7.org/fhir/search-entry-mode";
363      case INCLUDE:
364        return "http://hl7.org/fhir/search-entry-mode";
365      case OUTCOME:
366        return "http://hl7.org/fhir/search-entry-mode";
367      case NULL:
368        return null;
369      default:
370        return "?";
371      }
372    }
373
374    public String getDefinition() {
375      switch (this) {
376      case MATCH:
377        return "This resource matched the search specification.";
378      case INCLUDE:
379        return "This resource is returned because it is referred to from another resource in the search set.";
380      case OUTCOME:
381        return "An OperationOutcome that provides additional information about the processing of a search.";
382      case NULL:
383        return null;
384      default:
385        return "?";
386      }
387    }
388
389    public String getDisplay() {
390      switch (this) {
391      case MATCH:
392        return "Match";
393      case INCLUDE:
394        return "Include";
395      case OUTCOME:
396        return "Outcome";
397      case NULL:
398        return null;
399      default:
400        return "?";
401      }
402    }
403  }
404
405  public static class SearchEntryModeEnumFactory implements EnumFactory<SearchEntryMode> {
406    public SearchEntryMode fromCode(String codeString) throws IllegalArgumentException {
407      if (codeString == null || "".equals(codeString))
408        if (codeString == null || "".equals(codeString))
409          return null;
410      if ("match".equals(codeString))
411        return SearchEntryMode.MATCH;
412      if ("include".equals(codeString))
413        return SearchEntryMode.INCLUDE;
414      if ("outcome".equals(codeString))
415        return SearchEntryMode.OUTCOME;
416      throw new IllegalArgumentException("Unknown SearchEntryMode code '" + codeString + "'");
417    }
418
419    public Enumeration<SearchEntryMode> fromType(Base code) throws FHIRException {
420      if (code == null || code.isEmpty())
421        return null;
422      String codeString = ((PrimitiveType) code).asStringValue();
423      if (codeString == null || "".equals(codeString))
424        return null;
425      if ("match".equals(codeString))
426        return new Enumeration<SearchEntryMode>(this, SearchEntryMode.MATCH);
427      if ("include".equals(codeString))
428        return new Enumeration<SearchEntryMode>(this, SearchEntryMode.INCLUDE);
429      if ("outcome".equals(codeString))
430        return new Enumeration<SearchEntryMode>(this, SearchEntryMode.OUTCOME);
431      throw new FHIRException("Unknown SearchEntryMode code '" + codeString + "'");
432    }
433
434    public String toCode(SearchEntryMode code) {
435      if (code == SearchEntryMode.MATCH)
436        return "match";
437      if (code == SearchEntryMode.INCLUDE)
438        return "include";
439      if (code == SearchEntryMode.OUTCOME)
440        return "outcome";
441      return "?";
442    }
443  }
444
445  public enum HTTPVerb {
446    /**
447     * HTTP GET
448     */
449    GET,
450    /**
451     * HTTP POST
452     */
453    POST,
454    /**
455     * HTTP PUT
456     */
457    PUT,
458    /**
459     * HTTP DELETE
460     */
461    DELETE,
462    /**
463     * added to help the parsers
464     */
465    NULL;
466
467    public static HTTPVerb fromCode(String codeString) throws FHIRException {
468      if (codeString == null || "".equals(codeString))
469        return null;
470      if ("GET".equals(codeString))
471        return GET;
472      if ("POST".equals(codeString))
473        return POST;
474      if ("PUT".equals(codeString))
475        return PUT;
476      if ("DELETE".equals(codeString))
477        return DELETE;
478      throw new FHIRException("Unknown HTTPVerb code '" + codeString + "'");
479    }
480
481    public String toCode() {
482      switch (this) {
483      case GET:
484        return "GET";
485      case POST:
486        return "POST";
487      case PUT:
488        return "PUT";
489      case DELETE:
490        return "DELETE";
491      case NULL:
492        return null;
493      default:
494        return "?";
495      }
496    }
497
498    public String getSystem() {
499      switch (this) {
500      case GET:
501        return "http://hl7.org/fhir/http-verb";
502      case POST:
503        return "http://hl7.org/fhir/http-verb";
504      case PUT:
505        return "http://hl7.org/fhir/http-verb";
506      case DELETE:
507        return "http://hl7.org/fhir/http-verb";
508      case NULL:
509        return null;
510      default:
511        return "?";
512      }
513    }
514
515    public String getDefinition() {
516      switch (this) {
517      case GET:
518        return "HTTP GET";
519      case POST:
520        return "HTTP POST";
521      case PUT:
522        return "HTTP PUT";
523      case DELETE:
524        return "HTTP DELETE";
525      case NULL:
526        return null;
527      default:
528        return "?";
529      }
530    }
531
532    public String getDisplay() {
533      switch (this) {
534      case GET:
535        return "GET";
536      case POST:
537        return "POST";
538      case PUT:
539        return "PUT";
540      case DELETE:
541        return "DELETE";
542      case NULL:
543        return null;
544      default:
545        return "?";
546      }
547    }
548  }
549
550  public static class HTTPVerbEnumFactory implements EnumFactory<HTTPVerb> {
551    public HTTPVerb fromCode(String codeString) throws IllegalArgumentException {
552      if (codeString == null || "".equals(codeString))
553        if (codeString == null || "".equals(codeString))
554          return null;
555      if ("GET".equals(codeString))
556        return HTTPVerb.GET;
557      if ("POST".equals(codeString))
558        return HTTPVerb.POST;
559      if ("PUT".equals(codeString))
560        return HTTPVerb.PUT;
561      if ("DELETE".equals(codeString))
562        return HTTPVerb.DELETE;
563      throw new IllegalArgumentException("Unknown HTTPVerb code '" + codeString + "'");
564    }
565
566    public Enumeration<HTTPVerb> fromType(Base code) throws FHIRException {
567      if (code == null || code.isEmpty())
568        return null;
569      String codeString = ((PrimitiveType) code).asStringValue();
570      if (codeString == null || "".equals(codeString))
571        return null;
572      if ("GET".equals(codeString))
573        return new Enumeration<HTTPVerb>(this, HTTPVerb.GET);
574      if ("POST".equals(codeString))
575        return new Enumeration<HTTPVerb>(this, HTTPVerb.POST);
576      if ("PUT".equals(codeString))
577        return new Enumeration<HTTPVerb>(this, HTTPVerb.PUT);
578      if ("DELETE".equals(codeString))
579        return new Enumeration<HTTPVerb>(this, HTTPVerb.DELETE);
580      throw new FHIRException("Unknown HTTPVerb code '" + codeString + "'");
581    }
582
583    public String toCode(HTTPVerb code) {
584      if (code == HTTPVerb.GET)
585        return "GET";
586      if (code == HTTPVerb.POST)
587        return "POST";
588      if (code == HTTPVerb.PUT)
589        return "PUT";
590      if (code == HTTPVerb.DELETE)
591        return "DELETE";
592      return "?";
593    }
594  }
595
596  @Block()
597  public static class BundleLinkComponent extends BackboneElement implements IBaseBackboneElement {
598    /**
599     * A name which details the functional use for this link - see
600     * [[http://www.iana.org/assignments/link-relations/link-relations.xhtml]].
601     */
602    @Child(name = "relation", type = {
603        StringType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
604    @Description(shortDefinition = "http://www.iana.org/assignments/link-relations/link-relations.xhtml", formalDefinition = "A name which details the functional use for this link - see [[http://www.iana.org/assignments/link-relations/link-relations.xhtml]].")
605    protected StringType relation;
606
607    /**
608     * The reference details for the link.
609     */
610    @Child(name = "url", type = { UriType.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
611    @Description(shortDefinition = "Reference details for the link", formalDefinition = "The reference details for the link.")
612    protected UriType url;
613
614    private static final long serialVersionUID = -1010386066L;
615
616    /*
617     * Constructor
618     */
619    public BundleLinkComponent() {
620      super();
621    }
622
623    /*
624     * Constructor
625     */
626    public BundleLinkComponent(StringType relation, UriType url) {
627      super();
628      this.relation = relation;
629      this.url = url;
630    }
631
632    /**
633     * @return {@link #relation} (A name which details the functional use for this
634     *         link - see
635     *         [[http://www.iana.org/assignments/link-relations/link-relations.xhtml]].).
636     *         This is the underlying object with id, value and extensions. The
637     *         accessor "getRelation" gives direct access to the value
638     */
639    public StringType getRelationElement() {
640      if (this.relation == null)
641        if (Configuration.errorOnAutoCreate())
642          throw new Error("Attempt to auto-create BundleLinkComponent.relation");
643        else if (Configuration.doAutoCreate())
644          this.relation = new StringType(); // bb
645      return this.relation;
646    }
647
648    public boolean hasRelationElement() {
649      return this.relation != null && !this.relation.isEmpty();
650    }
651
652    public boolean hasRelation() {
653      return this.relation != null && !this.relation.isEmpty();
654    }
655
656    /**
657     * @param value {@link #relation} (A name which details the functional use for
658     *              this link - see
659     *              [[http://www.iana.org/assignments/link-relations/link-relations.xhtml]].).
660     *              This is the underlying object with id, value and extensions. The
661     *              accessor "getRelation" gives direct access to the value
662     */
663    public BundleLinkComponent setRelationElement(StringType value) {
664      this.relation = value;
665      return this;
666    }
667
668    /**
669     * @return A name which details the functional use for this link - see
670     *         [[http://www.iana.org/assignments/link-relations/link-relations.xhtml]].
671     */
672    public String getRelation() {
673      return this.relation == null ? null : this.relation.getValue();
674    }
675
676    /**
677     * @param value A name which details the functional use for this link - see
678     *              [[http://www.iana.org/assignments/link-relations/link-relations.xhtml]].
679     */
680    public BundleLinkComponent setRelation(String value) {
681      if (this.relation == null)
682        this.relation = new StringType();
683      this.relation.setValue(value);
684      return this;
685    }
686
687    /**
688     * @return {@link #url} (The reference details for the link.). This is the
689     *         underlying object with id, value and extensions. The accessor
690     *         "getUrl" gives direct access to the value
691     */
692    public UriType getUrlElement() {
693      if (this.url == null)
694        if (Configuration.errorOnAutoCreate())
695          throw new Error("Attempt to auto-create BundleLinkComponent.url");
696        else if (Configuration.doAutoCreate())
697          this.url = new UriType(); // bb
698      return this.url;
699    }
700
701    public boolean hasUrlElement() {
702      return this.url != null && !this.url.isEmpty();
703    }
704
705    public boolean hasUrl() {
706      return this.url != null && !this.url.isEmpty();
707    }
708
709    /**
710     * @param value {@link #url} (The reference details for the link.). This is the
711     *              underlying object with id, value and extensions. The accessor
712     *              "getUrl" gives direct access to the value
713     */
714    public BundleLinkComponent setUrlElement(UriType value) {
715      this.url = value;
716      return this;
717    }
718
719    /**
720     * @return The reference details for the link.
721     */
722    public String getUrl() {
723      return this.url == null ? null : this.url.getValue();
724    }
725
726    /**
727     * @param value The reference details for the link.
728     */
729    public BundleLinkComponent setUrl(String value) {
730      if (this.url == null)
731        this.url = new UriType();
732      this.url.setValue(value);
733      return this;
734    }
735
736    protected void listChildren(List<Property> childrenList) {
737      super.listChildren(childrenList);
738      childrenList.add(new Property("relation", "string",
739          "A name which details the functional use for this link - see [[http://www.iana.org/assignments/link-relations/link-relations.xhtml]].",
740          0, java.lang.Integer.MAX_VALUE, relation));
741      childrenList
742          .add(new Property("url", "uri", "The reference details for the link.", 0, java.lang.Integer.MAX_VALUE, url));
743    }
744
745    @Override
746    public void setProperty(String name, Base value) throws FHIRException {
747      if (name.equals("relation"))
748        this.relation = castToString(value); // StringType
749      else if (name.equals("url"))
750        this.url = castToUri(value); // UriType
751      else
752        super.setProperty(name, value);
753    }
754
755    @Override
756    public Base addChild(String name) throws FHIRException {
757      if (name.equals("relation")) {
758        throw new FHIRException("Cannot call addChild on a singleton property Bundle.relation");
759      } else if (name.equals("url")) {
760        throw new FHIRException("Cannot call addChild on a singleton property Bundle.url");
761      } else
762        return super.addChild(name);
763    }
764
765    public BundleLinkComponent copy() {
766      BundleLinkComponent dst = new BundleLinkComponent();
767      copyValues(dst);
768      dst.relation = relation == null ? null : relation.copy();
769      dst.url = url == null ? null : url.copy();
770      return dst;
771    }
772
773    @Override
774    public boolean equalsDeep(Base other) {
775      if (!super.equalsDeep(other))
776        return false;
777      if (!(other instanceof BundleLinkComponent))
778        return false;
779      BundleLinkComponent o = (BundleLinkComponent) other;
780      return compareDeep(relation, o.relation, true) && compareDeep(url, o.url, true);
781    }
782
783    @Override
784    public boolean equalsShallow(Base other) {
785      if (!super.equalsShallow(other))
786        return false;
787      if (!(other instanceof BundleLinkComponent))
788        return false;
789      BundleLinkComponent o = (BundleLinkComponent) other;
790      return compareValues(relation, o.relation, true) && compareValues(url, o.url, true);
791    }
792
793    public boolean isEmpty() {
794      return super.isEmpty() && (relation == null || relation.isEmpty()) && (url == null || url.isEmpty());
795    }
796
797    public String fhirType() {
798      return "Bundle.link";
799
800    }
801
802  }
803
804  @Block()
805  public static class BundleEntryComponent extends BackboneElement implements IBaseBackboneElement {
806    /**
807     * A series of links that provide context to this entry.
808     */
809    @Child(name = "link", type = {
810        BundleLinkComponent.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
811    @Description(shortDefinition = "Links related to this entry", formalDefinition = "A series of links that provide context to this entry.")
812    protected List<BundleLinkComponent> link;
813
814    /**
815     * The Absolute URL for the resource. This must be provided for all resources.
816     * The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a
817     * version independent reference to the resource.
818     */
819    @Child(name = "fullUrl", type = { UriType.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
820    @Description(shortDefinition = "Absolute URL for resource (server address, or UUID/OID)", formalDefinition = "The Absolute URL for the resource. This must be provided for all resources. The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a version independent reference to the resource.")
821    protected UriType fullUrl;
822
823    /**
824     * The Resources for the entry.
825     */
826    @Child(name = "resource", type = { Resource.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
827    @Description(shortDefinition = "A resource in the bundle", formalDefinition = "The Resources for the entry.")
828    protected Resource resource;
829
830    /**
831     * Information about the search process that lead to the creation of this entry.
832     */
833    @Child(name = "search", type = {}, order = 4, min = 0, max = 1, modifier = false, summary = true)
834    @Description(shortDefinition = "Search related information", formalDefinition = "Information about the search process that lead to the creation of this entry.")
835    protected BundleEntrySearchComponent search;
836
837    /**
838     * Additional information about how this entry should be processed as part of a
839     * transaction.
840     */
841    @Child(name = "request", type = {}, order = 5, min = 0, max = 1, modifier = false, summary = true)
842    @Description(shortDefinition = "Transaction Related Information", formalDefinition = "Additional information about how this entry should be processed as part of a transaction.")
843    protected BundleEntryRequestComponent request;
844
845    /**
846     * Additional information about how this entry should be processed as part of a
847     * transaction.
848     */
849    @Child(name = "response", type = {}, order = 6, min = 0, max = 1, modifier = false, summary = true)
850    @Description(shortDefinition = "Transaction Related Information", formalDefinition = "Additional information about how this entry should be processed as part of a transaction.")
851    protected BundleEntryResponseComponent response;
852
853    private static final long serialVersionUID = 517783054L;
854
855    /*
856     * Constructor
857     */
858    public BundleEntryComponent() {
859      super();
860    }
861
862    /**
863     * @return {@link #link} (A series of links that provide context to this entry.)
864     */
865    public List<BundleLinkComponent> getLink() {
866      if (this.link == null)
867        this.link = new ArrayList<BundleLinkComponent>();
868      return this.link;
869    }
870
871    public boolean hasLink() {
872      if (this.link == null)
873        return false;
874      for (BundleLinkComponent item : this.link)
875        if (!item.isEmpty())
876          return true;
877      return false;
878    }
879
880    /**
881     * @return {@link #link} (A series of links that provide context to this entry.)
882     */
883    // syntactic sugar
884    public BundleLinkComponent addLink() { // 3
885      BundleLinkComponent t = new BundleLinkComponent();
886      if (this.link == null)
887        this.link = new ArrayList<BundleLinkComponent>();
888      this.link.add(t);
889      return t;
890    }
891
892    // syntactic sugar
893    public BundleEntryComponent addLink(BundleLinkComponent t) { // 3
894      if (t == null)
895        return this;
896      if (this.link == null)
897        this.link = new ArrayList<BundleLinkComponent>();
898      this.link.add(t);
899      return this;
900    }
901
902    /**
903     * @return {@link #fullUrl} (The Absolute URL for the resource. This must be
904     *         provided for all resources. The fullUrl SHALL not disagree with the
905     *         id in the resource. The fullUrl is a version independent reference to
906     *         the resource.). This is the underlying object with id, value and
907     *         extensions. The accessor "getFullUrl" gives direct access to the
908     *         value
909     */
910    public UriType getFullUrlElement() {
911      if (this.fullUrl == null)
912        if (Configuration.errorOnAutoCreate())
913          throw new Error("Attempt to auto-create BundleEntryComponent.fullUrl");
914        else if (Configuration.doAutoCreate())
915          this.fullUrl = new UriType(); // bb
916      return this.fullUrl;
917    }
918
919    public boolean hasFullUrlElement() {
920      return this.fullUrl != null && !this.fullUrl.isEmpty();
921    }
922
923    public boolean hasFullUrl() {
924      return this.fullUrl != null && !this.fullUrl.isEmpty();
925    }
926
927    /**
928     * @param value {@link #fullUrl} (The Absolute URL for the resource. This must
929     *              be provided for all resources. The fullUrl SHALL not disagree
930     *              with the id in the resource. The fullUrl is a version
931     *              independent reference to the resource.). This is the underlying
932     *              object with id, value and extensions. The accessor "getFullUrl"
933     *              gives direct access to the value
934     */
935    public BundleEntryComponent setFullUrlElement(UriType value) {
936      this.fullUrl = value;
937      return this;
938    }
939
940    /**
941     * @return The Absolute URL for the resource. This must be provided for all
942     *         resources. The fullUrl SHALL not disagree with the id in the
943     *         resource. The fullUrl is a version independent reference to the
944     *         resource.
945     */
946    public String getFullUrl() {
947      return this.fullUrl == null ? null : this.fullUrl.getValue();
948    }
949
950    /**
951     * @param value The Absolute URL for the resource. This must be provided for all
952     *              resources. The fullUrl SHALL not disagree with the id in the
953     *              resource. The fullUrl is a version independent reference to the
954     *              resource.
955     */
956    public BundleEntryComponent setFullUrl(String value) {
957      if (Utilities.noString(value))
958        this.fullUrl = null;
959      else {
960        if (this.fullUrl == null)
961          this.fullUrl = new UriType();
962        this.fullUrl.setValue(value);
963      }
964      return this;
965    }
966
967    /**
968     * @return {@link #resource} (The Resources for the entry.)
969     */
970    public Resource getResource() {
971      return this.resource;
972    }
973
974    public boolean hasResource() {
975      return this.resource != null && !this.resource.isEmpty();
976    }
977
978    /**
979     * @param value {@link #resource} (The Resources for the entry.)
980     */
981    public BundleEntryComponent setResource(Resource value) {
982      this.resource = value;
983      return this;
984    }
985
986    /**
987     * @return {@link #search} (Information about the search process that lead to
988     *         the creation of this entry.)
989     */
990    public BundleEntrySearchComponent getSearch() {
991      if (this.search == null)
992        if (Configuration.errorOnAutoCreate())
993          throw new Error("Attempt to auto-create BundleEntryComponent.search");
994        else if (Configuration.doAutoCreate())
995          this.search = new BundleEntrySearchComponent(); // cc
996      return this.search;
997    }
998
999    public boolean hasSearch() {
1000      return this.search != null && !this.search.isEmpty();
1001    }
1002
1003    /**
1004     * @param value {@link #search} (Information about the search process that lead
1005     *              to the creation of this entry.)
1006     */
1007    public BundleEntryComponent setSearch(BundleEntrySearchComponent value) {
1008      this.search = value;
1009      return this;
1010    }
1011
1012    /**
1013     * @return {@link #request} (Additional information about how this entry should
1014     *         be processed as part of a transaction.)
1015     */
1016    public BundleEntryRequestComponent getRequest() {
1017      if (this.request == null)
1018        if (Configuration.errorOnAutoCreate())
1019          throw new Error("Attempt to auto-create BundleEntryComponent.request");
1020        else if (Configuration.doAutoCreate())
1021          this.request = new BundleEntryRequestComponent(); // cc
1022      return this.request;
1023    }
1024
1025    public boolean hasRequest() {
1026      return this.request != null && !this.request.isEmpty();
1027    }
1028
1029    /**
1030     * @param value {@link #request} (Additional information about how this entry
1031     *              should be processed as part of a transaction.)
1032     */
1033    public BundleEntryComponent setRequest(BundleEntryRequestComponent value) {
1034      this.request = value;
1035      return this;
1036    }
1037
1038    /**
1039     * @return {@link #response} (Additional information about how this entry should
1040     *         be processed as part of a transaction.)
1041     */
1042    public BundleEntryResponseComponent getResponse() {
1043      if (this.response == null)
1044        if (Configuration.errorOnAutoCreate())
1045          throw new Error("Attempt to auto-create BundleEntryComponent.response");
1046        else if (Configuration.doAutoCreate())
1047          this.response = new BundleEntryResponseComponent(); // cc
1048      return this.response;
1049    }
1050
1051    public boolean hasResponse() {
1052      return this.response != null && !this.response.isEmpty();
1053    }
1054
1055    /**
1056     * @param value {@link #response} (Additional information about how this entry
1057     *              should be processed as part of a transaction.)
1058     */
1059    public BundleEntryComponent setResponse(BundleEntryResponseComponent value) {
1060      this.response = value;
1061      return this;
1062    }
1063
1064    protected void listChildren(List<Property> childrenList) {
1065      super.listChildren(childrenList);
1066      childrenList.add(new Property("link", "@Bundle.link", "A series of links that provide context to this entry.", 0,
1067          java.lang.Integer.MAX_VALUE, link));
1068      childrenList.add(new Property("fullUrl", "uri",
1069          "The Absolute URL for the resource. This must be provided for all resources. The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a version independent reference to the resource.",
1070          0, java.lang.Integer.MAX_VALUE, fullUrl));
1071      childrenList.add(new Property("resource", "Resource", "The Resources for the entry.", 0,
1072          java.lang.Integer.MAX_VALUE, resource));
1073      childrenList.add(
1074          new Property("search", "", "Information about the search process that lead to the creation of this entry.", 0,
1075              java.lang.Integer.MAX_VALUE, search));
1076      childrenList.add(new Property("request", "",
1077          "Additional information about how this entry should be processed as part of a transaction.", 0,
1078          java.lang.Integer.MAX_VALUE, request));
1079      childrenList.add(new Property("response", "",
1080          "Additional information about how this entry should be processed as part of a transaction.", 0,
1081          java.lang.Integer.MAX_VALUE, response));
1082    }
1083
1084    @Override
1085    public void setProperty(String name, Base value) throws FHIRException {
1086      if (name.equals("link"))
1087        this.getLink().add((BundleLinkComponent) value);
1088      else if (name.equals("fullUrl"))
1089        this.fullUrl = castToUri(value); // UriType
1090      else if (name.equals("resource"))
1091        this.resource = castToResource(value); // Resource
1092      else if (name.equals("search"))
1093        this.search = (BundleEntrySearchComponent) value; // BundleEntrySearchComponent
1094      else if (name.equals("request"))
1095        this.request = (BundleEntryRequestComponent) value; // BundleEntryRequestComponent
1096      else if (name.equals("response"))
1097        this.response = (BundleEntryResponseComponent) value; // BundleEntryResponseComponent
1098      else
1099        super.setProperty(name, value);
1100    }
1101
1102    @Override
1103    public Base addChild(String name) throws FHIRException {
1104      if (name.equals("link")) {
1105        return addLink();
1106      } else if (name.equals("fullUrl")) {
1107        throw new FHIRException("Cannot call addChild on a singleton property Bundle.fullUrl");
1108      } else if (name.equals("resource")) {
1109        throw new FHIRException("Cannot call addChild on an abstract type Bundle.resource");
1110      } else if (name.equals("search")) {
1111        this.search = new BundleEntrySearchComponent();
1112        return this.search;
1113      } else if (name.equals("request")) {
1114        this.request = new BundleEntryRequestComponent();
1115        return this.request;
1116      } else if (name.equals("response")) {
1117        this.response = new BundleEntryResponseComponent();
1118        return this.response;
1119      } else
1120        return super.addChild(name);
1121    }
1122
1123    public BundleEntryComponent copy() {
1124      BundleEntryComponent dst = new BundleEntryComponent();
1125      copyValues(dst);
1126      if (link != null) {
1127        dst.link = new ArrayList<BundleLinkComponent>();
1128        for (BundleLinkComponent i : link)
1129          dst.link.add(i.copy());
1130      }
1131      ;
1132      dst.fullUrl = fullUrl == null ? null : fullUrl.copy();
1133      dst.resource = resource == null ? null : resource.copy();
1134      dst.search = search == null ? null : search.copy();
1135      dst.request = request == null ? null : request.copy();
1136      dst.response = response == null ? null : response.copy();
1137      return dst;
1138    }
1139
1140    @Override
1141    public boolean equalsDeep(Base other) {
1142      if (!super.equalsDeep(other))
1143        return false;
1144      if (!(other instanceof BundleEntryComponent))
1145        return false;
1146      BundleEntryComponent o = (BundleEntryComponent) other;
1147      return compareDeep(link, o.link, true) && compareDeep(fullUrl, o.fullUrl, true)
1148          && compareDeep(resource, o.resource, true) && compareDeep(search, o.search, true)
1149          && compareDeep(request, o.request, true) && compareDeep(response, o.response, true);
1150    }
1151
1152    @Override
1153    public boolean equalsShallow(Base other) {
1154      if (!super.equalsShallow(other))
1155        return false;
1156      if (!(other instanceof BundleEntryComponent))
1157        return false;
1158      BundleEntryComponent o = (BundleEntryComponent) other;
1159      return compareValues(fullUrl, o.fullUrl, true);
1160    }
1161
1162    public boolean isEmpty() {
1163      return super.isEmpty() && (link == null || link.isEmpty()) && (fullUrl == null || fullUrl.isEmpty())
1164          && (resource == null || resource.isEmpty()) && (search == null || search.isEmpty())
1165          && (request == null || request.isEmpty()) && (response == null || response.isEmpty());
1166    }
1167
1168    public String fhirType() {
1169      return "Bundle.entry";
1170
1171    }
1172
1173  }
1174
1175  @Block()
1176  public static class BundleEntrySearchComponent extends BackboneElement implements IBaseBackboneElement {
1177    /**
1178     * Why this entry is in the result set - whether it's included as a match or
1179     * because of an _include requirement.
1180     */
1181    @Child(name = "mode", type = { CodeType.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
1182    @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.")
1183    protected Enumeration<SearchEntryMode> mode;
1184
1185    /**
1186     * When searching, the server's search ranking score for the entry.
1187     */
1188    @Child(name = "score", type = { DecimalType.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
1189    @Description(shortDefinition = "Search ranking (between 0 and 1)", formalDefinition = "When searching, the server's search ranking score for the entry.")
1190    protected DecimalType score;
1191
1192    private static final long serialVersionUID = 837739866L;
1193
1194    /*
1195     * Constructor
1196     */
1197    public BundleEntrySearchComponent() {
1198      super();
1199    }
1200
1201    /**
1202     * @return {@link #mode} (Why this entry is in the result set - whether it's
1203     *         included as a match or because of an _include requirement.). This is
1204     *         the underlying object with id, value and extensions. The accessor
1205     *         "getMode" gives direct access to the value
1206     */
1207    public Enumeration<SearchEntryMode> getModeElement() {
1208      if (this.mode == null)
1209        if (Configuration.errorOnAutoCreate())
1210          throw new Error("Attempt to auto-create BundleEntrySearchComponent.mode");
1211        else if (Configuration.doAutoCreate())
1212          this.mode = new Enumeration<SearchEntryMode>(new SearchEntryModeEnumFactory()); // bb
1213      return this.mode;
1214    }
1215
1216    public boolean hasModeElement() {
1217      return this.mode != null && !this.mode.isEmpty();
1218    }
1219
1220    public boolean hasMode() {
1221      return this.mode != null && !this.mode.isEmpty();
1222    }
1223
1224    /**
1225     * @param value {@link #mode} (Why this entry is in the result set - whether
1226     *              it's included as a match or because of an _include
1227     *              requirement.). This is the underlying object with id, value and
1228     *              extensions. The accessor "getMode" gives direct access to the
1229     *              value
1230     */
1231    public BundleEntrySearchComponent setModeElement(Enumeration<SearchEntryMode> value) {
1232      this.mode = value;
1233      return this;
1234    }
1235
1236    /**
1237     * @return Why this entry is in the result set - whether it's included as a
1238     *         match or because of an _include requirement.
1239     */
1240    public SearchEntryMode getMode() {
1241      return this.mode == null ? null : this.mode.getValue();
1242    }
1243
1244    /**
1245     * @param value Why this entry is in the result set - whether it's included as a
1246     *              match or because of an _include requirement.
1247     */
1248    public BundleEntrySearchComponent setMode(SearchEntryMode value) {
1249      if (value == null)
1250        this.mode = null;
1251      else {
1252        if (this.mode == null)
1253          this.mode = new Enumeration<SearchEntryMode>(new SearchEntryModeEnumFactory());
1254        this.mode.setValue(value);
1255      }
1256      return this;
1257    }
1258
1259    /**
1260     * @return {@link #score} (When searching, the server's search ranking score for
1261     *         the entry.). This is the underlying object with id, value and
1262     *         extensions. The accessor "getScore" gives direct access to the value
1263     */
1264    public DecimalType getScoreElement() {
1265      if (this.score == null)
1266        if (Configuration.errorOnAutoCreate())
1267          throw new Error("Attempt to auto-create BundleEntrySearchComponent.score");
1268        else if (Configuration.doAutoCreate())
1269          this.score = new DecimalType(); // bb
1270      return this.score;
1271    }
1272
1273    public boolean hasScoreElement() {
1274      return this.score != null && !this.score.isEmpty();
1275    }
1276
1277    public boolean hasScore() {
1278      return this.score != null && !this.score.isEmpty();
1279    }
1280
1281    /**
1282     * @param value {@link #score} (When searching, the server's search ranking
1283     *              score for the entry.). This is the underlying object with id,
1284     *              value and extensions. The accessor "getScore" gives direct
1285     *              access to the value
1286     */
1287    public BundleEntrySearchComponent setScoreElement(DecimalType value) {
1288      this.score = value;
1289      return this;
1290    }
1291
1292    /**
1293     * @return When searching, the server's search ranking score for the entry.
1294     */
1295    public BigDecimal getScore() {
1296      return this.score == null ? null : this.score.getValue();
1297    }
1298
1299    /**
1300     * @param value When searching, the server's search ranking score for the entry.
1301     */
1302    public BundleEntrySearchComponent setScore(BigDecimal value) {
1303      if (value == null)
1304        this.score = null;
1305      else {
1306        if (this.score == null)
1307          this.score = new DecimalType();
1308        this.score.setValue(value);
1309      }
1310      return this;
1311    }
1312
1313    protected void listChildren(List<Property> childrenList) {
1314      super.listChildren(childrenList);
1315      childrenList.add(new Property("mode", "code",
1316          "Why this entry is in the result set - whether it's included as a match or because of an _include requirement.",
1317          0, java.lang.Integer.MAX_VALUE, mode));
1318      childrenList.add(new Property("score", "decimal",
1319          "When searching, the server's search ranking score for the entry.", 0, java.lang.Integer.MAX_VALUE, score));
1320    }
1321
1322    @Override
1323    public void setProperty(String name, Base value) throws FHIRException {
1324      if (name.equals("mode"))
1325        this.mode = new SearchEntryModeEnumFactory().fromType(value); // Enumeration<SearchEntryMode>
1326      else if (name.equals("score"))
1327        this.score = castToDecimal(value); // DecimalType
1328      else
1329        super.setProperty(name, value);
1330    }
1331
1332    @Override
1333    public Base addChild(String name) throws FHIRException {
1334      if (name.equals("mode")) {
1335        throw new FHIRException("Cannot call addChild on a singleton property Bundle.mode");
1336      } else if (name.equals("score")) {
1337        throw new FHIRException("Cannot call addChild on a singleton property Bundle.score");
1338      } else
1339        return super.addChild(name);
1340    }
1341
1342    public BundleEntrySearchComponent copy() {
1343      BundleEntrySearchComponent dst = new BundleEntrySearchComponent();
1344      copyValues(dst);
1345      dst.mode = mode == null ? null : mode.copy();
1346      dst.score = score == null ? null : score.copy();
1347      return dst;
1348    }
1349
1350    @Override
1351    public boolean equalsDeep(Base other) {
1352      if (!super.equalsDeep(other))
1353        return false;
1354      if (!(other instanceof BundleEntrySearchComponent))
1355        return false;
1356      BundleEntrySearchComponent o = (BundleEntrySearchComponent) other;
1357      return compareDeep(mode, o.mode, true) && compareDeep(score, o.score, true);
1358    }
1359
1360    @Override
1361    public boolean equalsShallow(Base other) {
1362      if (!super.equalsShallow(other))
1363        return false;
1364      if (!(other instanceof BundleEntrySearchComponent))
1365        return false;
1366      BundleEntrySearchComponent o = (BundleEntrySearchComponent) other;
1367      return compareValues(mode, o.mode, true) && compareValues(score, o.score, true);
1368    }
1369
1370    public boolean isEmpty() {
1371      return super.isEmpty() && (mode == null || mode.isEmpty()) && (score == null || score.isEmpty());
1372    }
1373
1374    public String fhirType() {
1375      return "Bundle.entry.search";
1376
1377    }
1378
1379  }
1380
1381  @Block()
1382  public static class BundleEntryRequestComponent extends BackboneElement implements IBaseBackboneElement {
1383    /**
1384     * The HTTP verb for this entry in either a update history, or a transaction/
1385     * transaction response.
1386     */
1387    @Child(name = "method", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
1388    @Description(shortDefinition = "GET | POST | PUT | DELETE", formalDefinition = "The HTTP verb for this entry in either a update history, or a transaction/ transaction response.")
1389    protected Enumeration<HTTPVerb> method;
1390
1391    /**
1392     * The URL for this entry, relative to the root (the address to which the
1393     * request is posted).
1394     */
1395    @Child(name = "url", type = { UriType.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
1396    @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).")
1397    protected UriType url;
1398
1399    /**
1400     * If the ETag values match, return a 304 Not modified status. See the API
1401     * documentation for ["Conditional Read"](http.html#cread).
1402     */
1403    @Child(name = "ifNoneMatch", type = {
1404        StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
1405    @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).")
1406    protected StringType ifNoneMatch;
1407
1408    /**
1409     * Only perform the operation if the last updated date matches. See the API
1410     * documentation for ["Conditional Read"](http.html#cread).
1411     */
1412    @Child(name = "ifModifiedSince", type = {
1413        InstantType.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
1414    @Description(shortDefinition = "For managing update contention", formalDefinition = "Only perform the operation if the last updated date matches. See the API documentation for [\"Conditional Read\"](http.html#cread).")
1415    protected InstantType ifModifiedSince;
1416
1417    /**
1418     * Only perform the operation if the Etag value matches. For more information,
1419     * see the API section ["Managing Resource Contention"](http.html#concurrency).
1420     */
1421    @Child(name = "ifMatch", type = { StringType.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
1422    @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).")
1423    protected StringType ifMatch;
1424
1425    /**
1426     * Instruct the server not to perform the create if a specified resource already
1427     * exists. For further information, see the API documentation for ["Conditional
1428     * Create"](http.html#ccreate). This is just the query portion of the URL - what
1429     * follows the "?" (not including the "?").
1430     */
1431    @Child(name = "ifNoneExist", type = {
1432        StringType.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
1433    @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 \"?\").")
1434    protected StringType ifNoneExist;
1435
1436    private static final long serialVersionUID = -1349769744L;
1437
1438    /*
1439     * Constructor
1440     */
1441    public BundleEntryRequestComponent() {
1442      super();
1443    }
1444
1445    /*
1446     * Constructor
1447     */
1448    public BundleEntryRequestComponent(Enumeration<HTTPVerb> method, UriType url) {
1449      super();
1450      this.method = method;
1451      this.url = url;
1452    }
1453
1454    /**
1455     * @return {@link #method} (The HTTP verb for this entry in either a update
1456     *         history, or a transaction/ transaction response.). This is the
1457     *         underlying object with id, value and extensions. The accessor
1458     *         "getMethod" gives direct access to the value
1459     */
1460    public Enumeration<HTTPVerb> getMethodElement() {
1461      if (this.method == null)
1462        if (Configuration.errorOnAutoCreate())
1463          throw new Error("Attempt to auto-create BundleEntryRequestComponent.method");
1464        else if (Configuration.doAutoCreate())
1465          this.method = new Enumeration<HTTPVerb>(new HTTPVerbEnumFactory()); // bb
1466      return this.method;
1467    }
1468
1469    public boolean hasMethodElement() {
1470      return this.method != null && !this.method.isEmpty();
1471    }
1472
1473    public boolean hasMethod() {
1474      return this.method != null && !this.method.isEmpty();
1475    }
1476
1477    /**
1478     * @param value {@link #method} (The HTTP verb for this entry in either a update
1479     *              history, or a transaction/ transaction response.). This is the
1480     *              underlying object with id, value and extensions. The accessor
1481     *              "getMethod" gives direct access to the value
1482     */
1483    public BundleEntryRequestComponent setMethodElement(Enumeration<HTTPVerb> value) {
1484      this.method = value;
1485      return this;
1486    }
1487
1488    /**
1489     * @return The HTTP verb for this entry in either a update history, or a
1490     *         transaction/ transaction response.
1491     */
1492    public HTTPVerb getMethod() {
1493      return this.method == null ? null : this.method.getValue();
1494    }
1495
1496    /**
1497     * @param value The HTTP verb for this entry in either a update history, or a
1498     *              transaction/ transaction response.
1499     */
1500    public BundleEntryRequestComponent setMethod(HTTPVerb value) {
1501      if (this.method == null)
1502        this.method = new Enumeration<HTTPVerb>(new HTTPVerbEnumFactory());
1503      this.method.setValue(value);
1504      return this;
1505    }
1506
1507    /**
1508     * @return {@link #url} (The URL for this entry, relative to the root (the
1509     *         address to which the request is posted).). This is the underlying
1510     *         object with id, value and extensions. The accessor "getUrl" gives
1511     *         direct access to the value
1512     */
1513    public UriType getUrlElement() {
1514      if (this.url == null)
1515        if (Configuration.errorOnAutoCreate())
1516          throw new Error("Attempt to auto-create BundleEntryRequestComponent.url");
1517        else if (Configuration.doAutoCreate())
1518          this.url = new UriType(); // bb
1519      return this.url;
1520    }
1521
1522    public boolean hasUrlElement() {
1523      return this.url != null && !this.url.isEmpty();
1524    }
1525
1526    public boolean hasUrl() {
1527      return this.url != null && !this.url.isEmpty();
1528    }
1529
1530    /**
1531     * @param value {@link #url} (The URL for this entry, relative to the root (the
1532     *              address to which the request is posted).). This is the
1533     *              underlying object with id, value and extensions. The accessor
1534     *              "getUrl" gives direct access to the value
1535     */
1536    public BundleEntryRequestComponent setUrlElement(UriType value) {
1537      this.url = value;
1538      return this;
1539    }
1540
1541    /**
1542     * @return The URL for this entry, relative to the root (the address to which
1543     *         the request is posted).
1544     */
1545    public String getUrl() {
1546      return this.url == null ? null : this.url.getValue();
1547    }
1548
1549    /**
1550     * @param value The URL for this entry, relative to the root (the address to
1551     *              which the request is posted).
1552     */
1553    public BundleEntryRequestComponent setUrl(String value) {
1554      if (this.url == null)
1555        this.url = new UriType();
1556      this.url.setValue(value);
1557      return this;
1558    }
1559
1560    /**
1561     * @return {@link #ifNoneMatch} (If the ETag values match, return a 304 Not
1562     *         modified status. See the API documentation for ["Conditional
1563     *         Read"](http.html#cread).). This is the underlying object with id,
1564     *         value and extensions. The accessor "getIfNoneMatch" gives direct
1565     *         access to the value
1566     */
1567    public StringType getIfNoneMatchElement() {
1568      if (this.ifNoneMatch == null)
1569        if (Configuration.errorOnAutoCreate())
1570          throw new Error("Attempt to auto-create BundleEntryRequestComponent.ifNoneMatch");
1571        else if (Configuration.doAutoCreate())
1572          this.ifNoneMatch = new StringType(); // bb
1573      return this.ifNoneMatch;
1574    }
1575
1576    public boolean hasIfNoneMatchElement() {
1577      return this.ifNoneMatch != null && !this.ifNoneMatch.isEmpty();
1578    }
1579
1580    public boolean hasIfNoneMatch() {
1581      return this.ifNoneMatch != null && !this.ifNoneMatch.isEmpty();
1582    }
1583
1584    /**
1585     * @param value {@link #ifNoneMatch} (If the ETag values match, return a 304 Not
1586     *              modified status. See the API documentation for ["Conditional
1587     *              Read"](http.html#cread).). This is the underlying object with
1588     *              id, value and extensions. The accessor "getIfNoneMatch" gives
1589     *              direct access to the value
1590     */
1591    public BundleEntryRequestComponent setIfNoneMatchElement(StringType value) {
1592      this.ifNoneMatch = value;
1593      return this;
1594    }
1595
1596    /**
1597     * @return If the ETag values match, return a 304 Not modified status. See the
1598     *         API documentation for ["Conditional Read"](http.html#cread).
1599     */
1600    public String getIfNoneMatch() {
1601      return this.ifNoneMatch == null ? null : this.ifNoneMatch.getValue();
1602    }
1603
1604    /**
1605     * @param value If the ETag values match, return a 304 Not modified status. See
1606     *              the API documentation for ["Conditional Read"](http.html#cread).
1607     */
1608    public BundleEntryRequestComponent setIfNoneMatch(String value) {
1609      if (Utilities.noString(value))
1610        this.ifNoneMatch = null;
1611      else {
1612        if (this.ifNoneMatch == null)
1613          this.ifNoneMatch = new StringType();
1614        this.ifNoneMatch.setValue(value);
1615      }
1616      return this;
1617    }
1618
1619    /**
1620     * @return {@link #ifModifiedSince} (Only perform the operation if the last
1621     *         updated date matches. See the API documentation for ["Conditional
1622     *         Read"](http.html#cread).). This is the underlying object with id,
1623     *         value and extensions. The accessor "getIfModifiedSince" gives direct
1624     *         access to the value
1625     */
1626    public InstantType getIfModifiedSinceElement() {
1627      if (this.ifModifiedSince == null)
1628        if (Configuration.errorOnAutoCreate())
1629          throw new Error("Attempt to auto-create BundleEntryRequestComponent.ifModifiedSince");
1630        else if (Configuration.doAutoCreate())
1631          this.ifModifiedSince = new InstantType(); // bb
1632      return this.ifModifiedSince;
1633    }
1634
1635    public boolean hasIfModifiedSinceElement() {
1636      return this.ifModifiedSince != null && !this.ifModifiedSince.isEmpty();
1637    }
1638
1639    public boolean hasIfModifiedSince() {
1640      return this.ifModifiedSince != null && !this.ifModifiedSince.isEmpty();
1641    }
1642
1643    /**
1644     * @param value {@link #ifModifiedSince} (Only perform the operation if the last
1645     *              updated date matches. See the API documentation for
1646     *              ["Conditional Read"](http.html#cread).). This is the underlying
1647     *              object with id, value and extensions. The accessor
1648     *              "getIfModifiedSince" gives direct access to the value
1649     */
1650    public BundleEntryRequestComponent setIfModifiedSinceElement(InstantType value) {
1651      this.ifModifiedSince = value;
1652      return this;
1653    }
1654
1655    /**
1656     * @return Only perform the operation if the last updated date matches. See the
1657     *         API documentation for ["Conditional Read"](http.html#cread).
1658     */
1659    public Date getIfModifiedSince() {
1660      return this.ifModifiedSince == null ? null : this.ifModifiedSince.getValue();
1661    }
1662
1663    /**
1664     * @param value Only perform the operation if the last updated date matches. See
1665     *              the API documentation for ["Conditional Read"](http.html#cread).
1666     */
1667    public BundleEntryRequestComponent setIfModifiedSince(Date value) {
1668      if (value == null)
1669        this.ifModifiedSince = null;
1670      else {
1671        if (this.ifModifiedSince == null)
1672          this.ifModifiedSince = new InstantType();
1673        this.ifModifiedSince.setValue(value);
1674      }
1675      return this;
1676    }
1677
1678    /**
1679     * @return {@link #ifMatch} (Only perform the operation if the Etag value
1680     *         matches. For more information, see the API section ["Managing
1681     *         Resource Contention"](http.html#concurrency).). This is the
1682     *         underlying object with id, value and extensions. The accessor
1683     *         "getIfMatch" gives direct access to the value
1684     */
1685    public StringType getIfMatchElement() {
1686      if (this.ifMatch == null)
1687        if (Configuration.errorOnAutoCreate())
1688          throw new Error("Attempt to auto-create BundleEntryRequestComponent.ifMatch");
1689        else if (Configuration.doAutoCreate())
1690          this.ifMatch = new StringType(); // bb
1691      return this.ifMatch;
1692    }
1693
1694    public boolean hasIfMatchElement() {
1695      return this.ifMatch != null && !this.ifMatch.isEmpty();
1696    }
1697
1698    public boolean hasIfMatch() {
1699      return this.ifMatch != null && !this.ifMatch.isEmpty();
1700    }
1701
1702    /**
1703     * @param value {@link #ifMatch} (Only perform the operation if the Etag value
1704     *              matches. For more information, see the API section ["Managing
1705     *              Resource Contention"](http.html#concurrency).). This is the
1706     *              underlying object with id, value and extensions. The accessor
1707     *              "getIfMatch" gives direct access to the value
1708     */
1709    public BundleEntryRequestComponent setIfMatchElement(StringType value) {
1710      this.ifMatch = value;
1711      return this;
1712    }
1713
1714    /**
1715     * @return Only perform the operation if the Etag value matches. For more
1716     *         information, see the API section ["Managing Resource
1717     *         Contention"](http.html#concurrency).
1718     */
1719    public String getIfMatch() {
1720      return this.ifMatch == null ? null : this.ifMatch.getValue();
1721    }
1722
1723    /**
1724     * @param value Only perform the operation if the Etag value matches. For more
1725     *              information, see the API section ["Managing Resource
1726     *              Contention"](http.html#concurrency).
1727     */
1728    public BundleEntryRequestComponent setIfMatch(String value) {
1729      if (Utilities.noString(value))
1730        this.ifMatch = null;
1731      else {
1732        if (this.ifMatch == null)
1733          this.ifMatch = new StringType();
1734        this.ifMatch.setValue(value);
1735      }
1736      return this;
1737    }
1738
1739    /**
1740     * @return {@link #ifNoneExist} (Instruct the server not to perform the create
1741     *         if a specified resource already exists. For further information, see
1742     *         the API documentation for ["Conditional Create"](http.html#ccreate).
1743     *         This is just the query portion of the URL - what follows the "?" (not
1744     *         including the "?").). This is the underlying object with id, value
1745     *         and extensions. The accessor "getIfNoneExist" gives direct access to
1746     *         the value
1747     */
1748    public StringType getIfNoneExistElement() {
1749      if (this.ifNoneExist == null)
1750        if (Configuration.errorOnAutoCreate())
1751          throw new Error("Attempt to auto-create BundleEntryRequestComponent.ifNoneExist");
1752        else if (Configuration.doAutoCreate())
1753          this.ifNoneExist = new StringType(); // bb
1754      return this.ifNoneExist;
1755    }
1756
1757    public boolean hasIfNoneExistElement() {
1758      return this.ifNoneExist != null && !this.ifNoneExist.isEmpty();
1759    }
1760
1761    public boolean hasIfNoneExist() {
1762      return this.ifNoneExist != null && !this.ifNoneExist.isEmpty();
1763    }
1764
1765    /**
1766     * @param value {@link #ifNoneExist} (Instruct the server not to perform the
1767     *              create if a specified resource already exists. For further
1768     *              information, see the API documentation for ["Conditional
1769     *              Create"](http.html#ccreate). This is just the query portion of
1770     *              the URL - what follows the "?" (not including the "?").). This
1771     *              is the underlying object with id, value and extensions. The
1772     *              accessor "getIfNoneExist" gives direct access to the value
1773     */
1774    public BundleEntryRequestComponent setIfNoneExistElement(StringType value) {
1775      this.ifNoneExist = value;
1776      return this;
1777    }
1778
1779    /**
1780     * @return Instruct the server not to perform the create if a specified resource
1781     *         already exists. For further information, see the API documentation
1782     *         for ["Conditional Create"](http.html#ccreate). This is just the query
1783     *         portion of the URL - what follows the "?" (not including the "?").
1784     */
1785    public String getIfNoneExist() {
1786      return this.ifNoneExist == null ? null : this.ifNoneExist.getValue();
1787    }
1788
1789    /**
1790     * @param value Instruct the server not to perform the create if a specified
1791     *              resource already exists. For further information, see the API
1792     *              documentation for ["Conditional Create"](http.html#ccreate).
1793     *              This is just the query portion of the URL - what follows the "?"
1794     *              (not including the "?").
1795     */
1796    public BundleEntryRequestComponent setIfNoneExist(String value) {
1797      if (Utilities.noString(value))
1798        this.ifNoneExist = null;
1799      else {
1800        if (this.ifNoneExist == null)
1801          this.ifNoneExist = new StringType();
1802        this.ifNoneExist.setValue(value);
1803      }
1804      return this;
1805    }
1806
1807    protected void listChildren(List<Property> childrenList) {
1808      super.listChildren(childrenList);
1809      childrenList.add(new Property("method", "code",
1810          "The HTTP verb for this entry in either a update history, or a transaction/ transaction response.", 0,
1811          java.lang.Integer.MAX_VALUE, method));
1812      childrenList.add(new Property("url", "uri",
1813          "The URL for this entry, relative to the root (the address to which the request is posted).", 0,
1814          java.lang.Integer.MAX_VALUE, url));
1815      childrenList.add(new Property("ifNoneMatch", "string",
1816          "If the ETag values match, return a 304 Not modified status. See the API documentation for [\"Conditional Read\"](http.html#cread).",
1817          0, java.lang.Integer.MAX_VALUE, ifNoneMatch));
1818      childrenList.add(new Property("ifModifiedSince", "instant",
1819          "Only perform the operation if the last updated date matches. See the API documentation for [\"Conditional Read\"](http.html#cread).",
1820          0, java.lang.Integer.MAX_VALUE, ifModifiedSince));
1821      childrenList.add(new Property("ifMatch", "string",
1822          "Only perform the operation if the Etag value matches. For more information, see the API section [\"Managing Resource Contention\"](http.html#concurrency).",
1823          0, java.lang.Integer.MAX_VALUE, ifMatch));
1824      childrenList.add(new Property("ifNoneExist", "string",
1825          "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 \"?\").",
1826          0, java.lang.Integer.MAX_VALUE, ifNoneExist));
1827    }
1828
1829    @Override
1830    public void setProperty(String name, Base value) throws FHIRException {
1831      if (name.equals("method"))
1832        this.method = new HTTPVerbEnumFactory().fromType(value); // Enumeration<HTTPVerb>
1833      else if (name.equals("url"))
1834        this.url = castToUri(value); // UriType
1835      else if (name.equals("ifNoneMatch"))
1836        this.ifNoneMatch = castToString(value); // StringType
1837      else if (name.equals("ifModifiedSince"))
1838        this.ifModifiedSince = castToInstant(value); // InstantType
1839      else if (name.equals("ifMatch"))
1840        this.ifMatch = castToString(value); // StringType
1841      else if (name.equals("ifNoneExist"))
1842        this.ifNoneExist = castToString(value); // StringType
1843      else
1844        super.setProperty(name, value);
1845    }
1846
1847    @Override
1848    public Base addChild(String name) throws FHIRException {
1849      if (name.equals("method")) {
1850        throw new FHIRException("Cannot call addChild on a singleton property Bundle.method");
1851      } else if (name.equals("url")) {
1852        throw new FHIRException("Cannot call addChild on a singleton property Bundle.url");
1853      } else if (name.equals("ifNoneMatch")) {
1854        throw new FHIRException("Cannot call addChild on a singleton property Bundle.ifNoneMatch");
1855      } else if (name.equals("ifModifiedSince")) {
1856        throw new FHIRException("Cannot call addChild on a singleton property Bundle.ifModifiedSince");
1857      } else if (name.equals("ifMatch")) {
1858        throw new FHIRException("Cannot call addChild on a singleton property Bundle.ifMatch");
1859      } else if (name.equals("ifNoneExist")) {
1860        throw new FHIRException("Cannot call addChild on a singleton property Bundle.ifNoneExist");
1861      } else
1862        return super.addChild(name);
1863    }
1864
1865    public BundleEntryRequestComponent copy() {
1866      BundleEntryRequestComponent dst = new BundleEntryRequestComponent();
1867      copyValues(dst);
1868      dst.method = method == null ? null : method.copy();
1869      dst.url = url == null ? null : url.copy();
1870      dst.ifNoneMatch = ifNoneMatch == null ? null : ifNoneMatch.copy();
1871      dst.ifModifiedSince = ifModifiedSince == null ? null : ifModifiedSince.copy();
1872      dst.ifMatch = ifMatch == null ? null : ifMatch.copy();
1873      dst.ifNoneExist = ifNoneExist == null ? null : ifNoneExist.copy();
1874      return dst;
1875    }
1876
1877    @Override
1878    public boolean equalsDeep(Base other) {
1879      if (!super.equalsDeep(other))
1880        return false;
1881      if (!(other instanceof BundleEntryRequestComponent))
1882        return false;
1883      BundleEntryRequestComponent o = (BundleEntryRequestComponent) other;
1884      return compareDeep(method, o.method, true) && compareDeep(url, o.url, true)
1885          && compareDeep(ifNoneMatch, o.ifNoneMatch, true) && compareDeep(ifModifiedSince, o.ifModifiedSince, true)
1886          && compareDeep(ifMatch, o.ifMatch, true) && compareDeep(ifNoneExist, o.ifNoneExist, true);
1887    }
1888
1889    @Override
1890    public boolean equalsShallow(Base other) {
1891      if (!super.equalsShallow(other))
1892        return false;
1893      if (!(other instanceof BundleEntryRequestComponent))
1894        return false;
1895      BundleEntryRequestComponent o = (BundleEntryRequestComponent) other;
1896      return compareValues(method, o.method, true) && compareValues(url, o.url, true)
1897          && compareValues(ifNoneMatch, o.ifNoneMatch, true) && compareValues(ifModifiedSince, o.ifModifiedSince, true)
1898          && compareValues(ifMatch, o.ifMatch, true) && compareValues(ifNoneExist, o.ifNoneExist, true);
1899    }
1900
1901    public boolean isEmpty() {
1902      return super.isEmpty() && (method == null || method.isEmpty()) && (url == null || url.isEmpty())
1903          && (ifNoneMatch == null || ifNoneMatch.isEmpty()) && (ifModifiedSince == null || ifModifiedSince.isEmpty())
1904          && (ifMatch == null || ifMatch.isEmpty()) && (ifNoneExist == null || ifNoneExist.isEmpty());
1905    }
1906
1907    public String fhirType() {
1908      return "Bundle.entry.request";
1909
1910    }
1911
1912  }
1913
1914  @Block()
1915  public static class BundleEntryResponseComponent extends BackboneElement implements IBaseBackboneElement {
1916    /**
1917     * The status code returned by processing this entry.
1918     */
1919    @Child(name = "status", type = { StringType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
1920    @Description(shortDefinition = "Status return code for entry", formalDefinition = "The status code returned by processing this entry.")
1921    protected StringType status;
1922
1923    /**
1924     * The location header created by processing this operation.
1925     */
1926    @Child(name = "location", type = { UriType.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
1927    @Description(shortDefinition = "The location, if the operation returns a location", formalDefinition = "The location header created by processing this operation.")
1928    protected UriType location;
1929
1930    /**
1931     * The etag for the resource, it the operation for the entry produced a
1932     * versioned resource.
1933     */
1934    @Child(name = "etag", type = { StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
1935    @Description(shortDefinition = "The etag for the resource (if relevant)", formalDefinition = "The etag for the resource, it the operation for the entry produced a versioned resource.")
1936    protected StringType etag;
1937
1938    /**
1939     * The date/time that the resource was modified on the server.
1940     */
1941    @Child(name = "lastModified", type = {
1942        InstantType.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
1943    @Description(shortDefinition = "Server's date time modified", formalDefinition = "The date/time that the resource was modified on the server.")
1944    protected InstantType lastModified;
1945
1946    private static final long serialVersionUID = -1526413234L;
1947
1948    /*
1949     * Constructor
1950     */
1951    public BundleEntryResponseComponent() {
1952      super();
1953    }
1954
1955    /*
1956     * Constructor
1957     */
1958    public BundleEntryResponseComponent(StringType status) {
1959      super();
1960      this.status = status;
1961    }
1962
1963    /**
1964     * @return {@link #status} (The status code returned by processing this entry.).
1965     *         This is the underlying object with id, value and extensions. The
1966     *         accessor "getStatus" gives direct access to the value
1967     */
1968    public StringType getStatusElement() {
1969      if (this.status == null)
1970        if (Configuration.errorOnAutoCreate())
1971          throw new Error("Attempt to auto-create BundleEntryResponseComponent.status");
1972        else if (Configuration.doAutoCreate())
1973          this.status = new StringType(); // bb
1974      return this.status;
1975    }
1976
1977    public boolean hasStatusElement() {
1978      return this.status != null && !this.status.isEmpty();
1979    }
1980
1981    public boolean hasStatus() {
1982      return this.status != null && !this.status.isEmpty();
1983    }
1984
1985    /**
1986     * @param value {@link #status} (The status code returned by processing this
1987     *              entry.). This is the underlying object with id, value and
1988     *              extensions. The accessor "getStatus" gives direct access to the
1989     *              value
1990     */
1991    public BundleEntryResponseComponent setStatusElement(StringType value) {
1992      this.status = value;
1993      return this;
1994    }
1995
1996    /**
1997     * @return The status code returned by processing this entry.
1998     */
1999    public String getStatus() {
2000      return this.status == null ? null : this.status.getValue();
2001    }
2002
2003    /**
2004     * @param value The status code returned by processing this entry.
2005     */
2006    public BundleEntryResponseComponent setStatus(String value) {
2007      if (this.status == null)
2008        this.status = new StringType();
2009      this.status.setValue(value);
2010      return this;
2011    }
2012
2013    /**
2014     * @return {@link #location} (The location header created by processing this
2015     *         operation.). This is the underlying object with id, value and
2016     *         extensions. The accessor "getLocation" gives direct access to the
2017     *         value
2018     */
2019    public UriType getLocationElement() {
2020      if (this.location == null)
2021        if (Configuration.errorOnAutoCreate())
2022          throw new Error("Attempt to auto-create BundleEntryResponseComponent.location");
2023        else if (Configuration.doAutoCreate())
2024          this.location = new UriType(); // bb
2025      return this.location;
2026    }
2027
2028    public boolean hasLocationElement() {
2029      return this.location != null && !this.location.isEmpty();
2030    }
2031
2032    public boolean hasLocation() {
2033      return this.location != null && !this.location.isEmpty();
2034    }
2035
2036    /**
2037     * @param value {@link #location} (The location header created by processing
2038     *              this operation.). This is the underlying object with id, value
2039     *              and extensions. The accessor "getLocation" gives direct access
2040     *              to the value
2041     */
2042    public BundleEntryResponseComponent setLocationElement(UriType value) {
2043      this.location = value;
2044      return this;
2045    }
2046
2047    /**
2048     * @return The location header created by processing this operation.
2049     */
2050    public String getLocation() {
2051      return this.location == null ? null : this.location.getValue();
2052    }
2053
2054    /**
2055     * @param value The location header created by processing this operation.
2056     */
2057    public BundleEntryResponseComponent setLocation(String value) {
2058      if (Utilities.noString(value))
2059        this.location = null;
2060      else {
2061        if (this.location == null)
2062          this.location = new UriType();
2063        this.location.setValue(value);
2064      }
2065      return this;
2066    }
2067
2068    /**
2069     * @return {@link #etag} (The etag for the resource, it the operation for the
2070     *         entry produced a versioned resource.). This is the underlying object
2071     *         with id, value and extensions. The accessor "getEtag" gives direct
2072     *         access to the value
2073     */
2074    public StringType getEtagElement() {
2075      if (this.etag == null)
2076        if (Configuration.errorOnAutoCreate())
2077          throw new Error("Attempt to auto-create BundleEntryResponseComponent.etag");
2078        else if (Configuration.doAutoCreate())
2079          this.etag = new StringType(); // bb
2080      return this.etag;
2081    }
2082
2083    public boolean hasEtagElement() {
2084      return this.etag != null && !this.etag.isEmpty();
2085    }
2086
2087    public boolean hasEtag() {
2088      return this.etag != null && !this.etag.isEmpty();
2089    }
2090
2091    /**
2092     * @param value {@link #etag} (The etag for the resource, it the operation for
2093     *              the entry produced a versioned resource.). This is the
2094     *              underlying object with id, value and extensions. The accessor
2095     *              "getEtag" gives direct access to the value
2096     */
2097    public BundleEntryResponseComponent setEtagElement(StringType value) {
2098      this.etag = value;
2099      return this;
2100    }
2101
2102    /**
2103     * @return The etag for the resource, it the operation for the entry produced a
2104     *         versioned resource.
2105     */
2106    public String getEtag() {
2107      return this.etag == null ? null : this.etag.getValue();
2108    }
2109
2110    /**
2111     * @param value The etag for the resource, it the operation for the entry
2112     *              produced a versioned resource.
2113     */
2114    public BundleEntryResponseComponent setEtag(String value) {
2115      if (Utilities.noString(value))
2116        this.etag = null;
2117      else {
2118        if (this.etag == null)
2119          this.etag = new StringType();
2120        this.etag.setValue(value);
2121      }
2122      return this;
2123    }
2124
2125    /**
2126     * @return {@link #lastModified} (The date/time that the resource was modified
2127     *         on the server.). This is the underlying object with id, value and
2128     *         extensions. The accessor "getLastModified" gives direct access to the
2129     *         value
2130     */
2131    public InstantType getLastModifiedElement() {
2132      if (this.lastModified == null)
2133        if (Configuration.errorOnAutoCreate())
2134          throw new Error("Attempt to auto-create BundleEntryResponseComponent.lastModified");
2135        else if (Configuration.doAutoCreate())
2136          this.lastModified = new InstantType(); // bb
2137      return this.lastModified;
2138    }
2139
2140    public boolean hasLastModifiedElement() {
2141      return this.lastModified != null && !this.lastModified.isEmpty();
2142    }
2143
2144    public boolean hasLastModified() {
2145      return this.lastModified != null && !this.lastModified.isEmpty();
2146    }
2147
2148    /**
2149     * @param value {@link #lastModified} (The date/time that the resource was
2150     *              modified on the server.). This is the underlying object with id,
2151     *              value and extensions. The accessor "getLastModified" gives
2152     *              direct access to the value
2153     */
2154    public BundleEntryResponseComponent setLastModifiedElement(InstantType value) {
2155      this.lastModified = value;
2156      return this;
2157    }
2158
2159    /**
2160     * @return The date/time that the resource was modified on the server.
2161     */
2162    public Date getLastModified() {
2163      return this.lastModified == null ? null : this.lastModified.getValue();
2164    }
2165
2166    /**
2167     * @param value The date/time that the resource was modified on the server.
2168     */
2169    public BundleEntryResponseComponent setLastModified(Date value) {
2170      if (value == null)
2171        this.lastModified = null;
2172      else {
2173        if (this.lastModified == null)
2174          this.lastModified = new InstantType();
2175        this.lastModified.setValue(value);
2176      }
2177      return this;
2178    }
2179
2180    protected void listChildren(List<Property> childrenList) {
2181      super.listChildren(childrenList);
2182      childrenList.add(new Property("status", "string", "The status code returned by processing this entry.", 0,
2183          java.lang.Integer.MAX_VALUE, status));
2184      childrenList.add(new Property("location", "uri", "The location header created by processing this operation.", 0,
2185          java.lang.Integer.MAX_VALUE, location));
2186      childrenList.add(new Property("etag", "string",
2187          "The etag for the resource, it the operation for the entry produced a versioned resource.", 0,
2188          java.lang.Integer.MAX_VALUE, etag));
2189      childrenList.add(new Property("lastModified", "instant",
2190          "The date/time that the resource was modified on the server.", 0, java.lang.Integer.MAX_VALUE, lastModified));
2191    }
2192
2193    @Override
2194    public void setProperty(String name, Base value) throws FHIRException {
2195      if (name.equals("status"))
2196        this.status = castToString(value); // StringType
2197      else if (name.equals("location"))
2198        this.location = castToUri(value); // UriType
2199      else if (name.equals("etag"))
2200        this.etag = castToString(value); // StringType
2201      else if (name.equals("lastModified"))
2202        this.lastModified = castToInstant(value); // InstantType
2203      else
2204        super.setProperty(name, value);
2205    }
2206
2207    @Override
2208    public Base addChild(String name) throws FHIRException {
2209      if (name.equals("status")) {
2210        throw new FHIRException("Cannot call addChild on a singleton property Bundle.status");
2211      } else if (name.equals("location")) {
2212        throw new FHIRException("Cannot call addChild on a singleton property Bundle.location");
2213      } else if (name.equals("etag")) {
2214        throw new FHIRException("Cannot call addChild on a singleton property Bundle.etag");
2215      } else if (name.equals("lastModified")) {
2216        throw new FHIRException("Cannot call addChild on a singleton property Bundle.lastModified");
2217      } else
2218        return super.addChild(name);
2219    }
2220
2221    public BundleEntryResponseComponent copy() {
2222      BundleEntryResponseComponent dst = new BundleEntryResponseComponent();
2223      copyValues(dst);
2224      dst.status = status == null ? null : status.copy();
2225      dst.location = location == null ? null : location.copy();
2226      dst.etag = etag == null ? null : etag.copy();
2227      dst.lastModified = lastModified == null ? null : lastModified.copy();
2228      return dst;
2229    }
2230
2231    @Override
2232    public boolean equalsDeep(Base other) {
2233      if (!super.equalsDeep(other))
2234        return false;
2235      if (!(other instanceof BundleEntryResponseComponent))
2236        return false;
2237      BundleEntryResponseComponent o = (BundleEntryResponseComponent) other;
2238      return compareDeep(status, o.status, true) && compareDeep(location, o.location, true)
2239          && compareDeep(etag, o.etag, true) && compareDeep(lastModified, o.lastModified, true);
2240    }
2241
2242    @Override
2243    public boolean equalsShallow(Base other) {
2244      if (!super.equalsShallow(other))
2245        return false;
2246      if (!(other instanceof BundleEntryResponseComponent))
2247        return false;
2248      BundleEntryResponseComponent o = (BundleEntryResponseComponent) other;
2249      return compareValues(status, o.status, true) && compareValues(location, o.location, true)
2250          && compareValues(etag, o.etag, true) && compareValues(lastModified, o.lastModified, true);
2251    }
2252
2253    public boolean isEmpty() {
2254      return super.isEmpty() && (status == null || status.isEmpty()) && (location == null || location.isEmpty())
2255          && (etag == null || etag.isEmpty()) && (lastModified == null || lastModified.isEmpty());
2256    }
2257
2258    public String fhirType() {
2259      return "Bundle.entry.response";
2260
2261    }
2262
2263  }
2264
2265  /**
2266   * Indicates the purpose of this bundle- how it was intended to be used.
2267   */
2268  @Child(name = "type", type = { CodeType.class }, order = 0, min = 1, max = 1, modifier = false, summary = true)
2269  @Description(shortDefinition = "document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection", formalDefinition = "Indicates the purpose of this bundle- how it was intended to be used.")
2270  protected Enumeration<BundleType> type;
2271
2272  /**
2273   * If a set of search matches, this is the total number of matches for the
2274   * search (as opposed to the number of results in this bundle).
2275   */
2276  @Child(name = "total", type = {
2277      UnsignedIntType.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
2278  @Description(shortDefinition = "If search, the total number of matches", formalDefinition = "If a set of search matches, this is the total number of matches for the search (as opposed to the number of results in this bundle).")
2279  protected UnsignedIntType total;
2280
2281  /**
2282   * A series of links that provide context to this bundle.
2283   */
2284  @Child(name = "link", type = {}, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2285  @Description(shortDefinition = "Links related to this Bundle", formalDefinition = "A series of links that provide context to this bundle.")
2286  protected List<BundleLinkComponent> link;
2287
2288  /**
2289   * An entry in a bundle resource - will either contain a resource, or
2290   * information about a resource (transactions and history only).
2291   */
2292  @Child(name = "entry", type = {}, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2293  @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).")
2294  protected List<BundleEntryComponent> entry;
2295
2296  /**
2297   * Digital Signature - base64 encoded. XML DigSIg or a JWT.
2298   */
2299  @Child(name = "signature", type = { Signature.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
2300  @Description(shortDefinition = "Digital Signature", formalDefinition = "Digital Signature - base64 encoded. XML DigSIg or a JWT.")
2301  protected Signature signature;
2302
2303  private static final long serialVersionUID = -2041954721L;
2304
2305  /*
2306   * Constructor
2307   */
2308  public Bundle() {
2309    super();
2310  }
2311
2312  /*
2313   * Constructor
2314   */
2315  public Bundle(Enumeration<BundleType> type) {
2316    super();
2317    this.type = type;
2318  }
2319
2320  /**
2321   * @return {@link #type} (Indicates the purpose of this bundle- how it was
2322   *         intended to be used.). This is the underlying object with id, value
2323   *         and extensions. The accessor "getType" gives direct access to the
2324   *         value
2325   */
2326  public Enumeration<BundleType> getTypeElement() {
2327    if (this.type == null)
2328      if (Configuration.errorOnAutoCreate())
2329        throw new Error("Attempt to auto-create Bundle.type");
2330      else if (Configuration.doAutoCreate())
2331        this.type = new Enumeration<BundleType>(new BundleTypeEnumFactory()); // bb
2332    return this.type;
2333  }
2334
2335  public boolean hasTypeElement() {
2336    return this.type != null && !this.type.isEmpty();
2337  }
2338
2339  public boolean hasType() {
2340    return this.type != null && !this.type.isEmpty();
2341  }
2342
2343  /**
2344   * @param value {@link #type} (Indicates the purpose of this bundle- how it was
2345   *              intended to be used.). This is the underlying object with id,
2346   *              value and extensions. The accessor "getType" gives direct access
2347   *              to the value
2348   */
2349  public Bundle setTypeElement(Enumeration<BundleType> value) {
2350    this.type = value;
2351    return this;
2352  }
2353
2354  /**
2355   * @return Indicates the purpose of this bundle- how it was intended to be used.
2356   */
2357  public BundleType getType() {
2358    return this.type == null ? null : this.type.getValue();
2359  }
2360
2361  /**
2362   * @param value Indicates the purpose of this bundle- how it was intended to be
2363   *              used.
2364   */
2365  public Bundle setType(BundleType value) {
2366    if (this.type == null)
2367      this.type = new Enumeration<BundleType>(new BundleTypeEnumFactory());
2368    this.type.setValue(value);
2369    return this;
2370  }
2371
2372  /**
2373   * @return {@link #total} (If a set of search matches, this is the total number
2374   *         of matches for the search (as opposed to the number of results in
2375   *         this bundle).). This is the underlying object with id, value and
2376   *         extensions. The accessor "getTotal" gives direct access to the value
2377   */
2378  public UnsignedIntType getTotalElement() {
2379    if (this.total == null)
2380      if (Configuration.errorOnAutoCreate())
2381        throw new Error("Attempt to auto-create Bundle.total");
2382      else if (Configuration.doAutoCreate())
2383        this.total = new UnsignedIntType(); // bb
2384    return this.total;
2385  }
2386
2387  public boolean hasTotalElement() {
2388    return this.total != null && !this.total.isEmpty();
2389  }
2390
2391  public boolean hasTotal() {
2392    return this.total != null && !this.total.isEmpty();
2393  }
2394
2395  /**
2396   * @param value {@link #total} (If a set of search matches, this is the total
2397   *              number of matches for the search (as opposed to the number of
2398   *              results in this bundle).). This is the underlying object with
2399   *              id, value and extensions. The accessor "getTotal" gives direct
2400   *              access to the value
2401   */
2402  public Bundle setTotalElement(UnsignedIntType value) {
2403    this.total = value;
2404    return this;
2405  }
2406
2407  /**
2408   * @return If a set of search matches, this is the total number of matches for
2409   *         the search (as opposed to the number of results in this bundle).
2410   */
2411  public int getTotal() {
2412    return this.total == null || this.total.isEmpty() ? 0 : this.total.getValue();
2413  }
2414
2415  /**
2416   * @param value If a set of search matches, this is the total number of matches
2417   *              for the search (as opposed to the number of results in this
2418   *              bundle).
2419   */
2420  public Bundle setTotal(int value) {
2421    if (this.total == null)
2422      this.total = new UnsignedIntType();
2423    this.total.setValue(value);
2424    return this;
2425  }
2426
2427  /**
2428   * @return {@link #link} (A series of links that provide context to this
2429   *         bundle.)
2430   */
2431  public List<BundleLinkComponent> getLink() {
2432    if (this.link == null)
2433      this.link = new ArrayList<BundleLinkComponent>();
2434    return this.link;
2435  }
2436
2437  public boolean hasLink() {
2438    if (this.link == null)
2439      return false;
2440    for (BundleLinkComponent item : this.link)
2441      if (!item.isEmpty())
2442        return true;
2443    return false;
2444  }
2445
2446  /**
2447   * @return {@link #link} (A series of links that provide context to this
2448   *         bundle.)
2449   */
2450  // syntactic sugar
2451  public BundleLinkComponent addLink() { // 3
2452    BundleLinkComponent t = new BundleLinkComponent();
2453    if (this.link == null)
2454      this.link = new ArrayList<BundleLinkComponent>();
2455    this.link.add(t);
2456    return t;
2457  }
2458
2459  // syntactic sugar
2460  public Bundle addLink(BundleLinkComponent t) { // 3
2461    if (t == null)
2462      return this;
2463    if (this.link == null)
2464      this.link = new ArrayList<BundleLinkComponent>();
2465    this.link.add(t);
2466    return this;
2467  }
2468
2469  /**
2470   * @return {@link #entry} (An entry in a bundle resource - will either contain a
2471   *         resource, or information about a resource (transactions and history
2472   *         only).)
2473   */
2474  public List<BundleEntryComponent> getEntry() {
2475    if (this.entry == null)
2476      this.entry = new ArrayList<BundleEntryComponent>();
2477    return this.entry;
2478  }
2479
2480  public boolean hasEntry() {
2481    if (this.entry == null)
2482      return false;
2483    for (BundleEntryComponent item : this.entry)
2484      if (!item.isEmpty())
2485        return true;
2486    return false;
2487  }
2488
2489  /**
2490   * @return {@link #entry} (An entry in a bundle resource - will either contain a
2491   *         resource, or information about a resource (transactions and history
2492   *         only).)
2493   */
2494  // syntactic sugar
2495  public BundleEntryComponent addEntry() { // 3
2496    BundleEntryComponent t = new BundleEntryComponent();
2497    if (this.entry == null)
2498      this.entry = new ArrayList<BundleEntryComponent>();
2499    this.entry.add(t);
2500    return t;
2501  }
2502
2503  // syntactic sugar
2504  public Bundle addEntry(BundleEntryComponent t) { // 3
2505    if (t == null)
2506      return this;
2507    if (this.entry == null)
2508      this.entry = new ArrayList<BundleEntryComponent>();
2509    this.entry.add(t);
2510    return this;
2511  }
2512
2513  /**
2514   * @return {@link #signature} (Digital Signature - base64 encoded. XML DigSIg or
2515   *         a JWT.)
2516   */
2517  public Signature getSignature() {
2518    if (this.signature == null)
2519      if (Configuration.errorOnAutoCreate())
2520        throw new Error("Attempt to auto-create Bundle.signature");
2521      else if (Configuration.doAutoCreate())
2522        this.signature = new Signature(); // cc
2523    return this.signature;
2524  }
2525
2526  public boolean hasSignature() {
2527    return this.signature != null && !this.signature.isEmpty();
2528  }
2529
2530  /**
2531   * @param value {@link #signature} (Digital Signature - base64 encoded. XML
2532   *              DigSIg or a JWT.)
2533   */
2534  public Bundle setSignature(Signature value) {
2535    this.signature = value;
2536    return this;
2537  }
2538
2539  /**
2540   * Returns the {@link #getLink() link} which matches a given
2541   * {@link BundleLinkComponent#getRelation() relation}. If no link is found which
2542   * matches the given relation, returns <code>null</code>. If more than one link
2543   * is found which matches the given relation, returns the first matching
2544   * BundleLinkComponent.
2545   * 
2546   * @param theRelation The relation, such as "next", or "self. See the constants
2547   *                    such as {@link IBaseBundle#LINK_SELF} and
2548   *                    {@link IBaseBundle#LINK_NEXT}.
2549   * @return Returns a matching BundleLinkComponent, or <code>null</code>
2550   * @see IBaseBundle#LINK_NEXT
2551   * @see IBaseBundle#LINK_PREV
2552   * @see IBaseBundle#LINK_SELF
2553   */
2554  public BundleLinkComponent getLink(String theRelation) {
2555    org.apache.commons.lang3.Validate.notBlank(theRelation, "theRelation may not be null or empty");
2556    for (BundleLinkComponent next : getLink()) {
2557      if (theRelation.equals(next.getRelation())) {
2558        return next;
2559      }
2560    }
2561    return null;
2562  }
2563
2564  /**
2565   * Returns the {@link #getLink() link} which matches a given
2566   * {@link BundleLinkComponent#getRelation() relation}. If no link is found which
2567   * matches the given relation, creates a new BundleLinkComponent with the given
2568   * relation and adds it to this Bundle. If more than one link is found which
2569   * matches the given relation, returns the first matching BundleLinkComponent.
2570   * 
2571   * @param theRelation The relation, such as "next", or "self. See the constants
2572   *                    such as {@link IBaseBundle#LINK_SELF} and
2573   *                    {@link IBaseBundle#LINK_NEXT}.
2574   * @return Returns a matching BundleLinkComponent, or <code>null</code>
2575   * @see IBaseBundle#LINK_NEXT
2576   * @see IBaseBundle#LINK_PREV
2577   * @see IBaseBundle#LINK_SELF
2578   */
2579  public BundleLinkComponent getLinkOrCreate(String theRelation) {
2580    org.apache.commons.lang3.Validate.notBlank(theRelation, "theRelation may not be null or empty");
2581    for (BundleLinkComponent next : getLink()) {
2582      if (theRelation.equals(next.getRelation())) {
2583        return next;
2584      }
2585    }
2586    BundleLinkComponent retVal = new BundleLinkComponent();
2587    retVal.setRelation(theRelation);
2588    getLink().add(retVal);
2589    return retVal;
2590  }
2591
2592  protected void listChildren(List<Property> childrenList) {
2593    super.listChildren(childrenList);
2594    childrenList.add(new Property("type", "code",
2595        "Indicates the purpose of this bundle- how it was intended to be used.", 0, java.lang.Integer.MAX_VALUE, type));
2596    childrenList.add(new Property("total", "unsignedInt",
2597        "If a set of search matches, this is the total number of matches for the search (as opposed to the number of results in this bundle).",
2598        0, java.lang.Integer.MAX_VALUE, total));
2599    childrenList.add(new Property("link", "", "A series of links that provide context to this bundle.", 0,
2600        java.lang.Integer.MAX_VALUE, link));
2601    childrenList.add(new Property("entry", "",
2602        "An entry in a bundle resource - will either contain a resource, or information about a resource (transactions and history only).",
2603        0, java.lang.Integer.MAX_VALUE, entry));
2604    childrenList.add(new Property("signature", "Signature", "Digital Signature - base64 encoded. XML DigSIg or a JWT.",
2605        0, java.lang.Integer.MAX_VALUE, signature));
2606  }
2607
2608  @Override
2609  public void setProperty(String name, Base value) throws FHIRException {
2610    if (name.equals("type"))
2611      this.type = new BundleTypeEnumFactory().fromType(value); // Enumeration<BundleType>
2612    else if (name.equals("total"))
2613      this.total = castToUnsignedInt(value); // UnsignedIntType
2614    else if (name.equals("link"))
2615      this.getLink().add((BundleLinkComponent) value);
2616    else if (name.equals("entry"))
2617      this.getEntry().add((BundleEntryComponent) value);
2618    else if (name.equals("signature"))
2619      this.signature = castToSignature(value); // Signature
2620    else
2621      super.setProperty(name, value);
2622  }
2623
2624  @Override
2625  public Base addChild(String name) throws FHIRException {
2626    if (name.equals("type")) {
2627      throw new FHIRException("Cannot call addChild on a singleton property Bundle.type");
2628    } else if (name.equals("total")) {
2629      throw new FHIRException("Cannot call addChild on a singleton property Bundle.total");
2630    } else if (name.equals("link")) {
2631      return addLink();
2632    } else if (name.equals("entry")) {
2633      return addEntry();
2634    } else if (name.equals("signature")) {
2635      this.signature = new Signature();
2636      return this.signature;
2637    } else
2638      return super.addChild(name);
2639  }
2640
2641  public String fhirType() {
2642    return "Bundle";
2643
2644  }
2645
2646  public Bundle copy() {
2647    Bundle dst = new Bundle();
2648    copyValues(dst);
2649    dst.type = type == null ? null : type.copy();
2650    dst.total = total == null ? null : total.copy();
2651    if (link != null) {
2652      dst.link = new ArrayList<BundleLinkComponent>();
2653      for (BundleLinkComponent i : link)
2654        dst.link.add(i.copy());
2655    }
2656    ;
2657    if (entry != null) {
2658      dst.entry = new ArrayList<BundleEntryComponent>();
2659      for (BundleEntryComponent i : entry)
2660        dst.entry.add(i.copy());
2661    }
2662    ;
2663    dst.signature = signature == null ? null : signature.copy();
2664    return dst;
2665  }
2666
2667  protected Bundle typedCopy() {
2668    return copy();
2669  }
2670
2671  @Override
2672  public boolean equalsDeep(Base other) {
2673    if (!super.equalsDeep(other))
2674      return false;
2675    if (!(other instanceof Bundle))
2676      return false;
2677    Bundle o = (Bundle) other;
2678    return compareDeep(type, o.type, true) && compareDeep(total, o.total, true) && compareDeep(link, o.link, true)
2679        && compareDeep(entry, o.entry, true) && compareDeep(signature, o.signature, true);
2680  }
2681
2682  @Override
2683  public boolean equalsShallow(Base other) {
2684    if (!super.equalsShallow(other))
2685      return false;
2686    if (!(other instanceof Bundle))
2687      return false;
2688    Bundle o = (Bundle) other;
2689    return compareValues(type, o.type, true) && compareValues(total, o.total, true);
2690  }
2691
2692  public boolean isEmpty() {
2693    return super.isEmpty() && (type == null || type.isEmpty()) && (total == null || total.isEmpty())
2694        && (link == null || link.isEmpty()) && (entry == null || entry.isEmpty())
2695        && (signature == null || signature.isEmpty());
2696  }
2697
2698  @Override
2699  public ResourceType getResourceType() {
2700    return ResourceType.Bundle;
2701  }
2702
2703  @SearchParamDefinition(name = "composition", path = "Bundle.entry.resource.item(0)", description = "The first resource in the bundle, if the bundle type is \"document\" - this is a composition, and this parameter provides access to searches its contents", type = "reference")
2704  public static final String SP_COMPOSITION = "composition";
2705  @SearchParamDefinition(name = "type", path = "Bundle.type", description = "document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection", type = "token")
2706  public static final String SP_TYPE = "type";
2707  @SearchParamDefinition(name = "message", path = "Bundle.entry.resource.item(0)", 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")
2708  public static final String SP_MESSAGE = "message";
2709
2710}