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