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