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