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