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