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