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