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