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