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