001package org.hl7.fhir.dstu3.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import ca.uhn.fhir.model.api.annotation.ResourceDef;
038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.ChildOrder;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.Block;
043import org.hl7.fhir.instance.model.api.*;
044import org.hl7.fhir.exceptions.FHIRException;
045/**
046 * Describes the event of a patient being administered a vaccination or a record of a vaccination as reported by a patient, a clinician or another party and may include vaccine reaction information and what vaccination protocol was followed.
047 */
048@ResourceDef(name="Immunization", profile="http://hl7.org/fhir/Profile/Immunization")
049public class Immunization extends DomainResource {
050
051    public enum ImmunizationStatus {
052        /**
053         * null
054         */
055        COMPLETED, 
056        /**
057         * null
058         */
059        ENTEREDINERROR, 
060        /**
061         * added to help the parsers with the generic types
062         */
063        NULL;
064        public static ImmunizationStatus fromCode(String codeString) throws FHIRException {
065            if (codeString == null || "".equals(codeString))
066                return null;
067        if ("completed".equals(codeString))
068          return COMPLETED;
069        if ("entered-in-error".equals(codeString))
070          return ENTEREDINERROR;
071        if (Configuration.isAcceptInvalidEnums())
072          return null;
073        else
074          throw new FHIRException("Unknown ImmunizationStatus code '"+codeString+"'");
075        }
076        public String toCode() {
077          switch (this) {
078            case COMPLETED: return "completed";
079            case ENTEREDINERROR: return "entered-in-error";
080            default: return "?";
081          }
082        }
083        public String getSystem() {
084          switch (this) {
085            case COMPLETED: return "http://hl7.org/fhir/medication-admin-status";
086            case ENTEREDINERROR: return "http://hl7.org/fhir/medication-admin-status";
087            default: return "?";
088          }
089        }
090        public String getDefinition() {
091          switch (this) {
092            case COMPLETED: return "";
093            case ENTEREDINERROR: return "";
094            default: return "?";
095          }
096        }
097        public String getDisplay() {
098          switch (this) {
099            case COMPLETED: return "completed";
100            case ENTEREDINERROR: return "entered-in-error";
101            default: return "?";
102          }
103        }
104    }
105
106  public static class ImmunizationStatusEnumFactory implements EnumFactory<ImmunizationStatus> {
107    public ImmunizationStatus fromCode(String codeString) throws IllegalArgumentException {
108      if (codeString == null || "".equals(codeString))
109            if (codeString == null || "".equals(codeString))
110                return null;
111        if ("completed".equals(codeString))
112          return ImmunizationStatus.COMPLETED;
113        if ("entered-in-error".equals(codeString))
114          return ImmunizationStatus.ENTEREDINERROR;
115        throw new IllegalArgumentException("Unknown ImmunizationStatus code '"+codeString+"'");
116        }
117        public Enumeration<ImmunizationStatus> fromType(Base code) throws FHIRException {
118          if (code == null)
119            return null;
120          if (code.isEmpty())
121            return new Enumeration<ImmunizationStatus>(this);
122          String codeString = ((PrimitiveType) code).asStringValue();
123          if (codeString == null || "".equals(codeString))
124            return null;
125        if ("completed".equals(codeString))
126          return new Enumeration<ImmunizationStatus>(this, ImmunizationStatus.COMPLETED);
127        if ("entered-in-error".equals(codeString))
128          return new Enumeration<ImmunizationStatus>(this, ImmunizationStatus.ENTEREDINERROR);
129        throw new FHIRException("Unknown ImmunizationStatus code '"+codeString+"'");
130        }
131    public String toCode(ImmunizationStatus code) {
132      if (code == ImmunizationStatus.COMPLETED)
133        return "completed";
134      if (code == ImmunizationStatus.ENTEREDINERROR)
135        return "entered-in-error";
136      return "?";
137      }
138    public String toSystem(ImmunizationStatus code) {
139      return code.getSystem();
140      }
141    }
142
143    @Block()
144    public static class ImmunizationPractitionerComponent extends BackboneElement implements IBaseBackboneElement {
145        /**
146         * Describes the type of performance (e.g. ordering provider, administering provider, etc.).
147         */
148        @Child(name = "role", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
149        @Description(shortDefinition="What type of performance was done", formalDefinition="Describes the type of performance (e.g. ordering provider, administering provider, etc.)." )
150        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/immunization-role")
151        protected CodeableConcept role;
152
153        /**
154         * The device, practitioner, etc. who performed the action.
155         */
156        @Child(name = "actor", type = {Practitioner.class}, order=2, min=1, max=1, modifier=false, summary=true)
157        @Description(shortDefinition="Individual who was performing", formalDefinition="The device, practitioner, etc. who performed the action." )
158        protected Reference actor;
159
160        /**
161         * The actual object that is the target of the reference (The device, practitioner, etc. who performed the action.)
162         */
163        protected Practitioner actorTarget;
164
165        private static final long serialVersionUID = -922003669L;
166
167    /**
168     * Constructor
169     */
170      public ImmunizationPractitionerComponent() {
171        super();
172      }
173
174    /**
175     * Constructor
176     */
177      public ImmunizationPractitionerComponent(Reference actor) {
178        super();
179        this.actor = actor;
180      }
181
182        /**
183         * @return {@link #role} (Describes the type of performance (e.g. ordering provider, administering provider, etc.).)
184         */
185        public CodeableConcept getRole() { 
186          if (this.role == null)
187            if (Configuration.errorOnAutoCreate())
188              throw new Error("Attempt to auto-create ImmunizationPractitionerComponent.role");
189            else if (Configuration.doAutoCreate())
190              this.role = new CodeableConcept(); // cc
191          return this.role;
192        }
193
194        public boolean hasRole() { 
195          return this.role != null && !this.role.isEmpty();
196        }
197
198        /**
199         * @param value {@link #role} (Describes the type of performance (e.g. ordering provider, administering provider, etc.).)
200         */
201        public ImmunizationPractitionerComponent setRole(CodeableConcept value) { 
202          this.role = value;
203          return this;
204        }
205
206        /**
207         * @return {@link #actor} (The device, practitioner, etc. who performed the action.)
208         */
209        public Reference getActor() { 
210          if (this.actor == null)
211            if (Configuration.errorOnAutoCreate())
212              throw new Error("Attempt to auto-create ImmunizationPractitionerComponent.actor");
213            else if (Configuration.doAutoCreate())
214              this.actor = new Reference(); // cc
215          return this.actor;
216        }
217
218        public boolean hasActor() { 
219          return this.actor != null && !this.actor.isEmpty();
220        }
221
222        /**
223         * @param value {@link #actor} (The device, practitioner, etc. who performed the action.)
224         */
225        public ImmunizationPractitionerComponent setActor(Reference value) { 
226          this.actor = value;
227          return this;
228        }
229
230        /**
231         * @return {@link #actor} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The device, practitioner, etc. who performed the action.)
232         */
233        public Practitioner getActorTarget() { 
234          if (this.actorTarget == null)
235            if (Configuration.errorOnAutoCreate())
236              throw new Error("Attempt to auto-create ImmunizationPractitionerComponent.actor");
237            else if (Configuration.doAutoCreate())
238              this.actorTarget = new Practitioner(); // aa
239          return this.actorTarget;
240        }
241
242        /**
243         * @param value {@link #actor} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The device, practitioner, etc. who performed the action.)
244         */
245        public ImmunizationPractitionerComponent setActorTarget(Practitioner value) { 
246          this.actorTarget = value;
247          return this;
248        }
249
250        protected void listChildren(List<Property> childrenList) {
251          super.listChildren(childrenList);
252          childrenList.add(new Property("role", "CodeableConcept", "Describes the type of performance (e.g. ordering provider, administering provider, etc.).", 0, java.lang.Integer.MAX_VALUE, role));
253          childrenList.add(new Property("actor", "Reference(Practitioner)", "The device, practitioner, etc. who performed the action.", 0, java.lang.Integer.MAX_VALUE, actor));
254        }
255
256      @Override
257      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
258        switch (hash) {
259        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
260        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference
261        default: return super.getProperty(hash, name, checkValid);
262        }
263
264      }
265
266      @Override
267      public Base setProperty(int hash, String name, Base value) throws FHIRException {
268        switch (hash) {
269        case 3506294: // role
270          this.role = castToCodeableConcept(value); // CodeableConcept
271          return value;
272        case 92645877: // actor
273          this.actor = castToReference(value); // Reference
274          return value;
275        default: return super.setProperty(hash, name, value);
276        }
277
278      }
279
280      @Override
281      public Base setProperty(String name, Base value) throws FHIRException {
282        if (name.equals("role")) {
283          this.role = castToCodeableConcept(value); // CodeableConcept
284        } else if (name.equals("actor")) {
285          this.actor = castToReference(value); // Reference
286        } else
287          return super.setProperty(name, value);
288        return value;
289      }
290
291      @Override
292      public Base makeProperty(int hash, String name) throws FHIRException {
293        switch (hash) {
294        case 3506294:  return getRole(); 
295        case 92645877:  return getActor(); 
296        default: return super.makeProperty(hash, name);
297        }
298
299      }
300
301      @Override
302      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
303        switch (hash) {
304        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
305        case 92645877: /*actor*/ return new String[] {"Reference"};
306        default: return super.getTypesForProperty(hash, name);
307        }
308
309      }
310
311      @Override
312      public Base addChild(String name) throws FHIRException {
313        if (name.equals("role")) {
314          this.role = new CodeableConcept();
315          return this.role;
316        }
317        else if (name.equals("actor")) {
318          this.actor = new Reference();
319          return this.actor;
320        }
321        else
322          return super.addChild(name);
323      }
324
325      public ImmunizationPractitionerComponent copy() {
326        ImmunizationPractitionerComponent dst = new ImmunizationPractitionerComponent();
327        copyValues(dst);
328        dst.role = role == null ? null : role.copy();
329        dst.actor = actor == null ? null : actor.copy();
330        return dst;
331      }
332
333      @Override
334      public boolean equalsDeep(Base other) {
335        if (!super.equalsDeep(other))
336          return false;
337        if (!(other instanceof ImmunizationPractitionerComponent))
338          return false;
339        ImmunizationPractitionerComponent o = (ImmunizationPractitionerComponent) other;
340        return compareDeep(role, o.role, true) && compareDeep(actor, o.actor, true);
341      }
342
343      @Override
344      public boolean equalsShallow(Base other) {
345        if (!super.equalsShallow(other))
346          return false;
347        if (!(other instanceof ImmunizationPractitionerComponent))
348          return false;
349        ImmunizationPractitionerComponent o = (ImmunizationPractitionerComponent) other;
350        return true;
351      }
352
353      public boolean isEmpty() {
354        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(role, actor);
355      }
356
357  public String fhirType() {
358    return "Immunization.practitioner";
359
360  }
361
362  }
363
364    @Block()
365    public static class ImmunizationExplanationComponent extends BackboneElement implements IBaseBackboneElement {
366        /**
367         * Reasons why a vaccine was administered.
368         */
369        @Child(name = "reason", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
370        @Description(shortDefinition="Why immunization occurred", formalDefinition="Reasons why a vaccine was administered." )
371        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/immunization-reason")
372        protected List<CodeableConcept> reason;
373
374        /**
375         * Reason why a vaccine was not administered.
376         */
377        @Child(name = "reasonNotGiven", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
378        @Description(shortDefinition="Why immunization did not occur", formalDefinition="Reason why a vaccine was not administered." )
379        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/no-immunization-reason")
380        protected List<CodeableConcept> reasonNotGiven;
381
382        private static final long serialVersionUID = -539821866L;
383
384    /**
385     * Constructor
386     */
387      public ImmunizationExplanationComponent() {
388        super();
389      }
390
391        /**
392         * @return {@link #reason} (Reasons why a vaccine was administered.)
393         */
394        public List<CodeableConcept> getReason() { 
395          if (this.reason == null)
396            this.reason = new ArrayList<CodeableConcept>();
397          return this.reason;
398        }
399
400        /**
401         * @return Returns a reference to <code>this</code> for easy method chaining
402         */
403        public ImmunizationExplanationComponent setReason(List<CodeableConcept> theReason) { 
404          this.reason = theReason;
405          return this;
406        }
407
408        public boolean hasReason() { 
409          if (this.reason == null)
410            return false;
411          for (CodeableConcept item : this.reason)
412            if (!item.isEmpty())
413              return true;
414          return false;
415        }
416
417        public CodeableConcept addReason() { //3
418          CodeableConcept t = new CodeableConcept();
419          if (this.reason == null)
420            this.reason = new ArrayList<CodeableConcept>();
421          this.reason.add(t);
422          return t;
423        }
424
425        public ImmunizationExplanationComponent addReason(CodeableConcept t) { //3
426          if (t == null)
427            return this;
428          if (this.reason == null)
429            this.reason = new ArrayList<CodeableConcept>();
430          this.reason.add(t);
431          return this;
432        }
433
434        /**
435         * @return The first repetition of repeating field {@link #reason}, creating it if it does not already exist
436         */
437        public CodeableConcept getReasonFirstRep() { 
438          if (getReason().isEmpty()) {
439            addReason();
440          }
441          return getReason().get(0);
442        }
443
444        /**
445         * @return {@link #reasonNotGiven} (Reason why a vaccine was not administered.)
446         */
447        public List<CodeableConcept> getReasonNotGiven() { 
448          if (this.reasonNotGiven == null)
449            this.reasonNotGiven = new ArrayList<CodeableConcept>();
450          return this.reasonNotGiven;
451        }
452
453        /**
454         * @return Returns a reference to <code>this</code> for easy method chaining
455         */
456        public ImmunizationExplanationComponent setReasonNotGiven(List<CodeableConcept> theReasonNotGiven) { 
457          this.reasonNotGiven = theReasonNotGiven;
458          return this;
459        }
460
461        public boolean hasReasonNotGiven() { 
462          if (this.reasonNotGiven == null)
463            return false;
464          for (CodeableConcept item : this.reasonNotGiven)
465            if (!item.isEmpty())
466              return true;
467          return false;
468        }
469
470        public CodeableConcept addReasonNotGiven() { //3
471          CodeableConcept t = new CodeableConcept();
472          if (this.reasonNotGiven == null)
473            this.reasonNotGiven = new ArrayList<CodeableConcept>();
474          this.reasonNotGiven.add(t);
475          return t;
476        }
477
478        public ImmunizationExplanationComponent addReasonNotGiven(CodeableConcept t) { //3
479          if (t == null)
480            return this;
481          if (this.reasonNotGiven == null)
482            this.reasonNotGiven = new ArrayList<CodeableConcept>();
483          this.reasonNotGiven.add(t);
484          return this;
485        }
486
487        /**
488         * @return The first repetition of repeating field {@link #reasonNotGiven}, creating it if it does not already exist
489         */
490        public CodeableConcept getReasonNotGivenFirstRep() { 
491          if (getReasonNotGiven().isEmpty()) {
492            addReasonNotGiven();
493          }
494          return getReasonNotGiven().get(0);
495        }
496
497        protected void listChildren(List<Property> childrenList) {
498          super.listChildren(childrenList);
499          childrenList.add(new Property("reason", "CodeableConcept", "Reasons why a vaccine was administered.", 0, java.lang.Integer.MAX_VALUE, reason));
500          childrenList.add(new Property("reasonNotGiven", "CodeableConcept", "Reason why a vaccine was not administered.", 0, java.lang.Integer.MAX_VALUE, reasonNotGiven));
501        }
502
503      @Override
504      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
505        switch (hash) {
506        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // CodeableConcept
507        case 2101123790: /*reasonNotGiven*/ return this.reasonNotGiven == null ? new Base[0] : this.reasonNotGiven.toArray(new Base[this.reasonNotGiven.size()]); // CodeableConcept
508        default: return super.getProperty(hash, name, checkValid);
509        }
510
511      }
512
513      @Override
514      public Base setProperty(int hash, String name, Base value) throws FHIRException {
515        switch (hash) {
516        case -934964668: // reason
517          this.getReason().add(castToCodeableConcept(value)); // CodeableConcept
518          return value;
519        case 2101123790: // reasonNotGiven
520          this.getReasonNotGiven().add(castToCodeableConcept(value)); // CodeableConcept
521          return value;
522        default: return super.setProperty(hash, name, value);
523        }
524
525      }
526
527      @Override
528      public Base setProperty(String name, Base value) throws FHIRException {
529        if (name.equals("reason")) {
530          this.getReason().add(castToCodeableConcept(value));
531        } else if (name.equals("reasonNotGiven")) {
532          this.getReasonNotGiven().add(castToCodeableConcept(value));
533        } else
534          return super.setProperty(name, value);
535        return value;
536      }
537
538      @Override
539      public Base makeProperty(int hash, String name) throws FHIRException {
540        switch (hash) {
541        case -934964668:  return addReason(); 
542        case 2101123790:  return addReasonNotGiven(); 
543        default: return super.makeProperty(hash, name);
544        }
545
546      }
547
548      @Override
549      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
550        switch (hash) {
551        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
552        case 2101123790: /*reasonNotGiven*/ return new String[] {"CodeableConcept"};
553        default: return super.getTypesForProperty(hash, name);
554        }
555
556      }
557
558      @Override
559      public Base addChild(String name) throws FHIRException {
560        if (name.equals("reason")) {
561          return addReason();
562        }
563        else if (name.equals("reasonNotGiven")) {
564          return addReasonNotGiven();
565        }
566        else
567          return super.addChild(name);
568      }
569
570      public ImmunizationExplanationComponent copy() {
571        ImmunizationExplanationComponent dst = new ImmunizationExplanationComponent();
572        copyValues(dst);
573        if (reason != null) {
574          dst.reason = new ArrayList<CodeableConcept>();
575          for (CodeableConcept i : reason)
576            dst.reason.add(i.copy());
577        };
578        if (reasonNotGiven != null) {
579          dst.reasonNotGiven = new ArrayList<CodeableConcept>();
580          for (CodeableConcept i : reasonNotGiven)
581            dst.reasonNotGiven.add(i.copy());
582        };
583        return dst;
584      }
585
586      @Override
587      public boolean equalsDeep(Base other) {
588        if (!super.equalsDeep(other))
589          return false;
590        if (!(other instanceof ImmunizationExplanationComponent))
591          return false;
592        ImmunizationExplanationComponent o = (ImmunizationExplanationComponent) other;
593        return compareDeep(reason, o.reason, true) && compareDeep(reasonNotGiven, o.reasonNotGiven, true)
594          ;
595      }
596
597      @Override
598      public boolean equalsShallow(Base other) {
599        if (!super.equalsShallow(other))
600          return false;
601        if (!(other instanceof ImmunizationExplanationComponent))
602          return false;
603        ImmunizationExplanationComponent o = (ImmunizationExplanationComponent) other;
604        return true;
605      }
606
607      public boolean isEmpty() {
608        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reason, reasonNotGiven);
609      }
610
611  public String fhirType() {
612    return "Immunization.explanation";
613
614  }
615
616  }
617
618    @Block()
619    public static class ImmunizationReactionComponent extends BackboneElement implements IBaseBackboneElement {
620        /**
621         * Date of reaction to the immunization.
622         */
623        @Child(name = "date", type = {DateTimeType.class}, order=1, min=0, max=1, modifier=false, summary=false)
624        @Description(shortDefinition="When reaction started", formalDefinition="Date of reaction to the immunization." )
625        protected DateTimeType date;
626
627        /**
628         * Details of the reaction.
629         */
630        @Child(name = "detail", type = {Observation.class}, order=2, min=0, max=1, modifier=false, summary=false)
631        @Description(shortDefinition="Additional information on reaction", formalDefinition="Details of the reaction." )
632        protected Reference detail;
633
634        /**
635         * The actual object that is the target of the reference (Details of the reaction.)
636         */
637        protected Observation detailTarget;
638
639        /**
640         * Self-reported indicator.
641         */
642        @Child(name = "reported", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
643        @Description(shortDefinition="Indicates self-reported reaction", formalDefinition="Self-reported indicator." )
644        protected BooleanType reported;
645
646        private static final long serialVersionUID = -1297668556L;
647
648    /**
649     * Constructor
650     */
651      public ImmunizationReactionComponent() {
652        super();
653      }
654
655        /**
656         * @return {@link #date} (Date of reaction to the immunization.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
657         */
658        public DateTimeType getDateElement() { 
659          if (this.date == null)
660            if (Configuration.errorOnAutoCreate())
661              throw new Error("Attempt to auto-create ImmunizationReactionComponent.date");
662            else if (Configuration.doAutoCreate())
663              this.date = new DateTimeType(); // bb
664          return this.date;
665        }
666
667        public boolean hasDateElement() { 
668          return this.date != null && !this.date.isEmpty();
669        }
670
671        public boolean hasDate() { 
672          return this.date != null && !this.date.isEmpty();
673        }
674
675        /**
676         * @param value {@link #date} (Date of reaction to the immunization.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
677         */
678        public ImmunizationReactionComponent setDateElement(DateTimeType value) { 
679          this.date = value;
680          return this;
681        }
682
683        /**
684         * @return Date of reaction to the immunization.
685         */
686        public Date getDate() { 
687          return this.date == null ? null : this.date.getValue();
688        }
689
690        /**
691         * @param value Date of reaction to the immunization.
692         */
693        public ImmunizationReactionComponent setDate(Date value) { 
694          if (value == null)
695            this.date = null;
696          else {
697            if (this.date == null)
698              this.date = new DateTimeType();
699            this.date.setValue(value);
700          }
701          return this;
702        }
703
704        /**
705         * @return {@link #detail} (Details of the reaction.)
706         */
707        public Reference getDetail() { 
708          if (this.detail == null)
709            if (Configuration.errorOnAutoCreate())
710              throw new Error("Attempt to auto-create ImmunizationReactionComponent.detail");
711            else if (Configuration.doAutoCreate())
712              this.detail = new Reference(); // cc
713          return this.detail;
714        }
715
716        public boolean hasDetail() { 
717          return this.detail != null && !this.detail.isEmpty();
718        }
719
720        /**
721         * @param value {@link #detail} (Details of the reaction.)
722         */
723        public ImmunizationReactionComponent setDetail(Reference value) { 
724          this.detail = value;
725          return this;
726        }
727
728        /**
729         * @return {@link #detail} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Details of the reaction.)
730         */
731        public Observation getDetailTarget() { 
732          if (this.detailTarget == null)
733            if (Configuration.errorOnAutoCreate())
734              throw new Error("Attempt to auto-create ImmunizationReactionComponent.detail");
735            else if (Configuration.doAutoCreate())
736              this.detailTarget = new Observation(); // aa
737          return this.detailTarget;
738        }
739
740        /**
741         * @param value {@link #detail} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Details of the reaction.)
742         */
743        public ImmunizationReactionComponent setDetailTarget(Observation value) { 
744          this.detailTarget = value;
745          return this;
746        }
747
748        /**
749         * @return {@link #reported} (Self-reported indicator.). This is the underlying object with id, value and extensions. The accessor "getReported" gives direct access to the value
750         */
751        public BooleanType getReportedElement() { 
752          if (this.reported == null)
753            if (Configuration.errorOnAutoCreate())
754              throw new Error("Attempt to auto-create ImmunizationReactionComponent.reported");
755            else if (Configuration.doAutoCreate())
756              this.reported = new BooleanType(); // bb
757          return this.reported;
758        }
759
760        public boolean hasReportedElement() { 
761          return this.reported != null && !this.reported.isEmpty();
762        }
763
764        public boolean hasReported() { 
765          return this.reported != null && !this.reported.isEmpty();
766        }
767
768        /**
769         * @param value {@link #reported} (Self-reported indicator.). This is the underlying object with id, value and extensions. The accessor "getReported" gives direct access to the value
770         */
771        public ImmunizationReactionComponent setReportedElement(BooleanType value) { 
772          this.reported = value;
773          return this;
774        }
775
776        /**
777         * @return Self-reported indicator.
778         */
779        public boolean getReported() { 
780          return this.reported == null || this.reported.isEmpty() ? false : this.reported.getValue();
781        }
782
783        /**
784         * @param value Self-reported indicator.
785         */
786        public ImmunizationReactionComponent setReported(boolean value) { 
787            if (this.reported == null)
788              this.reported = new BooleanType();
789            this.reported.setValue(value);
790          return this;
791        }
792
793        protected void listChildren(List<Property> childrenList) {
794          super.listChildren(childrenList);
795          childrenList.add(new Property("date", "dateTime", "Date of reaction to the immunization.", 0, java.lang.Integer.MAX_VALUE, date));
796          childrenList.add(new Property("detail", "Reference(Observation)", "Details of the reaction.", 0, java.lang.Integer.MAX_VALUE, detail));
797          childrenList.add(new Property("reported", "boolean", "Self-reported indicator.", 0, java.lang.Integer.MAX_VALUE, reported));
798        }
799
800      @Override
801      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
802        switch (hash) {
803        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
804        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : new Base[] {this.detail}; // Reference
805        case -427039533: /*reported*/ return this.reported == null ? new Base[0] : new Base[] {this.reported}; // BooleanType
806        default: return super.getProperty(hash, name, checkValid);
807        }
808
809      }
810
811      @Override
812      public Base setProperty(int hash, String name, Base value) throws FHIRException {
813        switch (hash) {
814        case 3076014: // date
815          this.date = castToDateTime(value); // DateTimeType
816          return value;
817        case -1335224239: // detail
818          this.detail = castToReference(value); // Reference
819          return value;
820        case -427039533: // reported
821          this.reported = castToBoolean(value); // BooleanType
822          return value;
823        default: return super.setProperty(hash, name, value);
824        }
825
826      }
827
828      @Override
829      public Base setProperty(String name, Base value) throws FHIRException {
830        if (name.equals("date")) {
831          this.date = castToDateTime(value); // DateTimeType
832        } else if (name.equals("detail")) {
833          this.detail = castToReference(value); // Reference
834        } else if (name.equals("reported")) {
835          this.reported = castToBoolean(value); // BooleanType
836        } else
837          return super.setProperty(name, value);
838        return value;
839      }
840
841      @Override
842      public Base makeProperty(int hash, String name) throws FHIRException {
843        switch (hash) {
844        case 3076014:  return getDateElement();
845        case -1335224239:  return getDetail(); 
846        case -427039533:  return getReportedElement();
847        default: return super.makeProperty(hash, name);
848        }
849
850      }
851
852      @Override
853      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
854        switch (hash) {
855        case 3076014: /*date*/ return new String[] {"dateTime"};
856        case -1335224239: /*detail*/ return new String[] {"Reference"};
857        case -427039533: /*reported*/ return new String[] {"boolean"};
858        default: return super.getTypesForProperty(hash, name);
859        }
860
861      }
862
863      @Override
864      public Base addChild(String name) throws FHIRException {
865        if (name.equals("date")) {
866          throw new FHIRException("Cannot call addChild on a primitive type Immunization.date");
867        }
868        else if (name.equals("detail")) {
869          this.detail = new Reference();
870          return this.detail;
871        }
872        else if (name.equals("reported")) {
873          throw new FHIRException("Cannot call addChild on a primitive type Immunization.reported");
874        }
875        else
876          return super.addChild(name);
877      }
878
879      public ImmunizationReactionComponent copy() {
880        ImmunizationReactionComponent dst = new ImmunizationReactionComponent();
881        copyValues(dst);
882        dst.date = date == null ? null : date.copy();
883        dst.detail = detail == null ? null : detail.copy();
884        dst.reported = reported == null ? null : reported.copy();
885        return dst;
886      }
887
888      @Override
889      public boolean equalsDeep(Base other) {
890        if (!super.equalsDeep(other))
891          return false;
892        if (!(other instanceof ImmunizationReactionComponent))
893          return false;
894        ImmunizationReactionComponent o = (ImmunizationReactionComponent) other;
895        return compareDeep(date, o.date, true) && compareDeep(detail, o.detail, true) && compareDeep(reported, o.reported, true)
896          ;
897      }
898
899      @Override
900      public boolean equalsShallow(Base other) {
901        if (!super.equalsShallow(other))
902          return false;
903        if (!(other instanceof ImmunizationReactionComponent))
904          return false;
905        ImmunizationReactionComponent o = (ImmunizationReactionComponent) other;
906        return compareValues(date, o.date, true) && compareValues(reported, o.reported, true);
907      }
908
909      public boolean isEmpty() {
910        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, detail, reported);
911      }
912
913  public String fhirType() {
914    return "Immunization.reaction";
915
916  }
917
918  }
919
920    @Block()
921    public static class ImmunizationVaccinationProtocolComponent extends BackboneElement implements IBaseBackboneElement {
922        /**
923         * Nominal position in a series.
924         */
925        @Child(name = "doseSequence", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
926        @Description(shortDefinition="Dose number within series", formalDefinition="Nominal position in a series." )
927        protected PositiveIntType doseSequence;
928
929        /**
930         * Contains the description about the protocol under which the vaccine was administered.
931         */
932        @Child(name = "description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
933        @Description(shortDefinition="Details of vaccine protocol", formalDefinition="Contains the description about the protocol under which the vaccine was administered." )
934        protected StringType description;
935
936        /**
937         * Indicates the authority who published the protocol.  E.g. ACIP.
938         */
939        @Child(name = "authority", type = {Organization.class}, order=3, min=0, max=1, modifier=false, summary=false)
940        @Description(shortDefinition="Who is responsible for protocol", formalDefinition="Indicates the authority who published the protocol.  E.g. ACIP." )
941        protected Reference authority;
942
943        /**
944         * The actual object that is the target of the reference (Indicates the authority who published the protocol.  E.g. ACIP.)
945         */
946        protected Organization authorityTarget;
947
948        /**
949         * One possible path to achieve presumed immunity against a disease - within the context of an authority.
950         */
951        @Child(name = "series", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
952        @Description(shortDefinition="Name of vaccine series", formalDefinition="One possible path to achieve presumed immunity against a disease - within the context of an authority." )
953        protected StringType series;
954
955        /**
956         * The recommended number of doses to achieve immunity.
957         */
958        @Child(name = "seriesDoses", type = {PositiveIntType.class}, order=5, min=0, max=1, modifier=false, summary=false)
959        @Description(shortDefinition="Recommended number of doses for immunity", formalDefinition="The recommended number of doses to achieve immunity." )
960        protected PositiveIntType seriesDoses;
961
962        /**
963         * The targeted disease.
964         */
965        @Child(name = "targetDisease", type = {CodeableConcept.class}, order=6, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
966        @Description(shortDefinition="Disease immunized against", formalDefinition="The targeted disease." )
967        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/vaccination-protocol-dose-target")
968        protected List<CodeableConcept> targetDisease;
969
970        /**
971         * Indicates if the immunization event should "count" against  the protocol.
972         */
973        @Child(name = "doseStatus", type = {CodeableConcept.class}, order=7, min=1, max=1, modifier=false, summary=false)
974        @Description(shortDefinition="Indicates if dose counts towards immunity", formalDefinition="Indicates if the immunization event should \"count\" against  the protocol." )
975        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/vaccination-protocol-dose-status")
976        protected CodeableConcept doseStatus;
977
978        /**
979         * Provides an explanation as to why an immunization event should or should not count against the protocol.
980         */
981        @Child(name = "doseStatusReason", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
982        @Description(shortDefinition="Why dose does (not) count", formalDefinition="Provides an explanation as to why an immunization event should or should not count against the protocol." )
983        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/vaccination-protocol-dose-status-reason")
984        protected CodeableConcept doseStatusReason;
985
986        private static final long serialVersionUID = 386814037L;
987
988    /**
989     * Constructor
990     */
991      public ImmunizationVaccinationProtocolComponent() {
992        super();
993      }
994
995    /**
996     * Constructor
997     */
998      public ImmunizationVaccinationProtocolComponent(CodeableConcept doseStatus) {
999        super();
1000        this.doseStatus = doseStatus;
1001      }
1002
1003        /**
1004         * @return {@link #doseSequence} (Nominal position in a series.). This is the underlying object with id, value and extensions. The accessor "getDoseSequence" gives direct access to the value
1005         */
1006        public PositiveIntType getDoseSequenceElement() { 
1007          if (this.doseSequence == null)
1008            if (Configuration.errorOnAutoCreate())
1009              throw new Error("Attempt to auto-create ImmunizationVaccinationProtocolComponent.doseSequence");
1010            else if (Configuration.doAutoCreate())
1011              this.doseSequence = new PositiveIntType(); // bb
1012          return this.doseSequence;
1013        }
1014
1015        public boolean hasDoseSequenceElement() { 
1016          return this.doseSequence != null && !this.doseSequence.isEmpty();
1017        }
1018
1019        public boolean hasDoseSequence() { 
1020          return this.doseSequence != null && !this.doseSequence.isEmpty();
1021        }
1022
1023        /**
1024         * @param value {@link #doseSequence} (Nominal position in a series.). This is the underlying object with id, value and extensions. The accessor "getDoseSequence" gives direct access to the value
1025         */
1026        public ImmunizationVaccinationProtocolComponent setDoseSequenceElement(PositiveIntType value) { 
1027          this.doseSequence = value;
1028          return this;
1029        }
1030
1031        /**
1032         * @return Nominal position in a series.
1033         */
1034        public int getDoseSequence() { 
1035          return this.doseSequence == null || this.doseSequence.isEmpty() ? 0 : this.doseSequence.getValue();
1036        }
1037
1038        /**
1039         * @param value Nominal position in a series.
1040         */
1041        public ImmunizationVaccinationProtocolComponent setDoseSequence(int value) { 
1042            if (this.doseSequence == null)
1043              this.doseSequence = new PositiveIntType();
1044            this.doseSequence.setValue(value);
1045          return this;
1046        }
1047
1048        /**
1049         * @return {@link #description} (Contains the description about the protocol under which the vaccine was administered.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1050         */
1051        public StringType getDescriptionElement() { 
1052          if (this.description == null)
1053            if (Configuration.errorOnAutoCreate())
1054              throw new Error("Attempt to auto-create ImmunizationVaccinationProtocolComponent.description");
1055            else if (Configuration.doAutoCreate())
1056              this.description = new StringType(); // bb
1057          return this.description;
1058        }
1059
1060        public boolean hasDescriptionElement() { 
1061          return this.description != null && !this.description.isEmpty();
1062        }
1063
1064        public boolean hasDescription() { 
1065          return this.description != null && !this.description.isEmpty();
1066        }
1067
1068        /**
1069         * @param value {@link #description} (Contains the description about the protocol under which the vaccine was administered.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1070         */
1071        public ImmunizationVaccinationProtocolComponent setDescriptionElement(StringType value) { 
1072          this.description = value;
1073          return this;
1074        }
1075
1076        /**
1077         * @return Contains the description about the protocol under which the vaccine was administered.
1078         */
1079        public String getDescription() { 
1080          return this.description == null ? null : this.description.getValue();
1081        }
1082
1083        /**
1084         * @param value Contains the description about the protocol under which the vaccine was administered.
1085         */
1086        public ImmunizationVaccinationProtocolComponent setDescription(String value) { 
1087          if (Utilities.noString(value))
1088            this.description = null;
1089          else {
1090            if (this.description == null)
1091              this.description = new StringType();
1092            this.description.setValue(value);
1093          }
1094          return this;
1095        }
1096
1097        /**
1098         * @return {@link #authority} (Indicates the authority who published the protocol.  E.g. ACIP.)
1099         */
1100        public Reference getAuthority() { 
1101          if (this.authority == null)
1102            if (Configuration.errorOnAutoCreate())
1103              throw new Error("Attempt to auto-create ImmunizationVaccinationProtocolComponent.authority");
1104            else if (Configuration.doAutoCreate())
1105              this.authority = new Reference(); // cc
1106          return this.authority;
1107        }
1108
1109        public boolean hasAuthority() { 
1110          return this.authority != null && !this.authority.isEmpty();
1111        }
1112
1113        /**
1114         * @param value {@link #authority} (Indicates the authority who published the protocol.  E.g. ACIP.)
1115         */
1116        public ImmunizationVaccinationProtocolComponent setAuthority(Reference value) { 
1117          this.authority = value;
1118          return this;
1119        }
1120
1121        /**
1122         * @return {@link #authority} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Indicates the authority who published the protocol.  E.g. ACIP.)
1123         */
1124        public Organization getAuthorityTarget() { 
1125          if (this.authorityTarget == null)
1126            if (Configuration.errorOnAutoCreate())
1127              throw new Error("Attempt to auto-create ImmunizationVaccinationProtocolComponent.authority");
1128            else if (Configuration.doAutoCreate())
1129              this.authorityTarget = new Organization(); // aa
1130          return this.authorityTarget;
1131        }
1132
1133        /**
1134         * @param value {@link #authority} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Indicates the authority who published the protocol.  E.g. ACIP.)
1135         */
1136        public ImmunizationVaccinationProtocolComponent setAuthorityTarget(Organization value) { 
1137          this.authorityTarget = value;
1138          return this;
1139        }
1140
1141        /**
1142         * @return {@link #series} (One possible path to achieve presumed immunity against a disease - within the context of an authority.). This is the underlying object with id, value and extensions. The accessor "getSeries" gives direct access to the value
1143         */
1144        public StringType getSeriesElement() { 
1145          if (this.series == null)
1146            if (Configuration.errorOnAutoCreate())
1147              throw new Error("Attempt to auto-create ImmunizationVaccinationProtocolComponent.series");
1148            else if (Configuration.doAutoCreate())
1149              this.series = new StringType(); // bb
1150          return this.series;
1151        }
1152
1153        public boolean hasSeriesElement() { 
1154          return this.series != null && !this.series.isEmpty();
1155        }
1156
1157        public boolean hasSeries() { 
1158          return this.series != null && !this.series.isEmpty();
1159        }
1160
1161        /**
1162         * @param value {@link #series} (One possible path to achieve presumed immunity against a disease - within the context of an authority.). This is the underlying object with id, value and extensions. The accessor "getSeries" gives direct access to the value
1163         */
1164        public ImmunizationVaccinationProtocolComponent setSeriesElement(StringType value) { 
1165          this.series = value;
1166          return this;
1167        }
1168
1169        /**
1170         * @return One possible path to achieve presumed immunity against a disease - within the context of an authority.
1171         */
1172        public String getSeries() { 
1173          return this.series == null ? null : this.series.getValue();
1174        }
1175
1176        /**
1177         * @param value One possible path to achieve presumed immunity against a disease - within the context of an authority.
1178         */
1179        public ImmunizationVaccinationProtocolComponent setSeries(String value) { 
1180          if (Utilities.noString(value))
1181            this.series = null;
1182          else {
1183            if (this.series == null)
1184              this.series = new StringType();
1185            this.series.setValue(value);
1186          }
1187          return this;
1188        }
1189
1190        /**
1191         * @return {@link #seriesDoses} (The recommended number of doses to achieve immunity.). This is the underlying object with id, value and extensions. The accessor "getSeriesDoses" gives direct access to the value
1192         */
1193        public PositiveIntType getSeriesDosesElement() { 
1194          if (this.seriesDoses == null)
1195            if (Configuration.errorOnAutoCreate())
1196              throw new Error("Attempt to auto-create ImmunizationVaccinationProtocolComponent.seriesDoses");
1197            else if (Configuration.doAutoCreate())
1198              this.seriesDoses = new PositiveIntType(); // bb
1199          return this.seriesDoses;
1200        }
1201
1202        public boolean hasSeriesDosesElement() { 
1203          return this.seriesDoses != null && !this.seriesDoses.isEmpty();
1204        }
1205
1206        public boolean hasSeriesDoses() { 
1207          return this.seriesDoses != null && !this.seriesDoses.isEmpty();
1208        }
1209
1210        /**
1211         * @param value {@link #seriesDoses} (The recommended number of doses to achieve immunity.). This is the underlying object with id, value and extensions. The accessor "getSeriesDoses" gives direct access to the value
1212         */
1213        public ImmunizationVaccinationProtocolComponent setSeriesDosesElement(PositiveIntType value) { 
1214          this.seriesDoses = value;
1215          return this;
1216        }
1217
1218        /**
1219         * @return The recommended number of doses to achieve immunity.
1220         */
1221        public int getSeriesDoses() { 
1222          return this.seriesDoses == null || this.seriesDoses.isEmpty() ? 0 : this.seriesDoses.getValue();
1223        }
1224
1225        /**
1226         * @param value The recommended number of doses to achieve immunity.
1227         */
1228        public ImmunizationVaccinationProtocolComponent setSeriesDoses(int value) { 
1229            if (this.seriesDoses == null)
1230              this.seriesDoses = new PositiveIntType();
1231            this.seriesDoses.setValue(value);
1232          return this;
1233        }
1234
1235        /**
1236         * @return {@link #targetDisease} (The targeted disease.)
1237         */
1238        public List<CodeableConcept> getTargetDisease() { 
1239          if (this.targetDisease == null)
1240            this.targetDisease = new ArrayList<CodeableConcept>();
1241          return this.targetDisease;
1242        }
1243
1244        /**
1245         * @return Returns a reference to <code>this</code> for easy method chaining
1246         */
1247        public ImmunizationVaccinationProtocolComponent setTargetDisease(List<CodeableConcept> theTargetDisease) { 
1248          this.targetDisease = theTargetDisease;
1249          return this;
1250        }
1251
1252        public boolean hasTargetDisease() { 
1253          if (this.targetDisease == null)
1254            return false;
1255          for (CodeableConcept item : this.targetDisease)
1256            if (!item.isEmpty())
1257              return true;
1258          return false;
1259        }
1260
1261        public CodeableConcept addTargetDisease() { //3
1262          CodeableConcept t = new CodeableConcept();
1263          if (this.targetDisease == null)
1264            this.targetDisease = new ArrayList<CodeableConcept>();
1265          this.targetDisease.add(t);
1266          return t;
1267        }
1268
1269        public ImmunizationVaccinationProtocolComponent addTargetDisease(CodeableConcept t) { //3
1270          if (t == null)
1271            return this;
1272          if (this.targetDisease == null)
1273            this.targetDisease = new ArrayList<CodeableConcept>();
1274          this.targetDisease.add(t);
1275          return this;
1276        }
1277
1278        /**
1279         * @return The first repetition of repeating field {@link #targetDisease}, creating it if it does not already exist
1280         */
1281        public CodeableConcept getTargetDiseaseFirstRep() { 
1282          if (getTargetDisease().isEmpty()) {
1283            addTargetDisease();
1284          }
1285          return getTargetDisease().get(0);
1286        }
1287
1288        /**
1289         * @return {@link #doseStatus} (Indicates if the immunization event should "count" against  the protocol.)
1290         */
1291        public CodeableConcept getDoseStatus() { 
1292          if (this.doseStatus == null)
1293            if (Configuration.errorOnAutoCreate())
1294              throw new Error("Attempt to auto-create ImmunizationVaccinationProtocolComponent.doseStatus");
1295            else if (Configuration.doAutoCreate())
1296              this.doseStatus = new CodeableConcept(); // cc
1297          return this.doseStatus;
1298        }
1299
1300        public boolean hasDoseStatus() { 
1301          return this.doseStatus != null && !this.doseStatus.isEmpty();
1302        }
1303
1304        /**
1305         * @param value {@link #doseStatus} (Indicates if the immunization event should "count" against  the protocol.)
1306         */
1307        public ImmunizationVaccinationProtocolComponent setDoseStatus(CodeableConcept value) { 
1308          this.doseStatus = value;
1309          return this;
1310        }
1311
1312        /**
1313         * @return {@link #doseStatusReason} (Provides an explanation as to why an immunization event should or should not count against the protocol.)
1314         */
1315        public CodeableConcept getDoseStatusReason() { 
1316          if (this.doseStatusReason == null)
1317            if (Configuration.errorOnAutoCreate())
1318              throw new Error("Attempt to auto-create ImmunizationVaccinationProtocolComponent.doseStatusReason");
1319            else if (Configuration.doAutoCreate())
1320              this.doseStatusReason = new CodeableConcept(); // cc
1321          return this.doseStatusReason;
1322        }
1323
1324        public boolean hasDoseStatusReason() { 
1325          return this.doseStatusReason != null && !this.doseStatusReason.isEmpty();
1326        }
1327
1328        /**
1329         * @param value {@link #doseStatusReason} (Provides an explanation as to why an immunization event should or should not count against the protocol.)
1330         */
1331        public ImmunizationVaccinationProtocolComponent setDoseStatusReason(CodeableConcept value) { 
1332          this.doseStatusReason = value;
1333          return this;
1334        }
1335
1336        protected void listChildren(List<Property> childrenList) {
1337          super.listChildren(childrenList);
1338          childrenList.add(new Property("doseSequence", "positiveInt", "Nominal position in a series.", 0, java.lang.Integer.MAX_VALUE, doseSequence));
1339          childrenList.add(new Property("description", "string", "Contains the description about the protocol under which the vaccine was administered.", 0, java.lang.Integer.MAX_VALUE, description));
1340          childrenList.add(new Property("authority", "Reference(Organization)", "Indicates the authority who published the protocol.  E.g. ACIP.", 0, java.lang.Integer.MAX_VALUE, authority));
1341          childrenList.add(new Property("series", "string", "One possible path to achieve presumed immunity against a disease - within the context of an authority.", 0, java.lang.Integer.MAX_VALUE, series));
1342          childrenList.add(new Property("seriesDoses", "positiveInt", "The recommended number of doses to achieve immunity.", 0, java.lang.Integer.MAX_VALUE, seriesDoses));
1343          childrenList.add(new Property("targetDisease", "CodeableConcept", "The targeted disease.", 0, java.lang.Integer.MAX_VALUE, targetDisease));
1344          childrenList.add(new Property("doseStatus", "CodeableConcept", "Indicates if the immunization event should \"count\" against  the protocol.", 0, java.lang.Integer.MAX_VALUE, doseStatus));
1345          childrenList.add(new Property("doseStatusReason", "CodeableConcept", "Provides an explanation as to why an immunization event should or should not count against the protocol.", 0, java.lang.Integer.MAX_VALUE, doseStatusReason));
1346        }
1347
1348      @Override
1349      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1350        switch (hash) {
1351        case 550933246: /*doseSequence*/ return this.doseSequence == null ? new Base[0] : new Base[] {this.doseSequence}; // PositiveIntType
1352        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1353        case 1475610435: /*authority*/ return this.authority == null ? new Base[0] : new Base[] {this.authority}; // Reference
1354        case -905838985: /*series*/ return this.series == null ? new Base[0] : new Base[] {this.series}; // StringType
1355        case -1936727105: /*seriesDoses*/ return this.seriesDoses == null ? new Base[0] : new Base[] {this.seriesDoses}; // PositiveIntType
1356        case -319593813: /*targetDisease*/ return this.targetDisease == null ? new Base[0] : this.targetDisease.toArray(new Base[this.targetDisease.size()]); // CodeableConcept
1357        case -745826705: /*doseStatus*/ return this.doseStatus == null ? new Base[0] : new Base[] {this.doseStatus}; // CodeableConcept
1358        case 662783379: /*doseStatusReason*/ return this.doseStatusReason == null ? new Base[0] : new Base[] {this.doseStatusReason}; // CodeableConcept
1359        default: return super.getProperty(hash, name, checkValid);
1360        }
1361
1362      }
1363
1364      @Override
1365      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1366        switch (hash) {
1367        case 550933246: // doseSequence
1368          this.doseSequence = castToPositiveInt(value); // PositiveIntType
1369          return value;
1370        case -1724546052: // description
1371          this.description = castToString(value); // StringType
1372          return value;
1373        case 1475610435: // authority
1374          this.authority = castToReference(value); // Reference
1375          return value;
1376        case -905838985: // series
1377          this.series = castToString(value); // StringType
1378          return value;
1379        case -1936727105: // seriesDoses
1380          this.seriesDoses = castToPositiveInt(value); // PositiveIntType
1381          return value;
1382        case -319593813: // targetDisease
1383          this.getTargetDisease().add(castToCodeableConcept(value)); // CodeableConcept
1384          return value;
1385        case -745826705: // doseStatus
1386          this.doseStatus = castToCodeableConcept(value); // CodeableConcept
1387          return value;
1388        case 662783379: // doseStatusReason
1389          this.doseStatusReason = castToCodeableConcept(value); // CodeableConcept
1390          return value;
1391        default: return super.setProperty(hash, name, value);
1392        }
1393
1394      }
1395
1396      @Override
1397      public Base setProperty(String name, Base value) throws FHIRException {
1398        if (name.equals("doseSequence")) {
1399          this.doseSequence = castToPositiveInt(value); // PositiveIntType
1400        } else if (name.equals("description")) {
1401          this.description = castToString(value); // StringType
1402        } else if (name.equals("authority")) {
1403          this.authority = castToReference(value); // Reference
1404        } else if (name.equals("series")) {
1405          this.series = castToString(value); // StringType
1406        } else if (name.equals("seriesDoses")) {
1407          this.seriesDoses = castToPositiveInt(value); // PositiveIntType
1408        } else if (name.equals("targetDisease")) {
1409          this.getTargetDisease().add(castToCodeableConcept(value));
1410        } else if (name.equals("doseStatus")) {
1411          this.doseStatus = castToCodeableConcept(value); // CodeableConcept
1412        } else if (name.equals("doseStatusReason")) {
1413          this.doseStatusReason = castToCodeableConcept(value); // CodeableConcept
1414        } else
1415          return super.setProperty(name, value);
1416        return value;
1417      }
1418
1419      @Override
1420      public Base makeProperty(int hash, String name) throws FHIRException {
1421        switch (hash) {
1422        case 550933246:  return getDoseSequenceElement();
1423        case -1724546052:  return getDescriptionElement();
1424        case 1475610435:  return getAuthority(); 
1425        case -905838985:  return getSeriesElement();
1426        case -1936727105:  return getSeriesDosesElement();
1427        case -319593813:  return addTargetDisease(); 
1428        case -745826705:  return getDoseStatus(); 
1429        case 662783379:  return getDoseStatusReason(); 
1430        default: return super.makeProperty(hash, name);
1431        }
1432
1433      }
1434
1435      @Override
1436      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1437        switch (hash) {
1438        case 550933246: /*doseSequence*/ return new String[] {"positiveInt"};
1439        case -1724546052: /*description*/ return new String[] {"string"};
1440        case 1475610435: /*authority*/ return new String[] {"Reference"};
1441        case -905838985: /*series*/ return new String[] {"string"};
1442        case -1936727105: /*seriesDoses*/ return new String[] {"positiveInt"};
1443        case -319593813: /*targetDisease*/ return new String[] {"CodeableConcept"};
1444        case -745826705: /*doseStatus*/ return new String[] {"CodeableConcept"};
1445        case 662783379: /*doseStatusReason*/ return new String[] {"CodeableConcept"};
1446        default: return super.getTypesForProperty(hash, name);
1447        }
1448
1449      }
1450
1451      @Override
1452      public Base addChild(String name) throws FHIRException {
1453        if (name.equals("doseSequence")) {
1454          throw new FHIRException("Cannot call addChild on a primitive type Immunization.doseSequence");
1455        }
1456        else if (name.equals("description")) {
1457          throw new FHIRException("Cannot call addChild on a primitive type Immunization.description");
1458        }
1459        else if (name.equals("authority")) {
1460          this.authority = new Reference();
1461          return this.authority;
1462        }
1463        else if (name.equals("series")) {
1464          throw new FHIRException("Cannot call addChild on a primitive type Immunization.series");
1465        }
1466        else if (name.equals("seriesDoses")) {
1467          throw new FHIRException("Cannot call addChild on a primitive type Immunization.seriesDoses");
1468        }
1469        else if (name.equals("targetDisease")) {
1470          return addTargetDisease();
1471        }
1472        else if (name.equals("doseStatus")) {
1473          this.doseStatus = new CodeableConcept();
1474          return this.doseStatus;
1475        }
1476        else if (name.equals("doseStatusReason")) {
1477          this.doseStatusReason = new CodeableConcept();
1478          return this.doseStatusReason;
1479        }
1480        else
1481          return super.addChild(name);
1482      }
1483
1484      public ImmunizationVaccinationProtocolComponent copy() {
1485        ImmunizationVaccinationProtocolComponent dst = new ImmunizationVaccinationProtocolComponent();
1486        copyValues(dst);
1487        dst.doseSequence = doseSequence == null ? null : doseSequence.copy();
1488        dst.description = description == null ? null : description.copy();
1489        dst.authority = authority == null ? null : authority.copy();
1490        dst.series = series == null ? null : series.copy();
1491        dst.seriesDoses = seriesDoses == null ? null : seriesDoses.copy();
1492        if (targetDisease != null) {
1493          dst.targetDisease = new ArrayList<CodeableConcept>();
1494          for (CodeableConcept i : targetDisease)
1495            dst.targetDisease.add(i.copy());
1496        };
1497        dst.doseStatus = doseStatus == null ? null : doseStatus.copy();
1498        dst.doseStatusReason = doseStatusReason == null ? null : doseStatusReason.copy();
1499        return dst;
1500      }
1501
1502      @Override
1503      public boolean equalsDeep(Base other) {
1504        if (!super.equalsDeep(other))
1505          return false;
1506        if (!(other instanceof ImmunizationVaccinationProtocolComponent))
1507          return false;
1508        ImmunizationVaccinationProtocolComponent o = (ImmunizationVaccinationProtocolComponent) other;
1509        return compareDeep(doseSequence, o.doseSequence, true) && compareDeep(description, o.description, true)
1510           && compareDeep(authority, o.authority, true) && compareDeep(series, o.series, true) && compareDeep(seriesDoses, o.seriesDoses, true)
1511           && compareDeep(targetDisease, o.targetDisease, true) && compareDeep(doseStatus, o.doseStatus, true)
1512           && compareDeep(doseStatusReason, o.doseStatusReason, true);
1513      }
1514
1515      @Override
1516      public boolean equalsShallow(Base other) {
1517        if (!super.equalsShallow(other))
1518          return false;
1519        if (!(other instanceof ImmunizationVaccinationProtocolComponent))
1520          return false;
1521        ImmunizationVaccinationProtocolComponent o = (ImmunizationVaccinationProtocolComponent) other;
1522        return compareValues(doseSequence, o.doseSequence, true) && compareValues(description, o.description, true)
1523           && compareValues(series, o.series, true) && compareValues(seriesDoses, o.seriesDoses, true);
1524      }
1525
1526      public boolean isEmpty() {
1527        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(doseSequence, description
1528          , authority, series, seriesDoses, targetDisease, doseStatus, doseStatusReason);
1529      }
1530
1531  public String fhirType() {
1532    return "Immunization.vaccinationProtocol";
1533
1534  }
1535
1536  }
1537
1538    /**
1539     * A unique identifier assigned to this immunization record.
1540     */
1541    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1542    @Description(shortDefinition="Business identifier", formalDefinition="A unique identifier assigned to this immunization record." )
1543    protected List<Identifier> identifier;
1544
1545    /**
1546     * Indicates the current status of the vaccination event.
1547     */
1548    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
1549    @Description(shortDefinition="completed | entered-in-error", formalDefinition="Indicates the current status of the vaccination event." )
1550    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/immunization-status")
1551    protected Enumeration<ImmunizationStatus> status;
1552
1553    /**
1554     * Indicates if the vaccination was or was not given.
1555     */
1556    @Child(name = "notGiven", type = {BooleanType.class}, order=2, min=1, max=1, modifier=true, summary=true)
1557    @Description(shortDefinition="Flag for whether immunization was given", formalDefinition="Indicates if the vaccination was or was not given." )
1558    protected BooleanType notGiven;
1559
1560    /**
1561     * Vaccine that was administered or was to be administered.
1562     */
1563    @Child(name = "vaccineCode", type = {CodeableConcept.class}, order=3, min=1, max=1, modifier=false, summary=false)
1564    @Description(shortDefinition="Vaccine product administered", formalDefinition="Vaccine that was administered or was to be administered." )
1565    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/vaccine-code")
1566    protected CodeableConcept vaccineCode;
1567
1568    /**
1569     * The patient who either received or did not receive the immunization.
1570     */
1571    @Child(name = "patient", type = {Patient.class}, order=4, min=1, max=1, modifier=false, summary=false)
1572    @Description(shortDefinition="Who was immunized", formalDefinition="The patient who either received or did not receive the immunization." )
1573    protected Reference patient;
1574
1575    /**
1576     * The actual object that is the target of the reference (The patient who either received or did not receive the immunization.)
1577     */
1578    protected Patient patientTarget;
1579
1580    /**
1581     * The visit or admission or other contact between patient and health care provider the immunization was performed as part of.
1582     */
1583    @Child(name = "encounter", type = {Encounter.class}, order=5, min=0, max=1, modifier=false, summary=false)
1584    @Description(shortDefinition="Encounter administered as part of", formalDefinition="The visit or admission or other contact between patient and health care provider the immunization was performed as part of." )
1585    protected Reference encounter;
1586
1587    /**
1588     * The actual object that is the target of the reference (The visit or admission or other contact between patient and health care provider the immunization was performed as part of.)
1589     */
1590    protected Encounter encounterTarget;
1591
1592    /**
1593     * Date vaccine administered or was to be administered.
1594     */
1595    @Child(name = "date", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=false)
1596    @Description(shortDefinition="Vaccination administration date", formalDefinition="Date vaccine administered or was to be administered." )
1597    protected DateTimeType date;
1598
1599    /**
1600     * An indication that the content of the record is based on information from the person who administered the vaccine. This reflects the context under which the data was originally recorded.
1601     */
1602    @Child(name = "primarySource", type = {BooleanType.class}, order=7, min=1, max=1, modifier=false, summary=false)
1603    @Description(shortDefinition="Indicates context the data was recorded in", formalDefinition="An indication that the content of the record is based on information from the person who administered the vaccine. This reflects the context under which the data was originally recorded." )
1604    protected BooleanType primarySource;
1605
1606    /**
1607     * The source of the data when the report of the immunization event is not based on information from the person who administered the vaccine.
1608     */
1609    @Child(name = "reportOrigin", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
1610    @Description(shortDefinition="Indicates the source of a secondarily reported record", formalDefinition="The source of the data when the report of the immunization event is not based on information from the person who administered the vaccine." )
1611    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/immunization-origin")
1612    protected CodeableConcept reportOrigin;
1613
1614    /**
1615     * The service delivery location where the vaccine administration occurred.
1616     */
1617    @Child(name = "location", type = {Location.class}, order=9, min=0, max=1, modifier=false, summary=false)
1618    @Description(shortDefinition="Where vaccination occurred", formalDefinition="The service delivery location where the vaccine administration occurred." )
1619    protected Reference location;
1620
1621    /**
1622     * The actual object that is the target of the reference (The service delivery location where the vaccine administration occurred.)
1623     */
1624    protected Location locationTarget;
1625
1626    /**
1627     * Name of vaccine manufacturer.
1628     */
1629    @Child(name = "manufacturer", type = {Organization.class}, order=10, min=0, max=1, modifier=false, summary=false)
1630    @Description(shortDefinition="Vaccine manufacturer", formalDefinition="Name of vaccine manufacturer." )
1631    protected Reference manufacturer;
1632
1633    /**
1634     * The actual object that is the target of the reference (Name of vaccine manufacturer.)
1635     */
1636    protected Organization manufacturerTarget;
1637
1638    /**
1639     * Lot number of the  vaccine product.
1640     */
1641    @Child(name = "lotNumber", type = {StringType.class}, order=11, min=0, max=1, modifier=false, summary=false)
1642    @Description(shortDefinition="Vaccine lot number", formalDefinition="Lot number of the  vaccine product." )
1643    protected StringType lotNumber;
1644
1645    /**
1646     * Date vaccine batch expires.
1647     */
1648    @Child(name = "expirationDate", type = {DateType.class}, order=12, min=0, max=1, modifier=false, summary=false)
1649    @Description(shortDefinition="Vaccine expiration date", formalDefinition="Date vaccine batch expires." )
1650    protected DateType expirationDate;
1651
1652    /**
1653     * Body site where vaccine was administered.
1654     */
1655    @Child(name = "site", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false)
1656    @Description(shortDefinition="Body site vaccine  was administered", formalDefinition="Body site where vaccine was administered." )
1657    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/immunization-site")
1658    protected CodeableConcept site;
1659
1660    /**
1661     * The path by which the vaccine product is taken into the body.
1662     */
1663    @Child(name = "route", type = {CodeableConcept.class}, order=14, min=0, max=1, modifier=false, summary=false)
1664    @Description(shortDefinition="How vaccine entered body", formalDefinition="The path by which the vaccine product is taken into the body." )
1665    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/immunization-route")
1666    protected CodeableConcept route;
1667
1668    /**
1669     * The quantity of vaccine product that was administered.
1670     */
1671    @Child(name = "doseQuantity", type = {SimpleQuantity.class}, order=15, min=0, max=1, modifier=false, summary=false)
1672    @Description(shortDefinition="Amount of vaccine administered", formalDefinition="The quantity of vaccine product that was administered." )
1673    protected SimpleQuantity doseQuantity;
1674
1675    /**
1676     * Indicates who or what performed the event.
1677     */
1678    @Child(name = "practitioner", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1679    @Description(shortDefinition="Who performed event", formalDefinition="Indicates who or what performed the event." )
1680    protected List<ImmunizationPractitionerComponent> practitioner;
1681
1682    /**
1683     * Extra information about the immunization that is not conveyed by the other attributes.
1684     */
1685    @Child(name = "note", type = {Annotation.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1686    @Description(shortDefinition="Vaccination notes", formalDefinition="Extra information about the immunization that is not conveyed by the other attributes." )
1687    protected List<Annotation> note;
1688
1689    /**
1690     * Reasons why a vaccine was or was not administered.
1691     */
1692    @Child(name = "explanation", type = {}, order=18, min=0, max=1, modifier=false, summary=false)
1693    @Description(shortDefinition="Administration/non-administration reasons", formalDefinition="Reasons why a vaccine was or was not administered." )
1694    protected ImmunizationExplanationComponent explanation;
1695
1696    /**
1697     * Categorical data indicating that an adverse event is associated in time to an immunization.
1698     */
1699    @Child(name = "reaction", type = {}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1700    @Description(shortDefinition="Details of a reaction that follows immunization", formalDefinition="Categorical data indicating that an adverse event is associated in time to an immunization." )
1701    protected List<ImmunizationReactionComponent> reaction;
1702
1703    /**
1704     * Contains information about the protocol(s) under which the vaccine was administered.
1705     */
1706    @Child(name = "vaccinationProtocol", type = {}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1707    @Description(shortDefinition="What protocol was followed", formalDefinition="Contains information about the protocol(s) under which the vaccine was administered." )
1708    protected List<ImmunizationVaccinationProtocolComponent> vaccinationProtocol;
1709
1710    private static final long serialVersionUID = 658058655L;
1711
1712  /**
1713   * Constructor
1714   */
1715    public Immunization() {
1716      super();
1717    }
1718
1719  /**
1720   * Constructor
1721   */
1722    public Immunization(Enumeration<ImmunizationStatus> status, BooleanType notGiven, CodeableConcept vaccineCode, Reference patient, BooleanType primarySource) {
1723      super();
1724      this.status = status;
1725      this.notGiven = notGiven;
1726      this.vaccineCode = vaccineCode;
1727      this.patient = patient;
1728      this.primarySource = primarySource;
1729    }
1730
1731    /**
1732     * @return {@link #identifier} (A unique identifier assigned to this immunization record.)
1733     */
1734    public List<Identifier> getIdentifier() { 
1735      if (this.identifier == null)
1736        this.identifier = new ArrayList<Identifier>();
1737      return this.identifier;
1738    }
1739
1740    /**
1741     * @return Returns a reference to <code>this</code> for easy method chaining
1742     */
1743    public Immunization setIdentifier(List<Identifier> theIdentifier) { 
1744      this.identifier = theIdentifier;
1745      return this;
1746    }
1747
1748    public boolean hasIdentifier() { 
1749      if (this.identifier == null)
1750        return false;
1751      for (Identifier item : this.identifier)
1752        if (!item.isEmpty())
1753          return true;
1754      return false;
1755    }
1756
1757    public Identifier addIdentifier() { //3
1758      Identifier t = new Identifier();
1759      if (this.identifier == null)
1760        this.identifier = new ArrayList<Identifier>();
1761      this.identifier.add(t);
1762      return t;
1763    }
1764
1765    public Immunization addIdentifier(Identifier t) { //3
1766      if (t == null)
1767        return this;
1768      if (this.identifier == null)
1769        this.identifier = new ArrayList<Identifier>();
1770      this.identifier.add(t);
1771      return this;
1772    }
1773
1774    /**
1775     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1776     */
1777    public Identifier getIdentifierFirstRep() { 
1778      if (getIdentifier().isEmpty()) {
1779        addIdentifier();
1780      }
1781      return getIdentifier().get(0);
1782    }
1783
1784    /**
1785     * @return {@link #status} (Indicates the current status of the vaccination event.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1786     */
1787    public Enumeration<ImmunizationStatus> getStatusElement() { 
1788      if (this.status == null)
1789        if (Configuration.errorOnAutoCreate())
1790          throw new Error("Attempt to auto-create Immunization.status");
1791        else if (Configuration.doAutoCreate())
1792          this.status = new Enumeration<ImmunizationStatus>(new ImmunizationStatusEnumFactory()); // bb
1793      return this.status;
1794    }
1795
1796    public boolean hasStatusElement() { 
1797      return this.status != null && !this.status.isEmpty();
1798    }
1799
1800    public boolean hasStatus() { 
1801      return this.status != null && !this.status.isEmpty();
1802    }
1803
1804    /**
1805     * @param value {@link #status} (Indicates the current status of the vaccination event.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1806     */
1807    public Immunization setStatusElement(Enumeration<ImmunizationStatus> value) { 
1808      this.status = value;
1809      return this;
1810    }
1811
1812    /**
1813     * @return Indicates the current status of the vaccination event.
1814     */
1815    public ImmunizationStatus getStatus() { 
1816      return this.status == null ? null : this.status.getValue();
1817    }
1818
1819    /**
1820     * @param value Indicates the current status of the vaccination event.
1821     */
1822    public Immunization setStatus(ImmunizationStatus value) { 
1823        if (this.status == null)
1824          this.status = new Enumeration<ImmunizationStatus>(new ImmunizationStatusEnumFactory());
1825        this.status.setValue(value);
1826      return this;
1827    }
1828
1829    /**
1830     * @return {@link #notGiven} (Indicates if the vaccination was or was not given.). This is the underlying object with id, value and extensions. The accessor "getNotGiven" gives direct access to the value
1831     */
1832    public BooleanType getNotGivenElement() { 
1833      if (this.notGiven == null)
1834        if (Configuration.errorOnAutoCreate())
1835          throw new Error("Attempt to auto-create Immunization.notGiven");
1836        else if (Configuration.doAutoCreate())
1837          this.notGiven = new BooleanType(); // bb
1838      return this.notGiven;
1839    }
1840
1841    public boolean hasNotGivenElement() { 
1842      return this.notGiven != null && !this.notGiven.isEmpty();
1843    }
1844
1845    public boolean hasNotGiven() { 
1846      return this.notGiven != null && !this.notGiven.isEmpty();
1847    }
1848
1849    /**
1850     * @param value {@link #notGiven} (Indicates if the vaccination was or was not given.). This is the underlying object with id, value and extensions. The accessor "getNotGiven" gives direct access to the value
1851     */
1852    public Immunization setNotGivenElement(BooleanType value) { 
1853      this.notGiven = value;
1854      return this;
1855    }
1856
1857    /**
1858     * @return Indicates if the vaccination was or was not given.
1859     */
1860    public boolean getNotGiven() { 
1861      return this.notGiven == null || this.notGiven.isEmpty() ? false : this.notGiven.getValue();
1862    }
1863
1864    /**
1865     * @param value Indicates if the vaccination was or was not given.
1866     */
1867    public Immunization setNotGiven(boolean value) { 
1868        if (this.notGiven == null)
1869          this.notGiven = new BooleanType();
1870        this.notGiven.setValue(value);
1871      return this;
1872    }
1873
1874    /**
1875     * @return {@link #vaccineCode} (Vaccine that was administered or was to be administered.)
1876     */
1877    public CodeableConcept getVaccineCode() { 
1878      if (this.vaccineCode == null)
1879        if (Configuration.errorOnAutoCreate())
1880          throw new Error("Attempt to auto-create Immunization.vaccineCode");
1881        else if (Configuration.doAutoCreate())
1882          this.vaccineCode = new CodeableConcept(); // cc
1883      return this.vaccineCode;
1884    }
1885
1886    public boolean hasVaccineCode() { 
1887      return this.vaccineCode != null && !this.vaccineCode.isEmpty();
1888    }
1889
1890    /**
1891     * @param value {@link #vaccineCode} (Vaccine that was administered or was to be administered.)
1892     */
1893    public Immunization setVaccineCode(CodeableConcept value) { 
1894      this.vaccineCode = value;
1895      return this;
1896    }
1897
1898    /**
1899     * @return {@link #patient} (The patient who either received or did not receive the immunization.)
1900     */
1901    public Reference getPatient() { 
1902      if (this.patient == null)
1903        if (Configuration.errorOnAutoCreate())
1904          throw new Error("Attempt to auto-create Immunization.patient");
1905        else if (Configuration.doAutoCreate())
1906          this.patient = new Reference(); // cc
1907      return this.patient;
1908    }
1909
1910    public boolean hasPatient() { 
1911      return this.patient != null && !this.patient.isEmpty();
1912    }
1913
1914    /**
1915     * @param value {@link #patient} (The patient who either received or did not receive the immunization.)
1916     */
1917    public Immunization setPatient(Reference value) { 
1918      this.patient = value;
1919      return this;
1920    }
1921
1922    /**
1923     * @return {@link #patient} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The patient who either received or did not receive the immunization.)
1924     */
1925    public Patient getPatientTarget() { 
1926      if (this.patientTarget == null)
1927        if (Configuration.errorOnAutoCreate())
1928          throw new Error("Attempt to auto-create Immunization.patient");
1929        else if (Configuration.doAutoCreate())
1930          this.patientTarget = new Patient(); // aa
1931      return this.patientTarget;
1932    }
1933
1934    /**
1935     * @param value {@link #patient} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The patient who either received or did not receive the immunization.)
1936     */
1937    public Immunization setPatientTarget(Patient value) { 
1938      this.patientTarget = value;
1939      return this;
1940    }
1941
1942    /**
1943     * @return {@link #encounter} (The visit or admission or other contact between patient and health care provider the immunization was performed as part of.)
1944     */
1945    public Reference getEncounter() { 
1946      if (this.encounter == null)
1947        if (Configuration.errorOnAutoCreate())
1948          throw new Error("Attempt to auto-create Immunization.encounter");
1949        else if (Configuration.doAutoCreate())
1950          this.encounter = new Reference(); // cc
1951      return this.encounter;
1952    }
1953
1954    public boolean hasEncounter() { 
1955      return this.encounter != null && !this.encounter.isEmpty();
1956    }
1957
1958    /**
1959     * @param value {@link #encounter} (The visit or admission or other contact between patient and health care provider the immunization was performed as part of.)
1960     */
1961    public Immunization setEncounter(Reference value) { 
1962      this.encounter = value;
1963      return this;
1964    }
1965
1966    /**
1967     * @return {@link #encounter} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The visit or admission or other contact between patient and health care provider the immunization was performed as part of.)
1968     */
1969    public Encounter getEncounterTarget() { 
1970      if (this.encounterTarget == null)
1971        if (Configuration.errorOnAutoCreate())
1972          throw new Error("Attempt to auto-create Immunization.encounter");
1973        else if (Configuration.doAutoCreate())
1974          this.encounterTarget = new Encounter(); // aa
1975      return this.encounterTarget;
1976    }
1977
1978    /**
1979     * @param value {@link #encounter} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The visit or admission or other contact between patient and health care provider the immunization was performed as part of.)
1980     */
1981    public Immunization setEncounterTarget(Encounter value) { 
1982      this.encounterTarget = value;
1983      return this;
1984    }
1985
1986    /**
1987     * @return {@link #date} (Date vaccine administered or was to be administered.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1988     */
1989    public DateTimeType getDateElement() { 
1990      if (this.date == null)
1991        if (Configuration.errorOnAutoCreate())
1992          throw new Error("Attempt to auto-create Immunization.date");
1993        else if (Configuration.doAutoCreate())
1994          this.date = new DateTimeType(); // bb
1995      return this.date;
1996    }
1997
1998    public boolean hasDateElement() { 
1999      return this.date != null && !this.date.isEmpty();
2000    }
2001
2002    public boolean hasDate() { 
2003      return this.date != null && !this.date.isEmpty();
2004    }
2005
2006    /**
2007     * @param value {@link #date} (Date vaccine administered or was to be administered.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2008     */
2009    public Immunization setDateElement(DateTimeType value) { 
2010      this.date = value;
2011      return this;
2012    }
2013
2014    /**
2015     * @return Date vaccine administered or was to be administered.
2016     */
2017    public Date getDate() { 
2018      return this.date == null ? null : this.date.getValue();
2019    }
2020
2021    /**
2022     * @param value Date vaccine administered or was to be administered.
2023     */
2024    public Immunization setDate(Date value) { 
2025      if (value == null)
2026        this.date = null;
2027      else {
2028        if (this.date == null)
2029          this.date = new DateTimeType();
2030        this.date.setValue(value);
2031      }
2032      return this;
2033    }
2034
2035    /**
2036     * @return {@link #primarySource} (An indication that the content of the record is based on information from the person who administered the vaccine. This reflects the context under which the data was originally recorded.). This is the underlying object with id, value and extensions. The accessor "getPrimarySource" gives direct access to the value
2037     */
2038    public BooleanType getPrimarySourceElement() { 
2039      if (this.primarySource == null)
2040        if (Configuration.errorOnAutoCreate())
2041          throw new Error("Attempt to auto-create Immunization.primarySource");
2042        else if (Configuration.doAutoCreate())
2043          this.primarySource = new BooleanType(); // bb
2044      return this.primarySource;
2045    }
2046
2047    public boolean hasPrimarySourceElement() { 
2048      return this.primarySource != null && !this.primarySource.isEmpty();
2049    }
2050
2051    public boolean hasPrimarySource() { 
2052      return this.primarySource != null && !this.primarySource.isEmpty();
2053    }
2054
2055    /**
2056     * @param value {@link #primarySource} (An indication that the content of the record is based on information from the person who administered the vaccine. This reflects the context under which the data was originally recorded.). This is the underlying object with id, value and extensions. The accessor "getPrimarySource" gives direct access to the value
2057     */
2058    public Immunization setPrimarySourceElement(BooleanType value) { 
2059      this.primarySource = value;
2060      return this;
2061    }
2062
2063    /**
2064     * @return An indication that the content of the record is based on information from the person who administered the vaccine. This reflects the context under which the data was originally recorded.
2065     */
2066    public boolean getPrimarySource() { 
2067      return this.primarySource == null || this.primarySource.isEmpty() ? false : this.primarySource.getValue();
2068    }
2069
2070    /**
2071     * @param value An indication that the content of the record is based on information from the person who administered the vaccine. This reflects the context under which the data was originally recorded.
2072     */
2073    public Immunization setPrimarySource(boolean value) { 
2074        if (this.primarySource == null)
2075          this.primarySource = new BooleanType();
2076        this.primarySource.setValue(value);
2077      return this;
2078    }
2079
2080    /**
2081     * @return {@link #reportOrigin} (The source of the data when the report of the immunization event is not based on information from the person who administered the vaccine.)
2082     */
2083    public CodeableConcept getReportOrigin() { 
2084      if (this.reportOrigin == null)
2085        if (Configuration.errorOnAutoCreate())
2086          throw new Error("Attempt to auto-create Immunization.reportOrigin");
2087        else if (Configuration.doAutoCreate())
2088          this.reportOrigin = new CodeableConcept(); // cc
2089      return this.reportOrigin;
2090    }
2091
2092    public boolean hasReportOrigin() { 
2093      return this.reportOrigin != null && !this.reportOrigin.isEmpty();
2094    }
2095
2096    /**
2097     * @param value {@link #reportOrigin} (The source of the data when the report of the immunization event is not based on information from the person who administered the vaccine.)
2098     */
2099    public Immunization setReportOrigin(CodeableConcept value) { 
2100      this.reportOrigin = value;
2101      return this;
2102    }
2103
2104    /**
2105     * @return {@link #location} (The service delivery location where the vaccine administration occurred.)
2106     */
2107    public Reference getLocation() { 
2108      if (this.location == null)
2109        if (Configuration.errorOnAutoCreate())
2110          throw new Error("Attempt to auto-create Immunization.location");
2111        else if (Configuration.doAutoCreate())
2112          this.location = new Reference(); // cc
2113      return this.location;
2114    }
2115
2116    public boolean hasLocation() { 
2117      return this.location != null && !this.location.isEmpty();
2118    }
2119
2120    /**
2121     * @param value {@link #location} (The service delivery location where the vaccine administration occurred.)
2122     */
2123    public Immunization setLocation(Reference value) { 
2124      this.location = value;
2125      return this;
2126    }
2127
2128    /**
2129     * @return {@link #location} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The service delivery location where the vaccine administration occurred.)
2130     */
2131    public Location getLocationTarget() { 
2132      if (this.locationTarget == null)
2133        if (Configuration.errorOnAutoCreate())
2134          throw new Error("Attempt to auto-create Immunization.location");
2135        else if (Configuration.doAutoCreate())
2136          this.locationTarget = new Location(); // aa
2137      return this.locationTarget;
2138    }
2139
2140    /**
2141     * @param value {@link #location} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The service delivery location where the vaccine administration occurred.)
2142     */
2143    public Immunization setLocationTarget(Location value) { 
2144      this.locationTarget = value;
2145      return this;
2146    }
2147
2148    /**
2149     * @return {@link #manufacturer} (Name of vaccine manufacturer.)
2150     */
2151    public Reference getManufacturer() { 
2152      if (this.manufacturer == null)
2153        if (Configuration.errorOnAutoCreate())
2154          throw new Error("Attempt to auto-create Immunization.manufacturer");
2155        else if (Configuration.doAutoCreate())
2156          this.manufacturer = new Reference(); // cc
2157      return this.manufacturer;
2158    }
2159
2160    public boolean hasManufacturer() { 
2161      return this.manufacturer != null && !this.manufacturer.isEmpty();
2162    }
2163
2164    /**
2165     * @param value {@link #manufacturer} (Name of vaccine manufacturer.)
2166     */
2167    public Immunization setManufacturer(Reference value) { 
2168      this.manufacturer = value;
2169      return this;
2170    }
2171
2172    /**
2173     * @return {@link #manufacturer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Name of vaccine manufacturer.)
2174     */
2175    public Organization getManufacturerTarget() { 
2176      if (this.manufacturerTarget == null)
2177        if (Configuration.errorOnAutoCreate())
2178          throw new Error("Attempt to auto-create Immunization.manufacturer");
2179        else if (Configuration.doAutoCreate())
2180          this.manufacturerTarget = new Organization(); // aa
2181      return this.manufacturerTarget;
2182    }
2183
2184    /**
2185     * @param value {@link #manufacturer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Name of vaccine manufacturer.)
2186     */
2187    public Immunization setManufacturerTarget(Organization value) { 
2188      this.manufacturerTarget = value;
2189      return this;
2190    }
2191
2192    /**
2193     * @return {@link #lotNumber} (Lot number of the  vaccine product.). This is the underlying object with id, value and extensions. The accessor "getLotNumber" gives direct access to the value
2194     */
2195    public StringType getLotNumberElement() { 
2196      if (this.lotNumber == null)
2197        if (Configuration.errorOnAutoCreate())
2198          throw new Error("Attempt to auto-create Immunization.lotNumber");
2199        else if (Configuration.doAutoCreate())
2200          this.lotNumber = new StringType(); // bb
2201      return this.lotNumber;
2202    }
2203
2204    public boolean hasLotNumberElement() { 
2205      return this.lotNumber != null && !this.lotNumber.isEmpty();
2206    }
2207
2208    public boolean hasLotNumber() { 
2209      return this.lotNumber != null && !this.lotNumber.isEmpty();
2210    }
2211
2212    /**
2213     * @param value {@link #lotNumber} (Lot number of the  vaccine product.). This is the underlying object with id, value and extensions. The accessor "getLotNumber" gives direct access to the value
2214     */
2215    public Immunization setLotNumberElement(StringType value) { 
2216      this.lotNumber = value;
2217      return this;
2218    }
2219
2220    /**
2221     * @return Lot number of the  vaccine product.
2222     */
2223    public String getLotNumber() { 
2224      return this.lotNumber == null ? null : this.lotNumber.getValue();
2225    }
2226
2227    /**
2228     * @param value Lot number of the  vaccine product.
2229     */
2230    public Immunization setLotNumber(String value) { 
2231      if (Utilities.noString(value))
2232        this.lotNumber = null;
2233      else {
2234        if (this.lotNumber == null)
2235          this.lotNumber = new StringType();
2236        this.lotNumber.setValue(value);
2237      }
2238      return this;
2239    }
2240
2241    /**
2242     * @return {@link #expirationDate} (Date vaccine batch expires.). This is the underlying object with id, value and extensions. The accessor "getExpirationDate" gives direct access to the value
2243     */
2244    public DateType getExpirationDateElement() { 
2245      if (this.expirationDate == null)
2246        if (Configuration.errorOnAutoCreate())
2247          throw new Error("Attempt to auto-create Immunization.expirationDate");
2248        else if (Configuration.doAutoCreate())
2249          this.expirationDate = new DateType(); // bb
2250      return this.expirationDate;
2251    }
2252
2253    public boolean hasExpirationDateElement() { 
2254      return this.expirationDate != null && !this.expirationDate.isEmpty();
2255    }
2256
2257    public boolean hasExpirationDate() { 
2258      return this.expirationDate != null && !this.expirationDate.isEmpty();
2259    }
2260
2261    /**
2262     * @param value {@link #expirationDate} (Date vaccine batch expires.). This is the underlying object with id, value and extensions. The accessor "getExpirationDate" gives direct access to the value
2263     */
2264    public Immunization setExpirationDateElement(DateType value) { 
2265      this.expirationDate = value;
2266      return this;
2267    }
2268
2269    /**
2270     * @return Date vaccine batch expires.
2271     */
2272    public Date getExpirationDate() { 
2273      return this.expirationDate == null ? null : this.expirationDate.getValue();
2274    }
2275
2276    /**
2277     * @param value Date vaccine batch expires.
2278     */
2279    public Immunization setExpirationDate(Date value) { 
2280      if (value == null)
2281        this.expirationDate = null;
2282      else {
2283        if (this.expirationDate == null)
2284          this.expirationDate = new DateType();
2285        this.expirationDate.setValue(value);
2286      }
2287      return this;
2288    }
2289
2290    /**
2291     * @return {@link #site} (Body site where vaccine was administered.)
2292     */
2293    public CodeableConcept getSite() { 
2294      if (this.site == null)
2295        if (Configuration.errorOnAutoCreate())
2296          throw new Error("Attempt to auto-create Immunization.site");
2297        else if (Configuration.doAutoCreate())
2298          this.site = new CodeableConcept(); // cc
2299      return this.site;
2300    }
2301
2302    public boolean hasSite() { 
2303      return this.site != null && !this.site.isEmpty();
2304    }
2305
2306    /**
2307     * @param value {@link #site} (Body site where vaccine was administered.)
2308     */
2309    public Immunization setSite(CodeableConcept value) { 
2310      this.site = value;
2311      return this;
2312    }
2313
2314    /**
2315     * @return {@link #route} (The path by which the vaccine product is taken into the body.)
2316     */
2317    public CodeableConcept getRoute() { 
2318      if (this.route == null)
2319        if (Configuration.errorOnAutoCreate())
2320          throw new Error("Attempt to auto-create Immunization.route");
2321        else if (Configuration.doAutoCreate())
2322          this.route = new CodeableConcept(); // cc
2323      return this.route;
2324    }
2325
2326    public boolean hasRoute() { 
2327      return this.route != null && !this.route.isEmpty();
2328    }
2329
2330    /**
2331     * @param value {@link #route} (The path by which the vaccine product is taken into the body.)
2332     */
2333    public Immunization setRoute(CodeableConcept value) { 
2334      this.route = value;
2335      return this;
2336    }
2337
2338    /**
2339     * @return {@link #doseQuantity} (The quantity of vaccine product that was administered.)
2340     */
2341    public SimpleQuantity getDoseQuantity() { 
2342      if (this.doseQuantity == null)
2343        if (Configuration.errorOnAutoCreate())
2344          throw new Error("Attempt to auto-create Immunization.doseQuantity");
2345        else if (Configuration.doAutoCreate())
2346          this.doseQuantity = new SimpleQuantity(); // cc
2347      return this.doseQuantity;
2348    }
2349
2350    public boolean hasDoseQuantity() { 
2351      return this.doseQuantity != null && !this.doseQuantity.isEmpty();
2352    }
2353
2354    /**
2355     * @param value {@link #doseQuantity} (The quantity of vaccine product that was administered.)
2356     */
2357    public Immunization setDoseQuantity(SimpleQuantity value) { 
2358      this.doseQuantity = value;
2359      return this;
2360    }
2361
2362    /**
2363     * @return {@link #practitioner} (Indicates who or what performed the event.)
2364     */
2365    public List<ImmunizationPractitionerComponent> getPractitioner() { 
2366      if (this.practitioner == null)
2367        this.practitioner = new ArrayList<ImmunizationPractitionerComponent>();
2368      return this.practitioner;
2369    }
2370
2371    /**
2372     * @return Returns a reference to <code>this</code> for easy method chaining
2373     */
2374    public Immunization setPractitioner(List<ImmunizationPractitionerComponent> thePractitioner) { 
2375      this.practitioner = thePractitioner;
2376      return this;
2377    }
2378
2379    public boolean hasPractitioner() { 
2380      if (this.practitioner == null)
2381        return false;
2382      for (ImmunizationPractitionerComponent item : this.practitioner)
2383        if (!item.isEmpty())
2384          return true;
2385      return false;
2386    }
2387
2388    public ImmunizationPractitionerComponent addPractitioner() { //3
2389      ImmunizationPractitionerComponent t = new ImmunizationPractitionerComponent();
2390      if (this.practitioner == null)
2391        this.practitioner = new ArrayList<ImmunizationPractitionerComponent>();
2392      this.practitioner.add(t);
2393      return t;
2394    }
2395
2396    public Immunization addPractitioner(ImmunizationPractitionerComponent t) { //3
2397      if (t == null)
2398        return this;
2399      if (this.practitioner == null)
2400        this.practitioner = new ArrayList<ImmunizationPractitionerComponent>();
2401      this.practitioner.add(t);
2402      return this;
2403    }
2404
2405    /**
2406     * @return The first repetition of repeating field {@link #practitioner}, creating it if it does not already exist
2407     */
2408    public ImmunizationPractitionerComponent getPractitionerFirstRep() { 
2409      if (getPractitioner().isEmpty()) {
2410        addPractitioner();
2411      }
2412      return getPractitioner().get(0);
2413    }
2414
2415    /**
2416     * @return {@link #note} (Extra information about the immunization that is not conveyed by the other attributes.)
2417     */
2418    public List<Annotation> getNote() { 
2419      if (this.note == null)
2420        this.note = new ArrayList<Annotation>();
2421      return this.note;
2422    }
2423
2424    /**
2425     * @return Returns a reference to <code>this</code> for easy method chaining
2426     */
2427    public Immunization setNote(List<Annotation> theNote) { 
2428      this.note = theNote;
2429      return this;
2430    }
2431
2432    public boolean hasNote() { 
2433      if (this.note == null)
2434        return false;
2435      for (Annotation item : this.note)
2436        if (!item.isEmpty())
2437          return true;
2438      return false;
2439    }
2440
2441    public Annotation addNote() { //3
2442      Annotation t = new Annotation();
2443      if (this.note == null)
2444        this.note = new ArrayList<Annotation>();
2445      this.note.add(t);
2446      return t;
2447    }
2448
2449    public Immunization addNote(Annotation t) { //3
2450      if (t == null)
2451        return this;
2452      if (this.note == null)
2453        this.note = new ArrayList<Annotation>();
2454      this.note.add(t);
2455      return this;
2456    }
2457
2458    /**
2459     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
2460     */
2461    public Annotation getNoteFirstRep() { 
2462      if (getNote().isEmpty()) {
2463        addNote();
2464      }
2465      return getNote().get(0);
2466    }
2467
2468    /**
2469     * @return {@link #explanation} (Reasons why a vaccine was or was not administered.)
2470     */
2471    public ImmunizationExplanationComponent getExplanation() { 
2472      if (this.explanation == null)
2473        if (Configuration.errorOnAutoCreate())
2474          throw new Error("Attempt to auto-create Immunization.explanation");
2475        else if (Configuration.doAutoCreate())
2476          this.explanation = new ImmunizationExplanationComponent(); // cc
2477      return this.explanation;
2478    }
2479
2480    public boolean hasExplanation() { 
2481      return this.explanation != null && !this.explanation.isEmpty();
2482    }
2483
2484    /**
2485     * @param value {@link #explanation} (Reasons why a vaccine was or was not administered.)
2486     */
2487    public Immunization setExplanation(ImmunizationExplanationComponent value) { 
2488      this.explanation = value;
2489      return this;
2490    }
2491
2492    /**
2493     * @return {@link #reaction} (Categorical data indicating that an adverse event is associated in time to an immunization.)
2494     */
2495    public List<ImmunizationReactionComponent> getReaction() { 
2496      if (this.reaction == null)
2497        this.reaction = new ArrayList<ImmunizationReactionComponent>();
2498      return this.reaction;
2499    }
2500
2501    /**
2502     * @return Returns a reference to <code>this</code> for easy method chaining
2503     */
2504    public Immunization setReaction(List<ImmunizationReactionComponent> theReaction) { 
2505      this.reaction = theReaction;
2506      return this;
2507    }
2508
2509    public boolean hasReaction() { 
2510      if (this.reaction == null)
2511        return false;
2512      for (ImmunizationReactionComponent item : this.reaction)
2513        if (!item.isEmpty())
2514          return true;
2515      return false;
2516    }
2517
2518    public ImmunizationReactionComponent addReaction() { //3
2519      ImmunizationReactionComponent t = new ImmunizationReactionComponent();
2520      if (this.reaction == null)
2521        this.reaction = new ArrayList<ImmunizationReactionComponent>();
2522      this.reaction.add(t);
2523      return t;
2524    }
2525
2526    public Immunization addReaction(ImmunizationReactionComponent t) { //3
2527      if (t == null)
2528        return this;
2529      if (this.reaction == null)
2530        this.reaction = new ArrayList<ImmunizationReactionComponent>();
2531      this.reaction.add(t);
2532      return this;
2533    }
2534
2535    /**
2536     * @return The first repetition of repeating field {@link #reaction}, creating it if it does not already exist
2537     */
2538    public ImmunizationReactionComponent getReactionFirstRep() { 
2539      if (getReaction().isEmpty()) {
2540        addReaction();
2541      }
2542      return getReaction().get(0);
2543    }
2544
2545    /**
2546     * @return {@link #vaccinationProtocol} (Contains information about the protocol(s) under which the vaccine was administered.)
2547     */
2548    public List<ImmunizationVaccinationProtocolComponent> getVaccinationProtocol() { 
2549      if (this.vaccinationProtocol == null)
2550        this.vaccinationProtocol = new ArrayList<ImmunizationVaccinationProtocolComponent>();
2551      return this.vaccinationProtocol;
2552    }
2553
2554    /**
2555     * @return Returns a reference to <code>this</code> for easy method chaining
2556     */
2557    public Immunization setVaccinationProtocol(List<ImmunizationVaccinationProtocolComponent> theVaccinationProtocol) { 
2558      this.vaccinationProtocol = theVaccinationProtocol;
2559      return this;
2560    }
2561
2562    public boolean hasVaccinationProtocol() { 
2563      if (this.vaccinationProtocol == null)
2564        return false;
2565      for (ImmunizationVaccinationProtocolComponent item : this.vaccinationProtocol)
2566        if (!item.isEmpty())
2567          return true;
2568      return false;
2569    }
2570
2571    public ImmunizationVaccinationProtocolComponent addVaccinationProtocol() { //3
2572      ImmunizationVaccinationProtocolComponent t = new ImmunizationVaccinationProtocolComponent();
2573      if (this.vaccinationProtocol == null)
2574        this.vaccinationProtocol = new ArrayList<ImmunizationVaccinationProtocolComponent>();
2575      this.vaccinationProtocol.add(t);
2576      return t;
2577    }
2578
2579    public Immunization addVaccinationProtocol(ImmunizationVaccinationProtocolComponent t) { //3
2580      if (t == null)
2581        return this;
2582      if (this.vaccinationProtocol == null)
2583        this.vaccinationProtocol = new ArrayList<ImmunizationVaccinationProtocolComponent>();
2584      this.vaccinationProtocol.add(t);
2585      return this;
2586    }
2587
2588    /**
2589     * @return The first repetition of repeating field {@link #vaccinationProtocol}, creating it if it does not already exist
2590     */
2591    public ImmunizationVaccinationProtocolComponent getVaccinationProtocolFirstRep() { 
2592      if (getVaccinationProtocol().isEmpty()) {
2593        addVaccinationProtocol();
2594      }
2595      return getVaccinationProtocol().get(0);
2596    }
2597
2598      protected void listChildren(List<Property> childrenList) {
2599        super.listChildren(childrenList);
2600        childrenList.add(new Property("identifier", "Identifier", "A unique identifier assigned to this immunization record.", 0, java.lang.Integer.MAX_VALUE, identifier));
2601        childrenList.add(new Property("status", "code", "Indicates the current status of the vaccination event.", 0, java.lang.Integer.MAX_VALUE, status));
2602        childrenList.add(new Property("notGiven", "boolean", "Indicates if the vaccination was or was not given.", 0, java.lang.Integer.MAX_VALUE, notGiven));
2603        childrenList.add(new Property("vaccineCode", "CodeableConcept", "Vaccine that was administered or was to be administered.", 0, java.lang.Integer.MAX_VALUE, vaccineCode));
2604        childrenList.add(new Property("patient", "Reference(Patient)", "The patient who either received or did not receive the immunization.", 0, java.lang.Integer.MAX_VALUE, patient));
2605        childrenList.add(new Property("encounter", "Reference(Encounter)", "The visit or admission or other contact between patient and health care provider the immunization was performed as part of.", 0, java.lang.Integer.MAX_VALUE, encounter));
2606        childrenList.add(new Property("date", "dateTime", "Date vaccine administered or was to be administered.", 0, java.lang.Integer.MAX_VALUE, date));
2607        childrenList.add(new Property("primarySource", "boolean", "An indication that the content of the record is based on information from the person who administered the vaccine. This reflects the context under which the data was originally recorded.", 0, java.lang.Integer.MAX_VALUE, primarySource));
2608        childrenList.add(new Property("reportOrigin", "CodeableConcept", "The source of the data when the report of the immunization event is not based on information from the person who administered the vaccine.", 0, java.lang.Integer.MAX_VALUE, reportOrigin));
2609        childrenList.add(new Property("location", "Reference(Location)", "The service delivery location where the vaccine administration occurred.", 0, java.lang.Integer.MAX_VALUE, location));
2610        childrenList.add(new Property("manufacturer", "Reference(Organization)", "Name of vaccine manufacturer.", 0, java.lang.Integer.MAX_VALUE, manufacturer));
2611        childrenList.add(new Property("lotNumber", "string", "Lot number of the  vaccine product.", 0, java.lang.Integer.MAX_VALUE, lotNumber));
2612        childrenList.add(new Property("expirationDate", "date", "Date vaccine batch expires.", 0, java.lang.Integer.MAX_VALUE, expirationDate));
2613        childrenList.add(new Property("site", "CodeableConcept", "Body site where vaccine was administered.", 0, java.lang.Integer.MAX_VALUE, site));
2614        childrenList.add(new Property("route", "CodeableConcept", "The path by which the vaccine product is taken into the body.", 0, java.lang.Integer.MAX_VALUE, route));
2615        childrenList.add(new Property("doseQuantity", "SimpleQuantity", "The quantity of vaccine product that was administered.", 0, java.lang.Integer.MAX_VALUE, doseQuantity));
2616        childrenList.add(new Property("practitioner", "", "Indicates who or what performed the event.", 0, java.lang.Integer.MAX_VALUE, practitioner));
2617        childrenList.add(new Property("note", "Annotation", "Extra information about the immunization that is not conveyed by the other attributes.", 0, java.lang.Integer.MAX_VALUE, note));
2618        childrenList.add(new Property("explanation", "", "Reasons why a vaccine was or was not administered.", 0, java.lang.Integer.MAX_VALUE, explanation));
2619        childrenList.add(new Property("reaction", "", "Categorical data indicating that an adverse event is associated in time to an immunization.", 0, java.lang.Integer.MAX_VALUE, reaction));
2620        childrenList.add(new Property("vaccinationProtocol", "", "Contains information about the protocol(s) under which the vaccine was administered.", 0, java.lang.Integer.MAX_VALUE, vaccinationProtocol));
2621      }
2622
2623      @Override
2624      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2625        switch (hash) {
2626        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2627        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ImmunizationStatus>
2628        case 1554065514: /*notGiven*/ return this.notGiven == null ? new Base[0] : new Base[] {this.notGiven}; // BooleanType
2629        case 664556354: /*vaccineCode*/ return this.vaccineCode == null ? new Base[0] : new Base[] {this.vaccineCode}; // CodeableConcept
2630        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
2631        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
2632        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2633        case -528721731: /*primarySource*/ return this.primarySource == null ? new Base[0] : new Base[] {this.primarySource}; // BooleanType
2634        case 486750586: /*reportOrigin*/ return this.reportOrigin == null ? new Base[0] : new Base[] {this.reportOrigin}; // CodeableConcept
2635        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
2636        case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : new Base[] {this.manufacturer}; // Reference
2637        case 462547450: /*lotNumber*/ return this.lotNumber == null ? new Base[0] : new Base[] {this.lotNumber}; // StringType
2638        case -668811523: /*expirationDate*/ return this.expirationDate == null ? new Base[0] : new Base[] {this.expirationDate}; // DateType
2639        case 3530567: /*site*/ return this.site == null ? new Base[0] : new Base[] {this.site}; // CodeableConcept
2640        case 108704329: /*route*/ return this.route == null ? new Base[0] : new Base[] {this.route}; // CodeableConcept
2641        case -2083618872: /*doseQuantity*/ return this.doseQuantity == null ? new Base[0] : new Base[] {this.doseQuantity}; // SimpleQuantity
2642        case 574573338: /*practitioner*/ return this.practitioner == null ? new Base[0] : this.practitioner.toArray(new Base[this.practitioner.size()]); // ImmunizationPractitionerComponent
2643        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2644        case -1105867239: /*explanation*/ return this.explanation == null ? new Base[0] : new Base[] {this.explanation}; // ImmunizationExplanationComponent
2645        case -867509719: /*reaction*/ return this.reaction == null ? new Base[0] : this.reaction.toArray(new Base[this.reaction.size()]); // ImmunizationReactionComponent
2646        case -179633155: /*vaccinationProtocol*/ return this.vaccinationProtocol == null ? new Base[0] : this.vaccinationProtocol.toArray(new Base[this.vaccinationProtocol.size()]); // ImmunizationVaccinationProtocolComponent
2647        default: return super.getProperty(hash, name, checkValid);
2648        }
2649
2650      }
2651
2652      @Override
2653      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2654        switch (hash) {
2655        case -1618432855: // identifier
2656          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2657          return value;
2658        case -892481550: // status
2659          value = new ImmunizationStatusEnumFactory().fromType(castToCode(value));
2660          this.status = (Enumeration) value; // Enumeration<ImmunizationStatus>
2661          return value;
2662        case 1554065514: // notGiven
2663          this.notGiven = castToBoolean(value); // BooleanType
2664          return value;
2665        case 664556354: // vaccineCode
2666          this.vaccineCode = castToCodeableConcept(value); // CodeableConcept
2667          return value;
2668        case -791418107: // patient
2669          this.patient = castToReference(value); // Reference
2670          return value;
2671        case 1524132147: // encounter
2672          this.encounter = castToReference(value); // Reference
2673          return value;
2674        case 3076014: // date
2675          this.date = castToDateTime(value); // DateTimeType
2676          return value;
2677        case -528721731: // primarySource
2678          this.primarySource = castToBoolean(value); // BooleanType
2679          return value;
2680        case 486750586: // reportOrigin
2681          this.reportOrigin = castToCodeableConcept(value); // CodeableConcept
2682          return value;
2683        case 1901043637: // location
2684          this.location = castToReference(value); // Reference
2685          return value;
2686        case -1969347631: // manufacturer
2687          this.manufacturer = castToReference(value); // Reference
2688          return value;
2689        case 462547450: // lotNumber
2690          this.lotNumber = castToString(value); // StringType
2691          return value;
2692        case -668811523: // expirationDate
2693          this.expirationDate = castToDate(value); // DateType
2694          return value;
2695        case 3530567: // site
2696          this.site = castToCodeableConcept(value); // CodeableConcept
2697          return value;
2698        case 108704329: // route
2699          this.route = castToCodeableConcept(value); // CodeableConcept
2700          return value;
2701        case -2083618872: // doseQuantity
2702          this.doseQuantity = castToSimpleQuantity(value); // SimpleQuantity
2703          return value;
2704        case 574573338: // practitioner
2705          this.getPractitioner().add((ImmunizationPractitionerComponent) value); // ImmunizationPractitionerComponent
2706          return value;
2707        case 3387378: // note
2708          this.getNote().add(castToAnnotation(value)); // Annotation
2709          return value;
2710        case -1105867239: // explanation
2711          this.explanation = (ImmunizationExplanationComponent) value; // ImmunizationExplanationComponent
2712          return value;
2713        case -867509719: // reaction
2714          this.getReaction().add((ImmunizationReactionComponent) value); // ImmunizationReactionComponent
2715          return value;
2716        case -179633155: // vaccinationProtocol
2717          this.getVaccinationProtocol().add((ImmunizationVaccinationProtocolComponent) value); // ImmunizationVaccinationProtocolComponent
2718          return value;
2719        default: return super.setProperty(hash, name, value);
2720        }
2721
2722      }
2723
2724      @Override
2725      public Base setProperty(String name, Base value) throws FHIRException {
2726        if (name.equals("identifier")) {
2727          this.getIdentifier().add(castToIdentifier(value));
2728        } else if (name.equals("status")) {
2729          value = new ImmunizationStatusEnumFactory().fromType(castToCode(value));
2730          this.status = (Enumeration) value; // Enumeration<ImmunizationStatus>
2731        } else if (name.equals("notGiven")) {
2732          this.notGiven = castToBoolean(value); // BooleanType
2733        } else if (name.equals("vaccineCode")) {
2734          this.vaccineCode = castToCodeableConcept(value); // CodeableConcept
2735        } else if (name.equals("patient")) {
2736          this.patient = castToReference(value); // Reference
2737        } else if (name.equals("encounter")) {
2738          this.encounter = castToReference(value); // Reference
2739        } else if (name.equals("date")) {
2740          this.date = castToDateTime(value); // DateTimeType
2741        } else if (name.equals("primarySource")) {
2742          this.primarySource = castToBoolean(value); // BooleanType
2743        } else if (name.equals("reportOrigin")) {
2744          this.reportOrigin = castToCodeableConcept(value); // CodeableConcept
2745        } else if (name.equals("location")) {
2746          this.location = castToReference(value); // Reference
2747        } else if (name.equals("manufacturer")) {
2748          this.manufacturer = castToReference(value); // Reference
2749        } else if (name.equals("lotNumber")) {
2750          this.lotNumber = castToString(value); // StringType
2751        } else if (name.equals("expirationDate")) {
2752          this.expirationDate = castToDate(value); // DateType
2753        } else if (name.equals("site")) {
2754          this.site = castToCodeableConcept(value); // CodeableConcept
2755        } else if (name.equals("route")) {
2756          this.route = castToCodeableConcept(value); // CodeableConcept
2757        } else if (name.equals("doseQuantity")) {
2758          this.doseQuantity = castToSimpleQuantity(value); // SimpleQuantity
2759        } else if (name.equals("practitioner")) {
2760          this.getPractitioner().add((ImmunizationPractitionerComponent) value);
2761        } else if (name.equals("note")) {
2762          this.getNote().add(castToAnnotation(value));
2763        } else if (name.equals("explanation")) {
2764          this.explanation = (ImmunizationExplanationComponent) value; // ImmunizationExplanationComponent
2765        } else if (name.equals("reaction")) {
2766          this.getReaction().add((ImmunizationReactionComponent) value);
2767        } else if (name.equals("vaccinationProtocol")) {
2768          this.getVaccinationProtocol().add((ImmunizationVaccinationProtocolComponent) value);
2769        } else
2770          return super.setProperty(name, value);
2771        return value;
2772      }
2773
2774      @Override
2775      public Base makeProperty(int hash, String name) throws FHIRException {
2776        switch (hash) {
2777        case -1618432855:  return addIdentifier(); 
2778        case -892481550:  return getStatusElement();
2779        case 1554065514:  return getNotGivenElement();
2780        case 664556354:  return getVaccineCode(); 
2781        case -791418107:  return getPatient(); 
2782        case 1524132147:  return getEncounter(); 
2783        case 3076014:  return getDateElement();
2784        case -528721731:  return getPrimarySourceElement();
2785        case 486750586:  return getReportOrigin(); 
2786        case 1901043637:  return getLocation(); 
2787        case -1969347631:  return getManufacturer(); 
2788        case 462547450:  return getLotNumberElement();
2789        case -668811523:  return getExpirationDateElement();
2790        case 3530567:  return getSite(); 
2791        case 108704329:  return getRoute(); 
2792        case -2083618872:  return getDoseQuantity(); 
2793        case 574573338:  return addPractitioner(); 
2794        case 3387378:  return addNote(); 
2795        case -1105867239:  return getExplanation(); 
2796        case -867509719:  return addReaction(); 
2797        case -179633155:  return addVaccinationProtocol(); 
2798        default: return super.makeProperty(hash, name);
2799        }
2800
2801      }
2802
2803      @Override
2804      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2805        switch (hash) {
2806        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2807        case -892481550: /*status*/ return new String[] {"code"};
2808        case 1554065514: /*notGiven*/ return new String[] {"boolean"};
2809        case 664556354: /*vaccineCode*/ return new String[] {"CodeableConcept"};
2810        case -791418107: /*patient*/ return new String[] {"Reference"};
2811        case 1524132147: /*encounter*/ return new String[] {"Reference"};
2812        case 3076014: /*date*/ return new String[] {"dateTime"};
2813        case -528721731: /*primarySource*/ return new String[] {"boolean"};
2814        case 486750586: /*reportOrigin*/ return new String[] {"CodeableConcept"};
2815        case 1901043637: /*location*/ return new String[] {"Reference"};
2816        case -1969347631: /*manufacturer*/ return new String[] {"Reference"};
2817        case 462547450: /*lotNumber*/ return new String[] {"string"};
2818        case -668811523: /*expirationDate*/ return new String[] {"date"};
2819        case 3530567: /*site*/ return new String[] {"CodeableConcept"};
2820        case 108704329: /*route*/ return new String[] {"CodeableConcept"};
2821        case -2083618872: /*doseQuantity*/ return new String[] {"SimpleQuantity"};
2822        case 574573338: /*practitioner*/ return new String[] {};
2823        case 3387378: /*note*/ return new String[] {"Annotation"};
2824        case -1105867239: /*explanation*/ return new String[] {};
2825        case -867509719: /*reaction*/ return new String[] {};
2826        case -179633155: /*vaccinationProtocol*/ return new String[] {};
2827        default: return super.getTypesForProperty(hash, name);
2828        }
2829
2830      }
2831
2832      @Override
2833      public Base addChild(String name) throws FHIRException {
2834        if (name.equals("identifier")) {
2835          return addIdentifier();
2836        }
2837        else if (name.equals("status")) {
2838          throw new FHIRException("Cannot call addChild on a primitive type Immunization.status");
2839        }
2840        else if (name.equals("notGiven")) {
2841          throw new FHIRException("Cannot call addChild on a primitive type Immunization.notGiven");
2842        }
2843        else if (name.equals("vaccineCode")) {
2844          this.vaccineCode = new CodeableConcept();
2845          return this.vaccineCode;
2846        }
2847        else if (name.equals("patient")) {
2848          this.patient = new Reference();
2849          return this.patient;
2850        }
2851        else if (name.equals("encounter")) {
2852          this.encounter = new Reference();
2853          return this.encounter;
2854        }
2855        else if (name.equals("date")) {
2856          throw new FHIRException("Cannot call addChild on a primitive type Immunization.date");
2857        }
2858        else if (name.equals("primarySource")) {
2859          throw new FHIRException("Cannot call addChild on a primitive type Immunization.primarySource");
2860        }
2861        else if (name.equals("reportOrigin")) {
2862          this.reportOrigin = new CodeableConcept();
2863          return this.reportOrigin;
2864        }
2865        else if (name.equals("location")) {
2866          this.location = new Reference();
2867          return this.location;
2868        }
2869        else if (name.equals("manufacturer")) {
2870          this.manufacturer = new Reference();
2871          return this.manufacturer;
2872        }
2873        else if (name.equals("lotNumber")) {
2874          throw new FHIRException("Cannot call addChild on a primitive type Immunization.lotNumber");
2875        }
2876        else if (name.equals("expirationDate")) {
2877          throw new FHIRException("Cannot call addChild on a primitive type Immunization.expirationDate");
2878        }
2879        else if (name.equals("site")) {
2880          this.site = new CodeableConcept();
2881          return this.site;
2882        }
2883        else if (name.equals("route")) {
2884          this.route = new CodeableConcept();
2885          return this.route;
2886        }
2887        else if (name.equals("doseQuantity")) {
2888          this.doseQuantity = new SimpleQuantity();
2889          return this.doseQuantity;
2890        }
2891        else if (name.equals("practitioner")) {
2892          return addPractitioner();
2893        }
2894        else if (name.equals("note")) {
2895          return addNote();
2896        }
2897        else if (name.equals("explanation")) {
2898          this.explanation = new ImmunizationExplanationComponent();
2899          return this.explanation;
2900        }
2901        else if (name.equals("reaction")) {
2902          return addReaction();
2903        }
2904        else if (name.equals("vaccinationProtocol")) {
2905          return addVaccinationProtocol();
2906        }
2907        else
2908          return super.addChild(name);
2909      }
2910
2911  public String fhirType() {
2912    return "Immunization";
2913
2914  }
2915
2916      public Immunization copy() {
2917        Immunization dst = new Immunization();
2918        copyValues(dst);
2919        if (identifier != null) {
2920          dst.identifier = new ArrayList<Identifier>();
2921          for (Identifier i : identifier)
2922            dst.identifier.add(i.copy());
2923        };
2924        dst.status = status == null ? null : status.copy();
2925        dst.notGiven = notGiven == null ? null : notGiven.copy();
2926        dst.vaccineCode = vaccineCode == null ? null : vaccineCode.copy();
2927        dst.patient = patient == null ? null : patient.copy();
2928        dst.encounter = encounter == null ? null : encounter.copy();
2929        dst.date = date == null ? null : date.copy();
2930        dst.primarySource = primarySource == null ? null : primarySource.copy();
2931        dst.reportOrigin = reportOrigin == null ? null : reportOrigin.copy();
2932        dst.location = location == null ? null : location.copy();
2933        dst.manufacturer = manufacturer == null ? null : manufacturer.copy();
2934        dst.lotNumber = lotNumber == null ? null : lotNumber.copy();
2935        dst.expirationDate = expirationDate == null ? null : expirationDate.copy();
2936        dst.site = site == null ? null : site.copy();
2937        dst.route = route == null ? null : route.copy();
2938        dst.doseQuantity = doseQuantity == null ? null : doseQuantity.copy();
2939        if (practitioner != null) {
2940          dst.practitioner = new ArrayList<ImmunizationPractitionerComponent>();
2941          for (ImmunizationPractitionerComponent i : practitioner)
2942            dst.practitioner.add(i.copy());
2943        };
2944        if (note != null) {
2945          dst.note = new ArrayList<Annotation>();
2946          for (Annotation i : note)
2947            dst.note.add(i.copy());
2948        };
2949        dst.explanation = explanation == null ? null : explanation.copy();
2950        if (reaction != null) {
2951          dst.reaction = new ArrayList<ImmunizationReactionComponent>();
2952          for (ImmunizationReactionComponent i : reaction)
2953            dst.reaction.add(i.copy());
2954        };
2955        if (vaccinationProtocol != null) {
2956          dst.vaccinationProtocol = new ArrayList<ImmunizationVaccinationProtocolComponent>();
2957          for (ImmunizationVaccinationProtocolComponent i : vaccinationProtocol)
2958            dst.vaccinationProtocol.add(i.copy());
2959        };
2960        return dst;
2961      }
2962
2963      protected Immunization typedCopy() {
2964        return copy();
2965      }
2966
2967      @Override
2968      public boolean equalsDeep(Base other) {
2969        if (!super.equalsDeep(other))
2970          return false;
2971        if (!(other instanceof Immunization))
2972          return false;
2973        Immunization o = (Immunization) other;
2974        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(notGiven, o.notGiven, true)
2975           && compareDeep(vaccineCode, o.vaccineCode, true) && compareDeep(patient, o.patient, true) && compareDeep(encounter, o.encounter, true)
2976           && compareDeep(date, o.date, true) && compareDeep(primarySource, o.primarySource, true) && compareDeep(reportOrigin, o.reportOrigin, true)
2977           && compareDeep(location, o.location, true) && compareDeep(manufacturer, o.manufacturer, true) && compareDeep(lotNumber, o.lotNumber, true)
2978           && compareDeep(expirationDate, o.expirationDate, true) && compareDeep(site, o.site, true) && compareDeep(route, o.route, true)
2979           && compareDeep(doseQuantity, o.doseQuantity, true) && compareDeep(practitioner, o.practitioner, true)
2980           && compareDeep(note, o.note, true) && compareDeep(explanation, o.explanation, true) && compareDeep(reaction, o.reaction, true)
2981           && compareDeep(vaccinationProtocol, o.vaccinationProtocol, true);
2982      }
2983
2984      @Override
2985      public boolean equalsShallow(Base other) {
2986        if (!super.equalsShallow(other))
2987          return false;
2988        if (!(other instanceof Immunization))
2989          return false;
2990        Immunization o = (Immunization) other;
2991        return compareValues(status, o.status, true) && compareValues(notGiven, o.notGiven, true) && compareValues(date, o.date, true)
2992           && compareValues(primarySource, o.primarySource, true) && compareValues(lotNumber, o.lotNumber, true)
2993           && compareValues(expirationDate, o.expirationDate, true);
2994      }
2995
2996      public boolean isEmpty() {
2997        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, notGiven
2998          , vaccineCode, patient, encounter, date, primarySource, reportOrigin, location
2999          , manufacturer, lotNumber, expirationDate, site, route, doseQuantity, practitioner
3000          , note, explanation, reaction, vaccinationProtocol);
3001      }
3002
3003  @Override
3004  public ResourceType getResourceType() {
3005    return ResourceType.Immunization;
3006   }
3007
3008 /**
3009   * Search parameter: <b>date</b>
3010   * <p>
3011   * Description: <b>Vaccination  (non)-Administration Date</b><br>
3012   * Type: <b>date</b><br>
3013   * Path: <b>Immunization.date</b><br>
3014   * </p>
3015   */
3016  @SearchParamDefinition(name="date", path="Immunization.date", description="Vaccination  (non)-Administration Date", type="date" )
3017  public static final String SP_DATE = "date";
3018 /**
3019   * <b>Fluent Client</b> search parameter constant for <b>date</b>
3020   * <p>
3021   * Description: <b>Vaccination  (non)-Administration Date</b><br>
3022   * Type: <b>date</b><br>
3023   * Path: <b>Immunization.date</b><br>
3024   * </p>
3025   */
3026  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
3027
3028 /**
3029   * Search parameter: <b>identifier</b>
3030   * <p>
3031   * Description: <b>Business identifier</b><br>
3032   * Type: <b>token</b><br>
3033   * Path: <b>Immunization.identifier</b><br>
3034   * </p>
3035   */
3036  @SearchParamDefinition(name="identifier", path="Immunization.identifier", description="Business identifier", type="token" )
3037  public static final String SP_IDENTIFIER = "identifier";
3038 /**
3039   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3040   * <p>
3041   * Description: <b>Business identifier</b><br>
3042   * Type: <b>token</b><br>
3043   * Path: <b>Immunization.identifier</b><br>
3044   * </p>
3045   */
3046  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3047
3048 /**
3049   * Search parameter: <b>reason</b>
3050   * <p>
3051   * Description: <b>Why immunization occurred</b><br>
3052   * Type: <b>token</b><br>
3053   * Path: <b>Immunization.explanation.reason</b><br>
3054   * </p>
3055   */
3056  @SearchParamDefinition(name="reason", path="Immunization.explanation.reason", description="Why immunization occurred", type="token" )
3057  public static final String SP_REASON = "reason";
3058 /**
3059   * <b>Fluent Client</b> search parameter constant for <b>reason</b>
3060   * <p>
3061   * Description: <b>Why immunization occurred</b><br>
3062   * Type: <b>token</b><br>
3063   * Path: <b>Immunization.explanation.reason</b><br>
3064   * </p>
3065   */
3066  public static final ca.uhn.fhir.rest.gclient.TokenClientParam REASON = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_REASON);
3067
3068 /**
3069   * Search parameter: <b>reaction</b>
3070   * <p>
3071   * Description: <b>Additional information on reaction</b><br>
3072   * Type: <b>reference</b><br>
3073   * Path: <b>Immunization.reaction.detail</b><br>
3074   * </p>
3075   */
3076  @SearchParamDefinition(name="reaction", path="Immunization.reaction.detail", description="Additional information on reaction", type="reference", target={Observation.class } )
3077  public static final String SP_REACTION = "reaction";
3078 /**
3079   * <b>Fluent Client</b> search parameter constant for <b>reaction</b>
3080   * <p>
3081   * Description: <b>Additional information on reaction</b><br>
3082   * Type: <b>reference</b><br>
3083   * Path: <b>Immunization.reaction.detail</b><br>
3084   * </p>
3085   */
3086  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REACTION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REACTION);
3087
3088/**
3089   * Constant for fluent queries to be used to add include statements. Specifies
3090   * the path value of "<b>Immunization:reaction</b>".
3091   */
3092  public static final ca.uhn.fhir.model.api.Include INCLUDE_REACTION = new ca.uhn.fhir.model.api.Include("Immunization:reaction").toLocked();
3093
3094 /**
3095   * Search parameter: <b>lot-number</b>
3096   * <p>
3097   * Description: <b>Vaccine Lot Number</b><br>
3098   * Type: <b>string</b><br>
3099   * Path: <b>Immunization.lotNumber</b><br>
3100   * </p>
3101   */
3102  @SearchParamDefinition(name="lot-number", path="Immunization.lotNumber", description="Vaccine Lot Number", type="string" )
3103  public static final String SP_LOT_NUMBER = "lot-number";
3104 /**
3105   * <b>Fluent Client</b> search parameter constant for <b>lot-number</b>
3106   * <p>
3107   * Description: <b>Vaccine Lot Number</b><br>
3108   * Type: <b>string</b><br>
3109   * Path: <b>Immunization.lotNumber</b><br>
3110   * </p>
3111   */
3112  public static final ca.uhn.fhir.rest.gclient.StringClientParam LOT_NUMBER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_LOT_NUMBER);
3113
3114 /**
3115   * Search parameter: <b>practitioner</b>
3116   * <p>
3117   * Description: <b>The practitioner who played a role in the vaccination</b><br>
3118   * Type: <b>reference</b><br>
3119   * Path: <b>Immunization.practitioner.actor</b><br>
3120   * </p>
3121   */
3122  @SearchParamDefinition(name="practitioner", path="Immunization.practitioner.actor", description="The practitioner who played a role in the vaccination", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Practitioner.class } )
3123  public static final String SP_PRACTITIONER = "practitioner";
3124 /**
3125   * <b>Fluent Client</b> search parameter constant for <b>practitioner</b>
3126   * <p>
3127   * Description: <b>The practitioner who played a role in the vaccination</b><br>
3128   * Type: <b>reference</b><br>
3129   * Path: <b>Immunization.practitioner.actor</b><br>
3130   * </p>
3131   */
3132  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRACTITIONER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PRACTITIONER);
3133
3134/**
3135   * Constant for fluent queries to be used to add include statements. Specifies
3136   * the path value of "<b>Immunization:practitioner</b>".
3137   */
3138  public static final ca.uhn.fhir.model.api.Include INCLUDE_PRACTITIONER = new ca.uhn.fhir.model.api.Include("Immunization:practitioner").toLocked();
3139
3140 /**
3141   * Search parameter: <b>notgiven</b>
3142   * <p>
3143   * Description: <b>Administrations which were not given</b><br>
3144   * Type: <b>token</b><br>
3145   * Path: <b>Immunization.notGiven</b><br>
3146   * </p>
3147   */
3148  @SearchParamDefinition(name="notgiven", path="Immunization.notGiven", description="Administrations which were not given", type="token" )
3149  public static final String SP_NOTGIVEN = "notgiven";
3150 /**
3151   * <b>Fluent Client</b> search parameter constant for <b>notgiven</b>
3152   * <p>
3153   * Description: <b>Administrations which were not given</b><br>
3154   * Type: <b>token</b><br>
3155   * Path: <b>Immunization.notGiven</b><br>
3156   * </p>
3157   */
3158  public static final ca.uhn.fhir.rest.gclient.TokenClientParam NOTGIVEN = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_NOTGIVEN);
3159
3160 /**
3161   * Search parameter: <b>manufacturer</b>
3162   * <p>
3163   * Description: <b>Vaccine Manufacturer</b><br>
3164   * Type: <b>reference</b><br>
3165   * Path: <b>Immunization.manufacturer</b><br>
3166   * </p>
3167   */
3168  @SearchParamDefinition(name="manufacturer", path="Immunization.manufacturer", description="Vaccine Manufacturer", type="reference", target={Organization.class } )
3169  public static final String SP_MANUFACTURER = "manufacturer";
3170 /**
3171   * <b>Fluent Client</b> search parameter constant for <b>manufacturer</b>
3172   * <p>
3173   * Description: <b>Vaccine Manufacturer</b><br>
3174   * Type: <b>reference</b><br>
3175   * Path: <b>Immunization.manufacturer</b><br>
3176   * </p>
3177   */
3178  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MANUFACTURER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MANUFACTURER);
3179
3180/**
3181   * Constant for fluent queries to be used to add include statements. Specifies
3182   * the path value of "<b>Immunization:manufacturer</b>".
3183   */
3184  public static final ca.uhn.fhir.model.api.Include INCLUDE_MANUFACTURER = new ca.uhn.fhir.model.api.Include("Immunization:manufacturer").toLocked();
3185
3186 /**
3187   * Search parameter: <b>dose-sequence</b>
3188   * <p>
3189   * Description: <b>Dose number within series</b><br>
3190   * Type: <b>number</b><br>
3191   * Path: <b>Immunization.vaccinationProtocol.doseSequence</b><br>
3192   * </p>
3193   */
3194  @SearchParamDefinition(name="dose-sequence", path="Immunization.vaccinationProtocol.doseSequence", description="Dose number within series", type="number" )
3195  public static final String SP_DOSE_SEQUENCE = "dose-sequence";
3196 /**
3197   * <b>Fluent Client</b> search parameter constant for <b>dose-sequence</b>
3198   * <p>
3199   * Description: <b>Dose number within series</b><br>
3200   * Type: <b>number</b><br>
3201   * Path: <b>Immunization.vaccinationProtocol.doseSequence</b><br>
3202   * </p>
3203   */
3204  public static final ca.uhn.fhir.rest.gclient.NumberClientParam DOSE_SEQUENCE = new ca.uhn.fhir.rest.gclient.NumberClientParam(SP_DOSE_SEQUENCE);
3205
3206 /**
3207   * Search parameter: <b>patient</b>
3208   * <p>
3209   * Description: <b>The patient for the vaccination record</b><br>
3210   * Type: <b>reference</b><br>
3211   * Path: <b>Immunization.patient</b><br>
3212   * </p>
3213   */
3214  @SearchParamDefinition(name="patient", path="Immunization.patient", description="The patient for the vaccination record", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
3215  public static final String SP_PATIENT = "patient";
3216 /**
3217   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3218   * <p>
3219   * Description: <b>The patient for the vaccination record</b><br>
3220   * Type: <b>reference</b><br>
3221   * Path: <b>Immunization.patient</b><br>
3222   * </p>
3223   */
3224  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
3225
3226/**
3227   * Constant for fluent queries to be used to add include statements. Specifies
3228   * the path value of "<b>Immunization:patient</b>".
3229   */
3230  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Immunization:patient").toLocked();
3231
3232 /**
3233   * Search parameter: <b>vaccine-code</b>
3234   * <p>
3235   * Description: <b>Vaccine Product Administered</b><br>
3236   * Type: <b>token</b><br>
3237   * Path: <b>Immunization.vaccineCode</b><br>
3238   * </p>
3239   */
3240  @SearchParamDefinition(name="vaccine-code", path="Immunization.vaccineCode", description="Vaccine Product Administered", type="token" )
3241  public static final String SP_VACCINE_CODE = "vaccine-code";
3242 /**
3243   * <b>Fluent Client</b> search parameter constant for <b>vaccine-code</b>
3244   * <p>
3245   * Description: <b>Vaccine Product Administered</b><br>
3246   * Type: <b>token</b><br>
3247   * Path: <b>Immunization.vaccineCode</b><br>
3248   * </p>
3249   */
3250  public static final ca.uhn.fhir.rest.gclient.TokenClientParam VACCINE_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_VACCINE_CODE);
3251
3252 /**
3253   * Search parameter: <b>reason-not-given</b>
3254   * <p>
3255   * Description: <b>Explanation of reason vaccination was not administered</b><br>
3256   * Type: <b>token</b><br>
3257   * Path: <b>Immunization.explanation.reasonNotGiven</b><br>
3258   * </p>
3259   */
3260  @SearchParamDefinition(name="reason-not-given", path="Immunization.explanation.reasonNotGiven", description="Explanation of reason vaccination was not administered", type="token" )
3261  public static final String SP_REASON_NOT_GIVEN = "reason-not-given";
3262 /**
3263   * <b>Fluent Client</b> search parameter constant for <b>reason-not-given</b>
3264   * <p>
3265   * Description: <b>Explanation of reason vaccination was not administered</b><br>
3266   * Type: <b>token</b><br>
3267   * Path: <b>Immunization.explanation.reasonNotGiven</b><br>
3268   * </p>
3269   */
3270  public static final ca.uhn.fhir.rest.gclient.TokenClientParam REASON_NOT_GIVEN = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_REASON_NOT_GIVEN);
3271
3272 /**
3273   * Search parameter: <b>location</b>
3274   * <p>
3275   * Description: <b>The service delivery location or facility in which the vaccine was / was to be administered</b><br>
3276   * Type: <b>reference</b><br>
3277   * Path: <b>Immunization.location</b><br>
3278   * </p>
3279   */
3280  @SearchParamDefinition(name="location", path="Immunization.location", description="The service delivery location or facility in which the vaccine was / was to be administered", type="reference", target={Location.class } )
3281  public static final String SP_LOCATION = "location";
3282 /**
3283   * <b>Fluent Client</b> search parameter constant for <b>location</b>
3284   * <p>
3285   * Description: <b>The service delivery location or facility in which the vaccine was / was to be administered</b><br>
3286   * Type: <b>reference</b><br>
3287   * Path: <b>Immunization.location</b><br>
3288   * </p>
3289   */
3290  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
3291
3292/**
3293   * Constant for fluent queries to be used to add include statements. Specifies
3294   * the path value of "<b>Immunization:location</b>".
3295   */
3296  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("Immunization:location").toLocked();
3297
3298 /**
3299   * Search parameter: <b>reaction-date</b>
3300   * <p>
3301   * Description: <b>When reaction started</b><br>
3302   * Type: <b>date</b><br>
3303   * Path: <b>Immunization.reaction.date</b><br>
3304   * </p>
3305   */
3306  @SearchParamDefinition(name="reaction-date", path="Immunization.reaction.date", description="When reaction started", type="date" )
3307  public static final String SP_REACTION_DATE = "reaction-date";
3308 /**
3309   * <b>Fluent Client</b> search parameter constant for <b>reaction-date</b>
3310   * <p>
3311   * Description: <b>When reaction started</b><br>
3312   * Type: <b>date</b><br>
3313   * Path: <b>Immunization.reaction.date</b><br>
3314   * </p>
3315   */
3316  public static final ca.uhn.fhir.rest.gclient.DateClientParam REACTION_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_REACTION_DATE);
3317
3318 /**
3319   * Search parameter: <b>status</b>
3320   * <p>
3321   * Description: <b>Immunization event status</b><br>
3322   * Type: <b>token</b><br>
3323   * Path: <b>Immunization.status</b><br>
3324   * </p>
3325   */
3326  @SearchParamDefinition(name="status", path="Immunization.status", description="Immunization event status", type="token" )
3327  public static final String SP_STATUS = "status";
3328 /**
3329   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3330   * <p>
3331   * Description: <b>Immunization event status</b><br>
3332   * Type: <b>token</b><br>
3333   * Path: <b>Immunization.status</b><br>
3334   * </p>
3335   */
3336  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3337
3338
3339}
3340