001package org.hl7.fhir.r5.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r5
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
053import java.util.ArrayList;
054import java.util.Date;
055import java.util.List;
056import org.hl7.fhir.exceptions.FHIRException;
057import org.hl7.fhir.instance.model.api.ICompositeType;
058
059import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
060import org.hl7.fhir.utilities.Utilities;
061import ca.uhn.fhir.model.api.annotation.ResourceDef;
062import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
063import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
064import ca.uhn.fhir.model.api.annotation.Child;
065import ca.uhn.fhir.model.api.annotation.ChildOrder;
066import ca.uhn.fhir.model.api.annotation.Description;
067import ca.uhn.fhir.model.api.annotation.Block;
068/**
069 * Describes the event of a patient being administered a vaccine or a record of an immunization as reported by a patient, a clinician or another party.
070 */
071@ResourceDef(name="Immunization", profile="http://hl7.org/fhir/StructureDefinition/Immunization")
072public class Immunization extends DomainResource {
073
074    public enum ImmunizationStatus {
075        /**
076         * null
077         */
078        COMPLETED, 
079        /**
080         * null
081         */
082        ENTEREDINERROR, 
083        /**
084         * null
085         */
086        NOTDONE, 
087        /**
088         * added to help the parsers with the generic types
089         */
090        NULL;
091        public static ImmunizationStatus fromCode(String codeString) throws FHIRException {
092            if (codeString == null || "".equals(codeString))
093                return null;
094        if ("completed".equals(codeString))
095          return COMPLETED;
096        if ("entered-in-error".equals(codeString))
097          return ENTEREDINERROR;
098        if ("not-done".equals(codeString))
099          return NOTDONE;
100        if (Configuration.isAcceptInvalidEnums())
101          return null;
102        else
103          throw new FHIRException("Unknown ImmunizationStatus code '"+codeString+"'");
104        }
105        public String toCode() {
106          switch (this) {
107            case COMPLETED: return "completed";
108            case ENTEREDINERROR: return "entered-in-error";
109            case NOTDONE: return "not-done";
110            default: return "?";
111          }
112        }
113        public String getSystem() {
114          switch (this) {
115            case COMPLETED: return "http://hl7.org/fhir/event-status";
116            case ENTEREDINERROR: return "http://hl7.org/fhir/event-status";
117            case NOTDONE: return "http://hl7.org/fhir/event-status";
118            default: return "?";
119          }
120        }
121        public String getDefinition() {
122          switch (this) {
123            case COMPLETED: return "";
124            case ENTEREDINERROR: return "";
125            case NOTDONE: return "";
126            default: return "?";
127          }
128        }
129        public String getDisplay() {
130          switch (this) {
131            case COMPLETED: return "completed";
132            case ENTEREDINERROR: return "entered-in-error";
133            case NOTDONE: return "not-done";
134            default: return "?";
135          }
136        }
137    }
138
139  public static class ImmunizationStatusEnumFactory implements EnumFactory<ImmunizationStatus> {
140    public ImmunizationStatus fromCode(String codeString) throws IllegalArgumentException {
141      if (codeString == null || "".equals(codeString))
142            if (codeString == null || "".equals(codeString))
143                return null;
144        if ("completed".equals(codeString))
145          return ImmunizationStatus.COMPLETED;
146        if ("entered-in-error".equals(codeString))
147          return ImmunizationStatus.ENTEREDINERROR;
148        if ("not-done".equals(codeString))
149          return ImmunizationStatus.NOTDONE;
150        throw new IllegalArgumentException("Unknown ImmunizationStatus code '"+codeString+"'");
151        }
152        public Enumeration<ImmunizationStatus> fromType(Base code) throws FHIRException {
153          if (code == null)
154            return null;
155          if (code.isEmpty())
156            return new Enumeration<ImmunizationStatus>(this);
157          String codeString = ((PrimitiveType) code).asStringValue();
158          if (codeString == null || "".equals(codeString))
159            return null;
160        if ("completed".equals(codeString))
161          return new Enumeration<ImmunizationStatus>(this, ImmunizationStatus.COMPLETED);
162        if ("entered-in-error".equals(codeString))
163          return new Enumeration<ImmunizationStatus>(this, ImmunizationStatus.ENTEREDINERROR);
164        if ("not-done".equals(codeString))
165          return new Enumeration<ImmunizationStatus>(this, ImmunizationStatus.NOTDONE);
166        throw new FHIRException("Unknown ImmunizationStatus code '"+codeString+"'");
167        }
168    public String toCode(ImmunizationStatus code) {
169      if (code == ImmunizationStatus.COMPLETED)
170        return "completed";
171      if (code == ImmunizationStatus.ENTEREDINERROR)
172        return "entered-in-error";
173      if (code == ImmunizationStatus.NOTDONE)
174        return "not-done";
175      return "?";
176      }
177    public String toSystem(ImmunizationStatus code) {
178      return code.getSystem();
179      }
180    }
181
182    @Block()
183    public static class ImmunizationPerformerComponent extends BackboneElement implements IBaseBackboneElement {
184        /**
185         * Describes the type of performance (e.g. ordering provider, administering provider, etc.).
186         */
187        @Child(name = "function", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
188        @Description(shortDefinition="What type of performance was done", formalDefinition="Describes the type of performance (e.g. ordering provider, administering provider, etc.)." )
189        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/immunization-function")
190        protected CodeableConcept function;
191
192        /**
193         * The practitioner or organization who performed the action.
194         */
195        @Child(name = "actor", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=2, min=1, max=1, modifier=false, summary=true)
196        @Description(shortDefinition="Individual or organization who was performing", formalDefinition="The practitioner or organization who performed the action." )
197        protected Reference actor;
198
199        private static final long serialVersionUID = -576943815L;
200
201    /**
202     * Constructor
203     */
204      public ImmunizationPerformerComponent() {
205        super();
206      }
207
208    /**
209     * Constructor
210     */
211      public ImmunizationPerformerComponent(Reference actor) {
212        super();
213        this.actor = actor;
214      }
215
216        /**
217         * @return {@link #function} (Describes the type of performance (e.g. ordering provider, administering provider, etc.).)
218         */
219        public CodeableConcept getFunction() { 
220          if (this.function == null)
221            if (Configuration.errorOnAutoCreate())
222              throw new Error("Attempt to auto-create ImmunizationPerformerComponent.function");
223            else if (Configuration.doAutoCreate())
224              this.function = new CodeableConcept(); // cc
225          return this.function;
226        }
227
228        public boolean hasFunction() { 
229          return this.function != null && !this.function.isEmpty();
230        }
231
232        /**
233         * @param value {@link #function} (Describes the type of performance (e.g. ordering provider, administering provider, etc.).)
234         */
235        public ImmunizationPerformerComponent setFunction(CodeableConcept value) { 
236          this.function = value;
237          return this;
238        }
239
240        /**
241         * @return {@link #actor} (The practitioner or organization who performed the action.)
242         */
243        public Reference getActor() { 
244          if (this.actor == null)
245            if (Configuration.errorOnAutoCreate())
246              throw new Error("Attempt to auto-create ImmunizationPerformerComponent.actor");
247            else if (Configuration.doAutoCreate())
248              this.actor = new Reference(); // cc
249          return this.actor;
250        }
251
252        public boolean hasActor() { 
253          return this.actor != null && !this.actor.isEmpty();
254        }
255
256        /**
257         * @param value {@link #actor} (The practitioner or organization who performed the action.)
258         */
259        public ImmunizationPerformerComponent setActor(Reference value) { 
260          this.actor = value;
261          return this;
262        }
263
264        protected void listChildren(List<Property> children) {
265          super.listChildren(children);
266          children.add(new Property("function", "CodeableConcept", "Describes the type of performance (e.g. ordering provider, administering provider, etc.).", 0, 1, function));
267          children.add(new Property("actor", "Reference(Practitioner|PractitionerRole|Organization)", "The practitioner or organization who performed the action.", 0, 1, actor));
268        }
269
270        @Override
271        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
272          switch (_hash) {
273          case 1380938712: /*function*/  return new Property("function", "CodeableConcept", "Describes the type of performance (e.g. ordering provider, administering provider, etc.).", 0, 1, function);
274          case 92645877: /*actor*/  return new Property("actor", "Reference(Practitioner|PractitionerRole|Organization)", "The practitioner or organization who performed the action.", 0, 1, actor);
275          default: return super.getNamedProperty(_hash, _name, _checkValid);
276          }
277
278        }
279
280      @Override
281      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
282        switch (hash) {
283        case 1380938712: /*function*/ return this.function == null ? new Base[0] : new Base[] {this.function}; // CodeableConcept
284        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference
285        default: return super.getProperty(hash, name, checkValid);
286        }
287
288      }
289
290      @Override
291      public Base setProperty(int hash, String name, Base value) throws FHIRException {
292        switch (hash) {
293        case 1380938712: // function
294          this.function = castToCodeableConcept(value); // CodeableConcept
295          return value;
296        case 92645877: // actor
297          this.actor = castToReference(value); // Reference
298          return value;
299        default: return super.setProperty(hash, name, value);
300        }
301
302      }
303
304      @Override
305      public Base setProperty(String name, Base value) throws FHIRException {
306        if (name.equals("function")) {
307          this.function = castToCodeableConcept(value); // CodeableConcept
308        } else if (name.equals("actor")) {
309          this.actor = castToReference(value); // Reference
310        } else
311          return super.setProperty(name, value);
312        return value;
313      }
314
315      @Override
316      public Base makeProperty(int hash, String name) throws FHIRException {
317        switch (hash) {
318        case 1380938712:  return getFunction();
319        case 92645877:  return getActor();
320        default: return super.makeProperty(hash, name);
321        }
322
323      }
324
325      @Override
326      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
327        switch (hash) {
328        case 1380938712: /*function*/ return new String[] {"CodeableConcept"};
329        case 92645877: /*actor*/ return new String[] {"Reference"};
330        default: return super.getTypesForProperty(hash, name);
331        }
332
333      }
334
335      @Override
336      public Base addChild(String name) throws FHIRException {
337        if (name.equals("function")) {
338          this.function = new CodeableConcept();
339          return this.function;
340        }
341        else if (name.equals("actor")) {
342          this.actor = new Reference();
343          return this.actor;
344        }
345        else
346          return super.addChild(name);
347      }
348
349      public ImmunizationPerformerComponent copy() {
350        ImmunizationPerformerComponent dst = new ImmunizationPerformerComponent();
351        copyValues(dst);
352        return dst;
353      }
354
355      public void copyValues(ImmunizationPerformerComponent dst) {
356        super.copyValues(dst);
357        dst.function = function == null ? null : function.copy();
358        dst.actor = actor == null ? null : actor.copy();
359      }
360
361      @Override
362      public boolean equalsDeep(Base other_) {
363        if (!super.equalsDeep(other_))
364          return false;
365        if (!(other_ instanceof ImmunizationPerformerComponent))
366          return false;
367        ImmunizationPerformerComponent o = (ImmunizationPerformerComponent) other_;
368        return compareDeep(function, o.function, true) && compareDeep(actor, o.actor, true);
369      }
370
371      @Override
372      public boolean equalsShallow(Base other_) {
373        if (!super.equalsShallow(other_))
374          return false;
375        if (!(other_ instanceof ImmunizationPerformerComponent))
376          return false;
377        ImmunizationPerformerComponent o = (ImmunizationPerformerComponent) other_;
378        return true;
379      }
380
381      public boolean isEmpty() {
382        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(function, actor);
383      }
384
385  public String fhirType() {
386    return "Immunization.performer";
387
388  }
389
390  }
391
392    @Block()
393    public static class ImmunizationEducationComponent extends BackboneElement implements IBaseBackboneElement {
394        /**
395         * Identifier of the material presented to the patient.
396         */
397        @Child(name = "documentType", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
398        @Description(shortDefinition="Educational material document identifier", formalDefinition="Identifier of the material presented to the patient." )
399        protected StringType documentType;
400
401        /**
402         * Reference pointer to the educational material given to the patient if the information was on line.
403         */
404        @Child(name = "reference", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=false)
405        @Description(shortDefinition="Educational material reference pointer", formalDefinition="Reference pointer to the educational material given to the patient if the information was on line." )
406        protected UriType reference;
407
408        /**
409         * Date the educational material was published.
410         */
411        @Child(name = "publicationDate", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
412        @Description(shortDefinition="Educational material publication date", formalDefinition="Date the educational material was published." )
413        protected DateTimeType publicationDate;
414
415        /**
416         * Date the educational material was given to the patient.
417         */
418        @Child(name = "presentationDate", type = {DateTimeType.class}, order=4, min=0, max=1, modifier=false, summary=false)
419        @Description(shortDefinition="Educational material presentation date", formalDefinition="Date the educational material was given to the patient." )
420        protected DateTimeType presentationDate;
421
422        private static final long serialVersionUID = -1277654827L;
423
424    /**
425     * Constructor
426     */
427      public ImmunizationEducationComponent() {
428        super();
429      }
430
431        /**
432         * @return {@link #documentType} (Identifier of the material presented to the patient.). This is the underlying object with id, value and extensions. The accessor "getDocumentType" gives direct access to the value
433         */
434        public StringType getDocumentTypeElement() { 
435          if (this.documentType == null)
436            if (Configuration.errorOnAutoCreate())
437              throw new Error("Attempt to auto-create ImmunizationEducationComponent.documentType");
438            else if (Configuration.doAutoCreate())
439              this.documentType = new StringType(); // bb
440          return this.documentType;
441        }
442
443        public boolean hasDocumentTypeElement() { 
444          return this.documentType != null && !this.documentType.isEmpty();
445        }
446
447        public boolean hasDocumentType() { 
448          return this.documentType != null && !this.documentType.isEmpty();
449        }
450
451        /**
452         * @param value {@link #documentType} (Identifier of the material presented to the patient.). This is the underlying object with id, value and extensions. The accessor "getDocumentType" gives direct access to the value
453         */
454        public ImmunizationEducationComponent setDocumentTypeElement(StringType value) { 
455          this.documentType = value;
456          return this;
457        }
458
459        /**
460         * @return Identifier of the material presented to the patient.
461         */
462        public String getDocumentType() { 
463          return this.documentType == null ? null : this.documentType.getValue();
464        }
465
466        /**
467         * @param value Identifier of the material presented to the patient.
468         */
469        public ImmunizationEducationComponent setDocumentType(String value) { 
470          if (Utilities.noString(value))
471            this.documentType = null;
472          else {
473            if (this.documentType == null)
474              this.documentType = new StringType();
475            this.documentType.setValue(value);
476          }
477          return this;
478        }
479
480        /**
481         * @return {@link #reference} (Reference pointer to the educational material given to the patient if the information was on line.). This is the underlying object with id, value and extensions. The accessor "getReference" gives direct access to the value
482         */
483        public UriType getReferenceElement() { 
484          if (this.reference == null)
485            if (Configuration.errorOnAutoCreate())
486              throw new Error("Attempt to auto-create ImmunizationEducationComponent.reference");
487            else if (Configuration.doAutoCreate())
488              this.reference = new UriType(); // bb
489          return this.reference;
490        }
491
492        public boolean hasReferenceElement() { 
493          return this.reference != null && !this.reference.isEmpty();
494        }
495
496        public boolean hasReference() { 
497          return this.reference != null && !this.reference.isEmpty();
498        }
499
500        /**
501         * @param value {@link #reference} (Reference pointer to the educational material given to the patient if the information was on line.). This is the underlying object with id, value and extensions. The accessor "getReference" gives direct access to the value
502         */
503        public ImmunizationEducationComponent setReferenceElement(UriType value) { 
504          this.reference = value;
505          return this;
506        }
507
508        /**
509         * @return Reference pointer to the educational material given to the patient if the information was on line.
510         */
511        public String getReference() { 
512          return this.reference == null ? null : this.reference.getValue();
513        }
514
515        /**
516         * @param value Reference pointer to the educational material given to the patient if the information was on line.
517         */
518        public ImmunizationEducationComponent setReference(String value) { 
519          if (Utilities.noString(value))
520            this.reference = null;
521          else {
522            if (this.reference == null)
523              this.reference = new UriType();
524            this.reference.setValue(value);
525          }
526          return this;
527        }
528
529        /**
530         * @return {@link #publicationDate} (Date the educational material was published.). This is the underlying object with id, value and extensions. The accessor "getPublicationDate" gives direct access to the value
531         */
532        public DateTimeType getPublicationDateElement() { 
533          if (this.publicationDate == null)
534            if (Configuration.errorOnAutoCreate())
535              throw new Error("Attempt to auto-create ImmunizationEducationComponent.publicationDate");
536            else if (Configuration.doAutoCreate())
537              this.publicationDate = new DateTimeType(); // bb
538          return this.publicationDate;
539        }
540
541        public boolean hasPublicationDateElement() { 
542          return this.publicationDate != null && !this.publicationDate.isEmpty();
543        }
544
545        public boolean hasPublicationDate() { 
546          return this.publicationDate != null && !this.publicationDate.isEmpty();
547        }
548
549        /**
550         * @param value {@link #publicationDate} (Date the educational material was published.). This is the underlying object with id, value and extensions. The accessor "getPublicationDate" gives direct access to the value
551         */
552        public ImmunizationEducationComponent setPublicationDateElement(DateTimeType value) { 
553          this.publicationDate = value;
554          return this;
555        }
556
557        /**
558         * @return Date the educational material was published.
559         */
560        public Date getPublicationDate() { 
561          return this.publicationDate == null ? null : this.publicationDate.getValue();
562        }
563
564        /**
565         * @param value Date the educational material was published.
566         */
567        public ImmunizationEducationComponent setPublicationDate(Date value) { 
568          if (value == null)
569            this.publicationDate = null;
570          else {
571            if (this.publicationDate == null)
572              this.publicationDate = new DateTimeType();
573            this.publicationDate.setValue(value);
574          }
575          return this;
576        }
577
578        /**
579         * @return {@link #presentationDate} (Date the educational material was given to the patient.). This is the underlying object with id, value and extensions. The accessor "getPresentationDate" gives direct access to the value
580         */
581        public DateTimeType getPresentationDateElement() { 
582          if (this.presentationDate == null)
583            if (Configuration.errorOnAutoCreate())
584              throw new Error("Attempt to auto-create ImmunizationEducationComponent.presentationDate");
585            else if (Configuration.doAutoCreate())
586              this.presentationDate = new DateTimeType(); // bb
587          return this.presentationDate;
588        }
589
590        public boolean hasPresentationDateElement() { 
591          return this.presentationDate != null && !this.presentationDate.isEmpty();
592        }
593
594        public boolean hasPresentationDate() { 
595          return this.presentationDate != null && !this.presentationDate.isEmpty();
596        }
597
598        /**
599         * @param value {@link #presentationDate} (Date the educational material was given to the patient.). This is the underlying object with id, value and extensions. The accessor "getPresentationDate" gives direct access to the value
600         */
601        public ImmunizationEducationComponent setPresentationDateElement(DateTimeType value) { 
602          this.presentationDate = value;
603          return this;
604        }
605
606        /**
607         * @return Date the educational material was given to the patient.
608         */
609        public Date getPresentationDate() { 
610          return this.presentationDate == null ? null : this.presentationDate.getValue();
611        }
612
613        /**
614         * @param value Date the educational material was given to the patient.
615         */
616        public ImmunizationEducationComponent setPresentationDate(Date value) { 
617          if (value == null)
618            this.presentationDate = null;
619          else {
620            if (this.presentationDate == null)
621              this.presentationDate = new DateTimeType();
622            this.presentationDate.setValue(value);
623          }
624          return this;
625        }
626
627        protected void listChildren(List<Property> children) {
628          super.listChildren(children);
629          children.add(new Property("documentType", "string", "Identifier of the material presented to the patient.", 0, 1, documentType));
630          children.add(new Property("reference", "uri", "Reference pointer to the educational material given to the patient if the information was on line.", 0, 1, reference));
631          children.add(new Property("publicationDate", "dateTime", "Date the educational material was published.", 0, 1, publicationDate));
632          children.add(new Property("presentationDate", "dateTime", "Date the educational material was given to the patient.", 0, 1, presentationDate));
633        }
634
635        @Override
636        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
637          switch (_hash) {
638          case -1473196299: /*documentType*/  return new Property("documentType", "string", "Identifier of the material presented to the patient.", 0, 1, documentType);
639          case -925155509: /*reference*/  return new Property("reference", "uri", "Reference pointer to the educational material given to the patient if the information was on line.", 0, 1, reference);
640          case 1470566394: /*publicationDate*/  return new Property("publicationDate", "dateTime", "Date the educational material was published.", 0, 1, publicationDate);
641          case 1602373096: /*presentationDate*/  return new Property("presentationDate", "dateTime", "Date the educational material was given to the patient.", 0, 1, presentationDate);
642          default: return super.getNamedProperty(_hash, _name, _checkValid);
643          }
644
645        }
646
647      @Override
648      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
649        switch (hash) {
650        case -1473196299: /*documentType*/ return this.documentType == null ? new Base[0] : new Base[] {this.documentType}; // StringType
651        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // UriType
652        case 1470566394: /*publicationDate*/ return this.publicationDate == null ? new Base[0] : new Base[] {this.publicationDate}; // DateTimeType
653        case 1602373096: /*presentationDate*/ return this.presentationDate == null ? new Base[0] : new Base[] {this.presentationDate}; // DateTimeType
654        default: return super.getProperty(hash, name, checkValid);
655        }
656
657      }
658
659      @Override
660      public Base setProperty(int hash, String name, Base value) throws FHIRException {
661        switch (hash) {
662        case -1473196299: // documentType
663          this.documentType = castToString(value); // StringType
664          return value;
665        case -925155509: // reference
666          this.reference = castToUri(value); // UriType
667          return value;
668        case 1470566394: // publicationDate
669          this.publicationDate = castToDateTime(value); // DateTimeType
670          return value;
671        case 1602373096: // presentationDate
672          this.presentationDate = castToDateTime(value); // DateTimeType
673          return value;
674        default: return super.setProperty(hash, name, value);
675        }
676
677      }
678
679      @Override
680      public Base setProperty(String name, Base value) throws FHIRException {
681        if (name.equals("documentType")) {
682          this.documentType = castToString(value); // StringType
683        } else if (name.equals("reference")) {
684          this.reference = castToUri(value); // UriType
685        } else if (name.equals("publicationDate")) {
686          this.publicationDate = castToDateTime(value); // DateTimeType
687        } else if (name.equals("presentationDate")) {
688          this.presentationDate = castToDateTime(value); // DateTimeType
689        } else
690          return super.setProperty(name, value);
691        return value;
692      }
693
694      @Override
695      public Base makeProperty(int hash, String name) throws FHIRException {
696        switch (hash) {
697        case -1473196299:  return getDocumentTypeElement();
698        case -925155509:  return getReferenceElement();
699        case 1470566394:  return getPublicationDateElement();
700        case 1602373096:  return getPresentationDateElement();
701        default: return super.makeProperty(hash, name);
702        }
703
704      }
705
706      @Override
707      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
708        switch (hash) {
709        case -1473196299: /*documentType*/ return new String[] {"string"};
710        case -925155509: /*reference*/ return new String[] {"uri"};
711        case 1470566394: /*publicationDate*/ return new String[] {"dateTime"};
712        case 1602373096: /*presentationDate*/ return new String[] {"dateTime"};
713        default: return super.getTypesForProperty(hash, name);
714        }
715
716      }
717
718      @Override
719      public Base addChild(String name) throws FHIRException {
720        if (name.equals("documentType")) {
721          throw new FHIRException("Cannot call addChild on a primitive type Immunization.documentType");
722        }
723        else if (name.equals("reference")) {
724          throw new FHIRException("Cannot call addChild on a primitive type Immunization.reference");
725        }
726        else if (name.equals("publicationDate")) {
727          throw new FHIRException("Cannot call addChild on a primitive type Immunization.publicationDate");
728        }
729        else if (name.equals("presentationDate")) {
730          throw new FHIRException("Cannot call addChild on a primitive type Immunization.presentationDate");
731        }
732        else
733          return super.addChild(name);
734      }
735
736      public ImmunizationEducationComponent copy() {
737        ImmunizationEducationComponent dst = new ImmunizationEducationComponent();
738        copyValues(dst);
739        return dst;
740      }
741
742      public void copyValues(ImmunizationEducationComponent dst) {
743        super.copyValues(dst);
744        dst.documentType = documentType == null ? null : documentType.copy();
745        dst.reference = reference == null ? null : reference.copy();
746        dst.publicationDate = publicationDate == null ? null : publicationDate.copy();
747        dst.presentationDate = presentationDate == null ? null : presentationDate.copy();
748      }
749
750      @Override
751      public boolean equalsDeep(Base other_) {
752        if (!super.equalsDeep(other_))
753          return false;
754        if (!(other_ instanceof ImmunizationEducationComponent))
755          return false;
756        ImmunizationEducationComponent o = (ImmunizationEducationComponent) other_;
757        return compareDeep(documentType, o.documentType, true) && compareDeep(reference, o.reference, true)
758           && compareDeep(publicationDate, o.publicationDate, true) && compareDeep(presentationDate, o.presentationDate, true)
759          ;
760      }
761
762      @Override
763      public boolean equalsShallow(Base other_) {
764        if (!super.equalsShallow(other_))
765          return false;
766        if (!(other_ instanceof ImmunizationEducationComponent))
767          return false;
768        ImmunizationEducationComponent o = (ImmunizationEducationComponent) other_;
769        return compareValues(documentType, o.documentType, true) && compareValues(reference, o.reference, true)
770           && compareValues(publicationDate, o.publicationDate, true) && compareValues(presentationDate, o.presentationDate, true)
771          ;
772      }
773
774      public boolean isEmpty() {
775        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(documentType, reference, publicationDate
776          , presentationDate);
777      }
778
779  public String fhirType() {
780    return "Immunization.education";
781
782  }
783
784  }
785
786    @Block()
787    public static class ImmunizationReactionComponent extends BackboneElement implements IBaseBackboneElement {
788        /**
789         * Date of reaction to the immunization.
790         */
791        @Child(name = "date", type = {DateTimeType.class}, order=1, min=0, max=1, modifier=false, summary=false)
792        @Description(shortDefinition="When reaction started", formalDefinition="Date of reaction to the immunization." )
793        protected DateTimeType date;
794
795        /**
796         * Details of the reaction.
797         */
798        @Child(name = "detail", type = {Observation.class}, order=2, min=0, max=1, modifier=false, summary=false)
799        @Description(shortDefinition="Additional information on reaction", formalDefinition="Details of the reaction." )
800        protected Reference detail;
801
802        /**
803         * Self-reported indicator.
804         */
805        @Child(name = "reported", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
806        @Description(shortDefinition="Indicates self-reported reaction", formalDefinition="Self-reported indicator." )
807        protected BooleanType reported;
808
809        private static final long serialVersionUID = -655647546L;
810
811    /**
812     * Constructor
813     */
814      public ImmunizationReactionComponent() {
815        super();
816      }
817
818        /**
819         * @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
820         */
821        public DateTimeType getDateElement() { 
822          if (this.date == null)
823            if (Configuration.errorOnAutoCreate())
824              throw new Error("Attempt to auto-create ImmunizationReactionComponent.date");
825            else if (Configuration.doAutoCreate())
826              this.date = new DateTimeType(); // bb
827          return this.date;
828        }
829
830        public boolean hasDateElement() { 
831          return this.date != null && !this.date.isEmpty();
832        }
833
834        public boolean hasDate() { 
835          return this.date != null && !this.date.isEmpty();
836        }
837
838        /**
839         * @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
840         */
841        public ImmunizationReactionComponent setDateElement(DateTimeType value) { 
842          this.date = value;
843          return this;
844        }
845
846        /**
847         * @return Date of reaction to the immunization.
848         */
849        public Date getDate() { 
850          return this.date == null ? null : this.date.getValue();
851        }
852
853        /**
854         * @param value Date of reaction to the immunization.
855         */
856        public ImmunizationReactionComponent setDate(Date value) { 
857          if (value == null)
858            this.date = null;
859          else {
860            if (this.date == null)
861              this.date = new DateTimeType();
862            this.date.setValue(value);
863          }
864          return this;
865        }
866
867        /**
868         * @return {@link #detail} (Details of the reaction.)
869         */
870        public Reference getDetail() { 
871          if (this.detail == null)
872            if (Configuration.errorOnAutoCreate())
873              throw new Error("Attempt to auto-create ImmunizationReactionComponent.detail");
874            else if (Configuration.doAutoCreate())
875              this.detail = new Reference(); // cc
876          return this.detail;
877        }
878
879        public boolean hasDetail() { 
880          return this.detail != null && !this.detail.isEmpty();
881        }
882
883        /**
884         * @param value {@link #detail} (Details of the reaction.)
885         */
886        public ImmunizationReactionComponent setDetail(Reference value) { 
887          this.detail = value;
888          return this;
889        }
890
891        /**
892         * @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
893         */
894        public BooleanType getReportedElement() { 
895          if (this.reported == null)
896            if (Configuration.errorOnAutoCreate())
897              throw new Error("Attempt to auto-create ImmunizationReactionComponent.reported");
898            else if (Configuration.doAutoCreate())
899              this.reported = new BooleanType(); // bb
900          return this.reported;
901        }
902
903        public boolean hasReportedElement() { 
904          return this.reported != null && !this.reported.isEmpty();
905        }
906
907        public boolean hasReported() { 
908          return this.reported != null && !this.reported.isEmpty();
909        }
910
911        /**
912         * @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
913         */
914        public ImmunizationReactionComponent setReportedElement(BooleanType value) { 
915          this.reported = value;
916          return this;
917        }
918
919        /**
920         * @return Self-reported indicator.
921         */
922        public boolean getReported() { 
923          return this.reported == null || this.reported.isEmpty() ? false : this.reported.getValue();
924        }
925
926        /**
927         * @param value Self-reported indicator.
928         */
929        public ImmunizationReactionComponent setReported(boolean value) { 
930            if (this.reported == null)
931              this.reported = new BooleanType();
932            this.reported.setValue(value);
933          return this;
934        }
935
936        protected void listChildren(List<Property> children) {
937          super.listChildren(children);
938          children.add(new Property("date", "dateTime", "Date of reaction to the immunization.", 0, 1, date));
939          children.add(new Property("detail", "Reference(Observation)", "Details of the reaction.", 0, 1, detail));
940          children.add(new Property("reported", "boolean", "Self-reported indicator.", 0, 1, reported));
941        }
942
943        @Override
944        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
945          switch (_hash) {
946          case 3076014: /*date*/  return new Property("date", "dateTime", "Date of reaction to the immunization.", 0, 1, date);
947          case -1335224239: /*detail*/  return new Property("detail", "Reference(Observation)", "Details of the reaction.", 0, 1, detail);
948          case -427039533: /*reported*/  return new Property("reported", "boolean", "Self-reported indicator.", 0, 1, reported);
949          default: return super.getNamedProperty(_hash, _name, _checkValid);
950          }
951
952        }
953
954      @Override
955      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
956        switch (hash) {
957        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
958        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : new Base[] {this.detail}; // Reference
959        case -427039533: /*reported*/ return this.reported == null ? new Base[0] : new Base[] {this.reported}; // BooleanType
960        default: return super.getProperty(hash, name, checkValid);
961        }
962
963      }
964
965      @Override
966      public Base setProperty(int hash, String name, Base value) throws FHIRException {
967        switch (hash) {
968        case 3076014: // date
969          this.date = castToDateTime(value); // DateTimeType
970          return value;
971        case -1335224239: // detail
972          this.detail = castToReference(value); // Reference
973          return value;
974        case -427039533: // reported
975          this.reported = castToBoolean(value); // BooleanType
976          return value;
977        default: return super.setProperty(hash, name, value);
978        }
979
980      }
981
982      @Override
983      public Base setProperty(String name, Base value) throws FHIRException {
984        if (name.equals("date")) {
985          this.date = castToDateTime(value); // DateTimeType
986        } else if (name.equals("detail")) {
987          this.detail = castToReference(value); // Reference
988        } else if (name.equals("reported")) {
989          this.reported = castToBoolean(value); // BooleanType
990        } else
991          return super.setProperty(name, value);
992        return value;
993      }
994
995      @Override
996      public Base makeProperty(int hash, String name) throws FHIRException {
997        switch (hash) {
998        case 3076014:  return getDateElement();
999        case -1335224239:  return getDetail();
1000        case -427039533:  return getReportedElement();
1001        default: return super.makeProperty(hash, name);
1002        }
1003
1004      }
1005
1006      @Override
1007      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1008        switch (hash) {
1009        case 3076014: /*date*/ return new String[] {"dateTime"};
1010        case -1335224239: /*detail*/ return new String[] {"Reference"};
1011        case -427039533: /*reported*/ return new String[] {"boolean"};
1012        default: return super.getTypesForProperty(hash, name);
1013        }
1014
1015      }
1016
1017      @Override
1018      public Base addChild(String name) throws FHIRException {
1019        if (name.equals("date")) {
1020          throw new FHIRException("Cannot call addChild on a primitive type Immunization.date");
1021        }
1022        else if (name.equals("detail")) {
1023          this.detail = new Reference();
1024          return this.detail;
1025        }
1026        else if (name.equals("reported")) {
1027          throw new FHIRException("Cannot call addChild on a primitive type Immunization.reported");
1028        }
1029        else
1030          return super.addChild(name);
1031      }
1032
1033      public ImmunizationReactionComponent copy() {
1034        ImmunizationReactionComponent dst = new ImmunizationReactionComponent();
1035        copyValues(dst);
1036        return dst;
1037      }
1038
1039      public void copyValues(ImmunizationReactionComponent dst) {
1040        super.copyValues(dst);
1041        dst.date = date == null ? null : date.copy();
1042        dst.detail = detail == null ? null : detail.copy();
1043        dst.reported = reported == null ? null : reported.copy();
1044      }
1045
1046      @Override
1047      public boolean equalsDeep(Base other_) {
1048        if (!super.equalsDeep(other_))
1049          return false;
1050        if (!(other_ instanceof ImmunizationReactionComponent))
1051          return false;
1052        ImmunizationReactionComponent o = (ImmunizationReactionComponent) other_;
1053        return compareDeep(date, o.date, true) && compareDeep(detail, o.detail, true) && compareDeep(reported, o.reported, true)
1054          ;
1055      }
1056
1057      @Override
1058      public boolean equalsShallow(Base other_) {
1059        if (!super.equalsShallow(other_))
1060          return false;
1061        if (!(other_ instanceof ImmunizationReactionComponent))
1062          return false;
1063        ImmunizationReactionComponent o = (ImmunizationReactionComponent) other_;
1064        return compareValues(date, o.date, true) && compareValues(reported, o.reported, true);
1065      }
1066
1067      public boolean isEmpty() {
1068        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, detail, reported);
1069      }
1070
1071  public String fhirType() {
1072    return "Immunization.reaction";
1073
1074  }
1075
1076  }
1077
1078    @Block()
1079    public static class ImmunizationProtocolAppliedComponent extends BackboneElement implements IBaseBackboneElement {
1080        /**
1081         * One possible path to achieve presumed immunity against a disease - within the context of an authority.
1082         */
1083        @Child(name = "series", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
1084        @Description(shortDefinition="Name of vaccine series", formalDefinition="One possible path to achieve presumed immunity against a disease - within the context of an authority." )
1085        protected StringType series;
1086
1087        /**
1088         * Indicates the authority who published the protocol (e.g. ACIP) that is being followed.
1089         */
1090        @Child(name = "authority", type = {Organization.class}, order=2, min=0, max=1, modifier=false, summary=false)
1091        @Description(shortDefinition="Who is responsible for publishing the recommendations", formalDefinition="Indicates the authority who published the protocol (e.g. ACIP) that is being followed." )
1092        protected Reference authority;
1093
1094        /**
1095         * The vaccine preventable disease the dose is being administered against.
1096         */
1097        @Child(name = "targetDisease", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1098        @Description(shortDefinition="Vaccine preventatable disease being targetted", formalDefinition="The vaccine preventable disease the dose is being administered against." )
1099        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/immunization-target-disease")
1100        protected List<CodeableConcept> targetDisease;
1101
1102        /**
1103         * Nominal position in a series.
1104         */
1105        @Child(name = "doseNumber", type = {PositiveIntType.class, StringType.class}, order=4, min=1, max=1, modifier=false, summary=false)
1106        @Description(shortDefinition="Dose number within series", formalDefinition="Nominal position in a series." )
1107        protected Type doseNumber;
1108
1109        /**
1110         * The recommended number of doses to achieve immunity.
1111         */
1112        @Child(name = "seriesDoses", type = {PositiveIntType.class, StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
1113        @Description(shortDefinition="Recommended number of doses for immunity", formalDefinition="The recommended number of doses to achieve immunity." )
1114        protected Type seriesDoses;
1115
1116        private static final long serialVersionUID = -2021241903L;
1117
1118    /**
1119     * Constructor
1120     */
1121      public ImmunizationProtocolAppliedComponent() {
1122        super();
1123      }
1124
1125    /**
1126     * Constructor
1127     */
1128      public ImmunizationProtocolAppliedComponent(Type doseNumber) {
1129        super();
1130        this.doseNumber = doseNumber;
1131      }
1132
1133        /**
1134         * @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
1135         */
1136        public StringType getSeriesElement() { 
1137          if (this.series == null)
1138            if (Configuration.errorOnAutoCreate())
1139              throw new Error("Attempt to auto-create ImmunizationProtocolAppliedComponent.series");
1140            else if (Configuration.doAutoCreate())
1141              this.series = new StringType(); // bb
1142          return this.series;
1143        }
1144
1145        public boolean hasSeriesElement() { 
1146          return this.series != null && !this.series.isEmpty();
1147        }
1148
1149        public boolean hasSeries() { 
1150          return this.series != null && !this.series.isEmpty();
1151        }
1152
1153        /**
1154         * @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
1155         */
1156        public ImmunizationProtocolAppliedComponent setSeriesElement(StringType value) { 
1157          this.series = value;
1158          return this;
1159        }
1160
1161        /**
1162         * @return One possible path to achieve presumed immunity against a disease - within the context of an authority.
1163         */
1164        public String getSeries() { 
1165          return this.series == null ? null : this.series.getValue();
1166        }
1167
1168        /**
1169         * @param value One possible path to achieve presumed immunity against a disease - within the context of an authority.
1170         */
1171        public ImmunizationProtocolAppliedComponent setSeries(String value) { 
1172          if (Utilities.noString(value))
1173            this.series = null;
1174          else {
1175            if (this.series == null)
1176              this.series = new StringType();
1177            this.series.setValue(value);
1178          }
1179          return this;
1180        }
1181
1182        /**
1183         * @return {@link #authority} (Indicates the authority who published the protocol (e.g. ACIP) that is being followed.)
1184         */
1185        public Reference getAuthority() { 
1186          if (this.authority == null)
1187            if (Configuration.errorOnAutoCreate())
1188              throw new Error("Attempt to auto-create ImmunizationProtocolAppliedComponent.authority");
1189            else if (Configuration.doAutoCreate())
1190              this.authority = new Reference(); // cc
1191          return this.authority;
1192        }
1193
1194        public boolean hasAuthority() { 
1195          return this.authority != null && !this.authority.isEmpty();
1196        }
1197
1198        /**
1199         * @param value {@link #authority} (Indicates the authority who published the protocol (e.g. ACIP) that is being followed.)
1200         */
1201        public ImmunizationProtocolAppliedComponent setAuthority(Reference value) { 
1202          this.authority = value;
1203          return this;
1204        }
1205
1206        /**
1207         * @return {@link #targetDisease} (The vaccine preventable disease the dose is being administered against.)
1208         */
1209        public List<CodeableConcept> getTargetDisease() { 
1210          if (this.targetDisease == null)
1211            this.targetDisease = new ArrayList<CodeableConcept>();
1212          return this.targetDisease;
1213        }
1214
1215        /**
1216         * @return Returns a reference to <code>this</code> for easy method chaining
1217         */
1218        public ImmunizationProtocolAppliedComponent setTargetDisease(List<CodeableConcept> theTargetDisease) { 
1219          this.targetDisease = theTargetDisease;
1220          return this;
1221        }
1222
1223        public boolean hasTargetDisease() { 
1224          if (this.targetDisease == null)
1225            return false;
1226          for (CodeableConcept item : this.targetDisease)
1227            if (!item.isEmpty())
1228              return true;
1229          return false;
1230        }
1231
1232        public CodeableConcept addTargetDisease() { //3
1233          CodeableConcept t = new CodeableConcept();
1234          if (this.targetDisease == null)
1235            this.targetDisease = new ArrayList<CodeableConcept>();
1236          this.targetDisease.add(t);
1237          return t;
1238        }
1239
1240        public ImmunizationProtocolAppliedComponent addTargetDisease(CodeableConcept t) { //3
1241          if (t == null)
1242            return this;
1243          if (this.targetDisease == null)
1244            this.targetDisease = new ArrayList<CodeableConcept>();
1245          this.targetDisease.add(t);
1246          return this;
1247        }
1248
1249        /**
1250         * @return The first repetition of repeating field {@link #targetDisease}, creating it if it does not already exist
1251         */
1252        public CodeableConcept getTargetDiseaseFirstRep() { 
1253          if (getTargetDisease().isEmpty()) {
1254            addTargetDisease();
1255          }
1256          return getTargetDisease().get(0);
1257        }
1258
1259        /**
1260         * @return {@link #doseNumber} (Nominal position in a series.)
1261         */
1262        public Type getDoseNumber() { 
1263          return this.doseNumber;
1264        }
1265
1266        /**
1267         * @return {@link #doseNumber} (Nominal position in a series.)
1268         */
1269        public PositiveIntType getDoseNumberPositiveIntType() throws FHIRException { 
1270          if (this.doseNumber == null)
1271            this.doseNumber = new PositiveIntType();
1272          if (!(this.doseNumber instanceof PositiveIntType))
1273            throw new FHIRException("Type mismatch: the type PositiveIntType was expected, but "+this.doseNumber.getClass().getName()+" was encountered");
1274          return (PositiveIntType) this.doseNumber;
1275        }
1276
1277        public boolean hasDoseNumberPositiveIntType() { 
1278          return this != null && this.doseNumber instanceof PositiveIntType;
1279        }
1280
1281        /**
1282         * @return {@link #doseNumber} (Nominal position in a series.)
1283         */
1284        public StringType getDoseNumberStringType() throws FHIRException { 
1285          if (this.doseNumber == null)
1286            this.doseNumber = new StringType();
1287          if (!(this.doseNumber instanceof StringType))
1288            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.doseNumber.getClass().getName()+" was encountered");
1289          return (StringType) this.doseNumber;
1290        }
1291
1292        public boolean hasDoseNumberStringType() { 
1293          return this != null && this.doseNumber instanceof StringType;
1294        }
1295
1296        public boolean hasDoseNumber() { 
1297          return this.doseNumber != null && !this.doseNumber.isEmpty();
1298        }
1299
1300        /**
1301         * @param value {@link #doseNumber} (Nominal position in a series.)
1302         */
1303        public ImmunizationProtocolAppliedComponent setDoseNumber(Type value) { 
1304          if (value != null && !(value instanceof PositiveIntType || value instanceof StringType))
1305            throw new Error("Not the right type for Immunization.protocolApplied.doseNumber[x]: "+value.fhirType());
1306          this.doseNumber = value;
1307          return this;
1308        }
1309
1310        /**
1311         * @return {@link #seriesDoses} (The recommended number of doses to achieve immunity.)
1312         */
1313        public Type getSeriesDoses() { 
1314          return this.seriesDoses;
1315        }
1316
1317        /**
1318         * @return {@link #seriesDoses} (The recommended number of doses to achieve immunity.)
1319         */
1320        public PositiveIntType getSeriesDosesPositiveIntType() throws FHIRException { 
1321          if (this.seriesDoses == null)
1322            this.seriesDoses = new PositiveIntType();
1323          if (!(this.seriesDoses instanceof PositiveIntType))
1324            throw new FHIRException("Type mismatch: the type PositiveIntType was expected, but "+this.seriesDoses.getClass().getName()+" was encountered");
1325          return (PositiveIntType) this.seriesDoses;
1326        }
1327
1328        public boolean hasSeriesDosesPositiveIntType() { 
1329          return this != null && this.seriesDoses instanceof PositiveIntType;
1330        }
1331
1332        /**
1333         * @return {@link #seriesDoses} (The recommended number of doses to achieve immunity.)
1334         */
1335        public StringType getSeriesDosesStringType() throws FHIRException { 
1336          if (this.seriesDoses == null)
1337            this.seriesDoses = new StringType();
1338          if (!(this.seriesDoses instanceof StringType))
1339            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.seriesDoses.getClass().getName()+" was encountered");
1340          return (StringType) this.seriesDoses;
1341        }
1342
1343        public boolean hasSeriesDosesStringType() { 
1344          return this != null && this.seriesDoses instanceof StringType;
1345        }
1346
1347        public boolean hasSeriesDoses() { 
1348          return this.seriesDoses != null && !this.seriesDoses.isEmpty();
1349        }
1350
1351        /**
1352         * @param value {@link #seriesDoses} (The recommended number of doses to achieve immunity.)
1353         */
1354        public ImmunizationProtocolAppliedComponent setSeriesDoses(Type value) { 
1355          if (value != null && !(value instanceof PositiveIntType || value instanceof StringType))
1356            throw new Error("Not the right type for Immunization.protocolApplied.seriesDoses[x]: "+value.fhirType());
1357          this.seriesDoses = value;
1358          return this;
1359        }
1360
1361        protected void listChildren(List<Property> children) {
1362          super.listChildren(children);
1363          children.add(new Property("series", "string", "One possible path to achieve presumed immunity against a disease - within the context of an authority.", 0, 1, series));
1364          children.add(new Property("authority", "Reference(Organization)", "Indicates the authority who published the protocol (e.g. ACIP) that is being followed.", 0, 1, authority));
1365          children.add(new Property("targetDisease", "CodeableConcept", "The vaccine preventable disease the dose is being administered against.", 0, java.lang.Integer.MAX_VALUE, targetDisease));
1366          children.add(new Property("doseNumber[x]", "positiveInt|string", "Nominal position in a series.", 0, 1, doseNumber));
1367          children.add(new Property("seriesDoses[x]", "positiveInt|string", "The recommended number of doses to achieve immunity.", 0, 1, seriesDoses));
1368        }
1369
1370        @Override
1371        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1372          switch (_hash) {
1373          case -905838985: /*series*/  return new Property("series", "string", "One possible path to achieve presumed immunity against a disease - within the context of an authority.", 0, 1, series);
1374          case 1475610435: /*authority*/  return new Property("authority", "Reference(Organization)", "Indicates the authority who published the protocol (e.g. ACIP) that is being followed.", 0, 1, authority);
1375          case -319593813: /*targetDisease*/  return new Property("targetDisease", "CodeableConcept", "The vaccine preventable disease the dose is being administered against.", 0, java.lang.Integer.MAX_VALUE, targetDisease);
1376          case -1632295686: /*doseNumber[x]*/  return new Property("doseNumber[x]", "positiveInt|string", "Nominal position in a series.", 0, 1, doseNumber);
1377          case -887709242: /*doseNumber*/  return new Property("doseNumber[x]", "positiveInt|string", "Nominal position in a series.", 0, 1, doseNumber);
1378          case -1826134640: /*doseNumberPositiveInt*/  return new Property("doseNumber[x]", "positiveInt|string", "Nominal position in a series.", 0, 1, doseNumber);
1379          case -333053577: /*doseNumberString*/  return new Property("doseNumber[x]", "positiveInt|string", "Nominal position in a series.", 0, 1, doseNumber);
1380          case 1553560673: /*seriesDoses[x]*/  return new Property("seriesDoses[x]", "positiveInt|string", "The recommended number of doses to achieve immunity.", 0, 1, seriesDoses);
1381          case -1936727105: /*seriesDoses*/  return new Property("seriesDoses[x]", "positiveInt|string", "The recommended number of doses to achieve immunity.", 0, 1, seriesDoses);
1382          case -220897801: /*seriesDosesPositiveInt*/  return new Property("seriesDoses[x]", "positiveInt|string", "The recommended number of doses to achieve immunity.", 0, 1, seriesDoses);
1383          case -673569616: /*seriesDosesString*/  return new Property("seriesDoses[x]", "positiveInt|string", "The recommended number of doses to achieve immunity.", 0, 1, seriesDoses);
1384          default: return super.getNamedProperty(_hash, _name, _checkValid);
1385          }
1386
1387        }
1388
1389      @Override
1390      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1391        switch (hash) {
1392        case -905838985: /*series*/ return this.series == null ? new Base[0] : new Base[] {this.series}; // StringType
1393        case 1475610435: /*authority*/ return this.authority == null ? new Base[0] : new Base[] {this.authority}; // Reference
1394        case -319593813: /*targetDisease*/ return this.targetDisease == null ? new Base[0] : this.targetDisease.toArray(new Base[this.targetDisease.size()]); // CodeableConcept
1395        case -887709242: /*doseNumber*/ return this.doseNumber == null ? new Base[0] : new Base[] {this.doseNumber}; // Type
1396        case -1936727105: /*seriesDoses*/ return this.seriesDoses == null ? new Base[0] : new Base[] {this.seriesDoses}; // Type
1397        default: return super.getProperty(hash, name, checkValid);
1398        }
1399
1400      }
1401
1402      @Override
1403      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1404        switch (hash) {
1405        case -905838985: // series
1406          this.series = castToString(value); // StringType
1407          return value;
1408        case 1475610435: // authority
1409          this.authority = castToReference(value); // Reference
1410          return value;
1411        case -319593813: // targetDisease
1412          this.getTargetDisease().add(castToCodeableConcept(value)); // CodeableConcept
1413          return value;
1414        case -887709242: // doseNumber
1415          this.doseNumber = castToType(value); // Type
1416          return value;
1417        case -1936727105: // seriesDoses
1418          this.seriesDoses = castToType(value); // Type
1419          return value;
1420        default: return super.setProperty(hash, name, value);
1421        }
1422
1423      }
1424
1425      @Override
1426      public Base setProperty(String name, Base value) throws FHIRException {
1427        if (name.equals("series")) {
1428          this.series = castToString(value); // StringType
1429        } else if (name.equals("authority")) {
1430          this.authority = castToReference(value); // Reference
1431        } else if (name.equals("targetDisease")) {
1432          this.getTargetDisease().add(castToCodeableConcept(value));
1433        } else if (name.equals("doseNumber[x]")) {
1434          this.doseNumber = castToType(value); // Type
1435        } else if (name.equals("seriesDoses[x]")) {
1436          this.seriesDoses = castToType(value); // Type
1437        } else
1438          return super.setProperty(name, value);
1439        return value;
1440      }
1441
1442      @Override
1443      public Base makeProperty(int hash, String name) throws FHIRException {
1444        switch (hash) {
1445        case -905838985:  return getSeriesElement();
1446        case 1475610435:  return getAuthority();
1447        case -319593813:  return addTargetDisease(); 
1448        case -1632295686:  return getDoseNumber();
1449        case -887709242:  return getDoseNumber();
1450        case 1553560673:  return getSeriesDoses();
1451        case -1936727105:  return getSeriesDoses();
1452        default: return super.makeProperty(hash, name);
1453        }
1454
1455      }
1456
1457      @Override
1458      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1459        switch (hash) {
1460        case -905838985: /*series*/ return new String[] {"string"};
1461        case 1475610435: /*authority*/ return new String[] {"Reference"};
1462        case -319593813: /*targetDisease*/ return new String[] {"CodeableConcept"};
1463        case -887709242: /*doseNumber*/ return new String[] {"positiveInt", "string"};
1464        case -1936727105: /*seriesDoses*/ return new String[] {"positiveInt", "string"};
1465        default: return super.getTypesForProperty(hash, name);
1466        }
1467
1468      }
1469
1470      @Override
1471      public Base addChild(String name) throws FHIRException {
1472        if (name.equals("series")) {
1473          throw new FHIRException("Cannot call addChild on a primitive type Immunization.series");
1474        }
1475        else if (name.equals("authority")) {
1476          this.authority = new Reference();
1477          return this.authority;
1478        }
1479        else if (name.equals("targetDisease")) {
1480          return addTargetDisease();
1481        }
1482        else if (name.equals("doseNumberPositiveInt")) {
1483          this.doseNumber = new PositiveIntType();
1484          return this.doseNumber;
1485        }
1486        else if (name.equals("doseNumberString")) {
1487          this.doseNumber = new StringType();
1488          return this.doseNumber;
1489        }
1490        else if (name.equals("seriesDosesPositiveInt")) {
1491          this.seriesDoses = new PositiveIntType();
1492          return this.seriesDoses;
1493        }
1494        else if (name.equals("seriesDosesString")) {
1495          this.seriesDoses = new StringType();
1496          return this.seriesDoses;
1497        }
1498        else
1499          return super.addChild(name);
1500      }
1501
1502      public ImmunizationProtocolAppliedComponent copy() {
1503        ImmunizationProtocolAppliedComponent dst = new ImmunizationProtocolAppliedComponent();
1504        copyValues(dst);
1505        return dst;
1506      }
1507
1508      public void copyValues(ImmunizationProtocolAppliedComponent dst) {
1509        super.copyValues(dst);
1510        dst.series = series == null ? null : series.copy();
1511        dst.authority = authority == null ? null : authority.copy();
1512        if (targetDisease != null) {
1513          dst.targetDisease = new ArrayList<CodeableConcept>();
1514          for (CodeableConcept i : targetDisease)
1515            dst.targetDisease.add(i.copy());
1516        };
1517        dst.doseNumber = doseNumber == null ? null : doseNumber.copy();
1518        dst.seriesDoses = seriesDoses == null ? null : seriesDoses.copy();
1519      }
1520
1521      @Override
1522      public boolean equalsDeep(Base other_) {
1523        if (!super.equalsDeep(other_))
1524          return false;
1525        if (!(other_ instanceof ImmunizationProtocolAppliedComponent))
1526          return false;
1527        ImmunizationProtocolAppliedComponent o = (ImmunizationProtocolAppliedComponent) other_;
1528        return compareDeep(series, o.series, true) && compareDeep(authority, o.authority, true) && compareDeep(targetDisease, o.targetDisease, true)
1529           && compareDeep(doseNumber, o.doseNumber, true) && compareDeep(seriesDoses, o.seriesDoses, true)
1530          ;
1531      }
1532
1533      @Override
1534      public boolean equalsShallow(Base other_) {
1535        if (!super.equalsShallow(other_))
1536          return false;
1537        if (!(other_ instanceof ImmunizationProtocolAppliedComponent))
1538          return false;
1539        ImmunizationProtocolAppliedComponent o = (ImmunizationProtocolAppliedComponent) other_;
1540        return compareValues(series, o.series, true);
1541      }
1542
1543      public boolean isEmpty() {
1544        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(series, authority, targetDisease
1545          , doseNumber, seriesDoses);
1546      }
1547
1548  public String fhirType() {
1549    return "Immunization.protocolApplied";
1550
1551  }
1552
1553  }
1554
1555    /**
1556     * A unique identifier assigned to this immunization record.
1557     */
1558    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1559    @Description(shortDefinition="Business identifier", formalDefinition="A unique identifier assigned to this immunization record." )
1560    protected List<Identifier> identifier;
1561
1562    /**
1563     * Indicates the current status of the immunization event.
1564     */
1565    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
1566    @Description(shortDefinition="completed | entered-in-error | not-done", formalDefinition="Indicates the current status of the immunization event." )
1567    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/immunization-status")
1568    protected Enumeration<ImmunizationStatus> status;
1569
1570    /**
1571     * Indicates the reason the immunization event was not performed.
1572     */
1573    @Child(name = "statusReason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
1574    @Description(shortDefinition="Reason for current status", formalDefinition="Indicates the reason the immunization event was not performed." )
1575    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/immunization-status-reason")
1576    protected CodeableConcept statusReason;
1577
1578    /**
1579     * Vaccine that was administered or was to be administered.
1580     */
1581    @Child(name = "vaccineCode", type = {CodeableConcept.class}, order=3, min=1, max=1, modifier=false, summary=true)
1582    @Description(shortDefinition="Vaccine product administered", formalDefinition="Vaccine that was administered or was to be administered." )
1583    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/vaccine-code")
1584    protected CodeableConcept vaccineCode;
1585
1586    /**
1587     * The patient who either received or did not receive the immunization.
1588     */
1589    @Child(name = "patient", type = {Patient.class}, order=4, min=1, max=1, modifier=false, summary=true)
1590    @Description(shortDefinition="Who was immunized", formalDefinition="The patient who either received or did not receive the immunization." )
1591    protected Reference patient;
1592
1593    /**
1594     * The visit or admission or other contact between patient and health care provider the immunization was performed as part of.
1595     */
1596    @Child(name = "encounter", type = {Encounter.class}, order=5, min=0, max=1, modifier=false, summary=false)
1597    @Description(shortDefinition="Encounter immunization was part of", formalDefinition="The visit or admission or other contact between patient and health care provider the immunization was performed as part of." )
1598    protected Reference encounter;
1599
1600    /**
1601     * Date vaccine administered or was to be administered.
1602     */
1603    @Child(name = "occurrence", type = {DateTimeType.class, StringType.class}, order=6, min=1, max=1, modifier=false, summary=true)
1604    @Description(shortDefinition="Vaccine administration date", formalDefinition="Date vaccine administered or was to be administered." )
1605    protected Type occurrence;
1606
1607    /**
1608     * The date the occurrence of the immunization was first captured in the record - potentially significantly after the occurrence of the event.
1609     */
1610    @Child(name = "recorded", type = {DateTimeType.class}, order=7, min=0, max=1, modifier=false, summary=false)
1611    @Description(shortDefinition="When the immunization was first captured in the subject's record", formalDefinition="The date the occurrence of the immunization was first captured in the record - potentially significantly after the occurrence of the event." )
1612    protected DateTimeType recorded;
1613
1614    /**
1615     * Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record.
1616     */
1617    @Child(name = "primarySource", type = {BooleanType.class}, order=8, min=0, max=1, modifier=false, summary=true)
1618    @Description(shortDefinition="Indicates context the data was recorded in", formalDefinition="Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record." )
1619    protected BooleanType primarySource;
1620
1621    /**
1622     * Typically the source of the data when the report of the immunization event is not based on information from the person who administered the vaccine.
1623     */
1624    @Child(name = "informationSource", type = {CodeableConcept.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class, Organization.class}, order=9, min=0, max=1, modifier=false, summary=false)
1625    @Description(shortDefinition="Indicates the source of a  reported record", formalDefinition="Typically the source of the data when the report of the immunization event is not based on information from the person who administered the vaccine." )
1626    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/immunization-origin")
1627    protected Type informationSource;
1628
1629    /**
1630     * The service delivery location where the vaccine administration occurred.
1631     */
1632    @Child(name = "location", type = {Location.class}, order=10, min=0, max=1, modifier=false, summary=false)
1633    @Description(shortDefinition="Where immunization occurred", formalDefinition="The service delivery location where the vaccine administration occurred." )
1634    protected Reference location;
1635
1636    /**
1637     * Name of vaccine manufacturer.
1638     */
1639    @Child(name = "manufacturer", type = {Organization.class}, order=11, min=0, max=1, modifier=false, summary=false)
1640    @Description(shortDefinition="Vaccine manufacturer", formalDefinition="Name of vaccine manufacturer." )
1641    protected Reference manufacturer;
1642
1643    /**
1644     * Lot number of the  vaccine product.
1645     */
1646    @Child(name = "lotNumber", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=false)
1647    @Description(shortDefinition="Vaccine lot number", formalDefinition="Lot number of the  vaccine product." )
1648    protected StringType lotNumber;
1649
1650    /**
1651     * Date vaccine batch expires.
1652     */
1653    @Child(name = "expirationDate", type = {DateType.class}, order=13, min=0, max=1, modifier=false, summary=false)
1654    @Description(shortDefinition="Vaccine expiration date", formalDefinition="Date vaccine batch expires." )
1655    protected DateType expirationDate;
1656
1657    /**
1658     * Body site where vaccine was administered.
1659     */
1660    @Child(name = "site", type = {CodeableConcept.class}, order=14, min=0, max=1, modifier=false, summary=false)
1661    @Description(shortDefinition="Body site vaccine  was administered", formalDefinition="Body site where vaccine was administered." )
1662    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/immunization-site")
1663    protected CodeableConcept site;
1664
1665    /**
1666     * The path by which the vaccine product is taken into the body.
1667     */
1668    @Child(name = "route", type = {CodeableConcept.class}, order=15, min=0, max=1, modifier=false, summary=false)
1669    @Description(shortDefinition="How vaccine entered body", formalDefinition="The path by which the vaccine product is taken into the body." )
1670    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/immunization-route")
1671    protected CodeableConcept route;
1672
1673    /**
1674     * The quantity of vaccine product that was administered.
1675     */
1676    @Child(name = "doseQuantity", type = {Quantity.class}, order=16, min=0, max=1, modifier=false, summary=false)
1677    @Description(shortDefinition="Amount of vaccine administered", formalDefinition="The quantity of vaccine product that was administered." )
1678    protected Quantity doseQuantity;
1679
1680    /**
1681     * Indicates who performed the immunization event.
1682     */
1683    @Child(name = "performer", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1684    @Description(shortDefinition="Who performed event", formalDefinition="Indicates who performed the immunization event." )
1685    protected List<ImmunizationPerformerComponent> performer;
1686
1687    /**
1688     * Extra information about the immunization that is not conveyed by the other attributes.
1689     */
1690    @Child(name = "note", type = {Annotation.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1691    @Description(shortDefinition="Additional immunization notes", formalDefinition="Extra information about the immunization that is not conveyed by the other attributes." )
1692    protected List<Annotation> note;
1693
1694    /**
1695     * Describes why the immunization occurred in coded or textual form.
1696     */
1697    @Child(name = "reasonCode", type = {CodeableConcept.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1698    @Description(shortDefinition="Why immunization occurred", formalDefinition="Describes why the immunization occurred in coded or textual form." )
1699    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/immunization-reason")
1700    protected List<CodeableConcept> reasonCode;
1701
1702    /**
1703     * Indicates another resource (Condition, Observation or DiagnosticReport) whose existence justifies this immunization.
1704     */
1705    @Child(name = "reasonReference", type = {Condition.class, Observation.class, DiagnosticReport.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1706    @Description(shortDefinition="Why immunization occurred", formalDefinition="Indicates another resource (Condition, Observation or DiagnosticReport) whose existence justifies this immunization." )
1707    protected List<Reference> reasonReference;
1708
1709    /**
1710     * Indication if a dose is considered to be subpotent. By default, a dose should be considered to be potent.
1711     */
1712    @Child(name = "isSubpotent", type = {BooleanType.class}, order=21, min=0, max=1, modifier=true, summary=true)
1713    @Description(shortDefinition="Dose potency", formalDefinition="Indication if a dose is considered to be subpotent. By default, a dose should be considered to be potent." )
1714    protected BooleanType isSubpotent;
1715
1716    /**
1717     * Reason why a dose is considered to be subpotent.
1718     */
1719    @Child(name = "subpotentReason", type = {CodeableConcept.class}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1720    @Description(shortDefinition="Reason for being subpotent", formalDefinition="Reason why a dose is considered to be subpotent." )
1721    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/immunization-subpotent-reason")
1722    protected List<CodeableConcept> subpotentReason;
1723
1724    /**
1725     * Educational material presented to the patient (or guardian) at the time of vaccine administration.
1726     */
1727    @Child(name = "education", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1728    @Description(shortDefinition="Educational material presented to patient", formalDefinition="Educational material presented to the patient (or guardian) at the time of vaccine administration." )
1729    protected List<ImmunizationEducationComponent> education;
1730
1731    /**
1732     * Indicates a patient's eligibility for a funding program.
1733     */
1734    @Child(name = "programEligibility", type = {CodeableConcept.class}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1735    @Description(shortDefinition="Patient eligibility for a vaccination program", formalDefinition="Indicates a patient's eligibility for a funding program." )
1736    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/immunization-program-eligibility")
1737    protected List<CodeableConcept> programEligibility;
1738
1739    /**
1740     * Indicates the source of the vaccine actually administered. This may be different than the patient eligibility (e.g. the patient may be eligible for a publically purchased vaccine but due to inventory issues, vaccine purchased with private funds was actually administered).
1741     */
1742    @Child(name = "fundingSource", type = {CodeableConcept.class}, order=25, min=0, max=1, modifier=false, summary=false)
1743    @Description(shortDefinition="Funding source for the vaccine", formalDefinition="Indicates the source of the vaccine actually administered. This may be different than the patient eligibility (e.g. the patient may be eligible for a publically purchased vaccine but due to inventory issues, vaccine purchased with private funds was actually administered)." )
1744    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/immunization-funding-source")
1745    protected CodeableConcept fundingSource;
1746
1747    /**
1748     * Categorical data indicating that an adverse event is associated in time to an immunization.
1749     */
1750    @Child(name = "reaction", type = {}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1751    @Description(shortDefinition="Details of a reaction that follows immunization", formalDefinition="Categorical data indicating that an adverse event is associated in time to an immunization." )
1752    protected List<ImmunizationReactionComponent> reaction;
1753
1754    /**
1755     * The protocol (set of recommendations) being followed by the provider who administered the dose.
1756     */
1757    @Child(name = "protocolApplied", type = {}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1758    @Description(shortDefinition="Protocol followed by the provider", formalDefinition="The protocol (set of recommendations) being followed by the provider who administered the dose." )
1759    protected List<ImmunizationProtocolAppliedComponent> protocolApplied;
1760
1761    private static final long serialVersionUID = -257151409L;
1762
1763  /**
1764   * Constructor
1765   */
1766    public Immunization() {
1767      super();
1768    }
1769
1770  /**
1771   * Constructor
1772   */
1773    public Immunization(Enumeration<ImmunizationStatus> status, CodeableConcept vaccineCode, Reference patient, Type occurrence) {
1774      super();
1775      this.status = status;
1776      this.vaccineCode = vaccineCode;
1777      this.patient = patient;
1778      this.occurrence = occurrence;
1779    }
1780
1781    /**
1782     * @return {@link #identifier} (A unique identifier assigned to this immunization record.)
1783     */
1784    public List<Identifier> getIdentifier() { 
1785      if (this.identifier == null)
1786        this.identifier = new ArrayList<Identifier>();
1787      return this.identifier;
1788    }
1789
1790    /**
1791     * @return Returns a reference to <code>this</code> for easy method chaining
1792     */
1793    public Immunization setIdentifier(List<Identifier> theIdentifier) { 
1794      this.identifier = theIdentifier;
1795      return this;
1796    }
1797
1798    public boolean hasIdentifier() { 
1799      if (this.identifier == null)
1800        return false;
1801      for (Identifier item : this.identifier)
1802        if (!item.isEmpty())
1803          return true;
1804      return false;
1805    }
1806
1807    public Identifier addIdentifier() { //3
1808      Identifier t = new Identifier();
1809      if (this.identifier == null)
1810        this.identifier = new ArrayList<Identifier>();
1811      this.identifier.add(t);
1812      return t;
1813    }
1814
1815    public Immunization addIdentifier(Identifier t) { //3
1816      if (t == null)
1817        return this;
1818      if (this.identifier == null)
1819        this.identifier = new ArrayList<Identifier>();
1820      this.identifier.add(t);
1821      return this;
1822    }
1823
1824    /**
1825     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1826     */
1827    public Identifier getIdentifierFirstRep() { 
1828      if (getIdentifier().isEmpty()) {
1829        addIdentifier();
1830      }
1831      return getIdentifier().get(0);
1832    }
1833
1834    /**
1835     * @return {@link #status} (Indicates the current status of the immunization event.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1836     */
1837    public Enumeration<ImmunizationStatus> getStatusElement() { 
1838      if (this.status == null)
1839        if (Configuration.errorOnAutoCreate())
1840          throw new Error("Attempt to auto-create Immunization.status");
1841        else if (Configuration.doAutoCreate())
1842          this.status = new Enumeration<ImmunizationStatus>(new ImmunizationStatusEnumFactory()); // bb
1843      return this.status;
1844    }
1845
1846    public boolean hasStatusElement() { 
1847      return this.status != null && !this.status.isEmpty();
1848    }
1849
1850    public boolean hasStatus() { 
1851      return this.status != null && !this.status.isEmpty();
1852    }
1853
1854    /**
1855     * @param value {@link #status} (Indicates the current status of the immunization event.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1856     */
1857    public Immunization setStatusElement(Enumeration<ImmunizationStatus> value) { 
1858      this.status = value;
1859      return this;
1860    }
1861
1862    /**
1863     * @return Indicates the current status of the immunization event.
1864     */
1865    public ImmunizationStatus getStatus() { 
1866      return this.status == null ? null : this.status.getValue();
1867    }
1868
1869    /**
1870     * @param value Indicates the current status of the immunization event.
1871     */
1872    public Immunization setStatus(ImmunizationStatus value) { 
1873        if (this.status == null)
1874          this.status = new Enumeration<ImmunizationStatus>(new ImmunizationStatusEnumFactory());
1875        this.status.setValue(value);
1876      return this;
1877    }
1878
1879    /**
1880     * @return {@link #statusReason} (Indicates the reason the immunization event was not performed.)
1881     */
1882    public CodeableConcept getStatusReason() { 
1883      if (this.statusReason == null)
1884        if (Configuration.errorOnAutoCreate())
1885          throw new Error("Attempt to auto-create Immunization.statusReason");
1886        else if (Configuration.doAutoCreate())
1887          this.statusReason = new CodeableConcept(); // cc
1888      return this.statusReason;
1889    }
1890
1891    public boolean hasStatusReason() { 
1892      return this.statusReason != null && !this.statusReason.isEmpty();
1893    }
1894
1895    /**
1896     * @param value {@link #statusReason} (Indicates the reason the immunization event was not performed.)
1897     */
1898    public Immunization setStatusReason(CodeableConcept value) { 
1899      this.statusReason = value;
1900      return this;
1901    }
1902
1903    /**
1904     * @return {@link #vaccineCode} (Vaccine that was administered or was to be administered.)
1905     */
1906    public CodeableConcept getVaccineCode() { 
1907      if (this.vaccineCode == null)
1908        if (Configuration.errorOnAutoCreate())
1909          throw new Error("Attempt to auto-create Immunization.vaccineCode");
1910        else if (Configuration.doAutoCreate())
1911          this.vaccineCode = new CodeableConcept(); // cc
1912      return this.vaccineCode;
1913    }
1914
1915    public boolean hasVaccineCode() { 
1916      return this.vaccineCode != null && !this.vaccineCode.isEmpty();
1917    }
1918
1919    /**
1920     * @param value {@link #vaccineCode} (Vaccine that was administered or was to be administered.)
1921     */
1922    public Immunization setVaccineCode(CodeableConcept value) { 
1923      this.vaccineCode = value;
1924      return this;
1925    }
1926
1927    /**
1928     * @return {@link #patient} (The patient who either received or did not receive the immunization.)
1929     */
1930    public Reference getPatient() { 
1931      if (this.patient == null)
1932        if (Configuration.errorOnAutoCreate())
1933          throw new Error("Attempt to auto-create Immunization.patient");
1934        else if (Configuration.doAutoCreate())
1935          this.patient = new Reference(); // cc
1936      return this.patient;
1937    }
1938
1939    public boolean hasPatient() { 
1940      return this.patient != null && !this.patient.isEmpty();
1941    }
1942
1943    /**
1944     * @param value {@link #patient} (The patient who either received or did not receive the immunization.)
1945     */
1946    public Immunization setPatient(Reference value) { 
1947      this.patient = value;
1948      return this;
1949    }
1950
1951    /**
1952     * @return {@link #encounter} (The visit or admission or other contact between patient and health care provider the immunization was performed as part of.)
1953     */
1954    public Reference getEncounter() { 
1955      if (this.encounter == null)
1956        if (Configuration.errorOnAutoCreate())
1957          throw new Error("Attempt to auto-create Immunization.encounter");
1958        else if (Configuration.doAutoCreate())
1959          this.encounter = new Reference(); // cc
1960      return this.encounter;
1961    }
1962
1963    public boolean hasEncounter() { 
1964      return this.encounter != null && !this.encounter.isEmpty();
1965    }
1966
1967    /**
1968     * @param value {@link #encounter} (The visit or admission or other contact between patient and health care provider the immunization was performed as part of.)
1969     */
1970    public Immunization setEncounter(Reference value) { 
1971      this.encounter = value;
1972      return this;
1973    }
1974
1975    /**
1976     * @return {@link #occurrence} (Date vaccine administered or was to be administered.)
1977     */
1978    public Type getOccurrence() { 
1979      return this.occurrence;
1980    }
1981
1982    /**
1983     * @return {@link #occurrence} (Date vaccine administered or was to be administered.)
1984     */
1985    public DateTimeType getOccurrenceDateTimeType() throws FHIRException { 
1986      if (this.occurrence == null)
1987        this.occurrence = new DateTimeType();
1988      if (!(this.occurrence instanceof DateTimeType))
1989        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.occurrence.getClass().getName()+" was encountered");
1990      return (DateTimeType) this.occurrence;
1991    }
1992
1993    public boolean hasOccurrenceDateTimeType() { 
1994      return this != null && this.occurrence instanceof DateTimeType;
1995    }
1996
1997    /**
1998     * @return {@link #occurrence} (Date vaccine administered or was to be administered.)
1999     */
2000    public StringType getOccurrenceStringType() throws FHIRException { 
2001      if (this.occurrence == null)
2002        this.occurrence = new StringType();
2003      if (!(this.occurrence instanceof StringType))
2004        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.occurrence.getClass().getName()+" was encountered");
2005      return (StringType) this.occurrence;
2006    }
2007
2008    public boolean hasOccurrenceStringType() { 
2009      return this != null && this.occurrence instanceof StringType;
2010    }
2011
2012    public boolean hasOccurrence() { 
2013      return this.occurrence != null && !this.occurrence.isEmpty();
2014    }
2015
2016    /**
2017     * @param value {@link #occurrence} (Date vaccine administered or was to be administered.)
2018     */
2019    public Immunization setOccurrence(Type value) { 
2020      if (value != null && !(value instanceof DateTimeType || value instanceof StringType))
2021        throw new Error("Not the right type for Immunization.occurrence[x]: "+value.fhirType());
2022      this.occurrence = value;
2023      return this;
2024    }
2025
2026    /**
2027     * @return {@link #recorded} (The date the occurrence of the immunization was first captured in the record - potentially significantly after the occurrence of the event.). This is the underlying object with id, value and extensions. The accessor "getRecorded" gives direct access to the value
2028     */
2029    public DateTimeType getRecordedElement() { 
2030      if (this.recorded == null)
2031        if (Configuration.errorOnAutoCreate())
2032          throw new Error("Attempt to auto-create Immunization.recorded");
2033        else if (Configuration.doAutoCreate())
2034          this.recorded = new DateTimeType(); // bb
2035      return this.recorded;
2036    }
2037
2038    public boolean hasRecordedElement() { 
2039      return this.recorded != null && !this.recorded.isEmpty();
2040    }
2041
2042    public boolean hasRecorded() { 
2043      return this.recorded != null && !this.recorded.isEmpty();
2044    }
2045
2046    /**
2047     * @param value {@link #recorded} (The date the occurrence of the immunization was first captured in the record - potentially significantly after the occurrence of the event.). This is the underlying object with id, value and extensions. The accessor "getRecorded" gives direct access to the value
2048     */
2049    public Immunization setRecordedElement(DateTimeType value) { 
2050      this.recorded = value;
2051      return this;
2052    }
2053
2054    /**
2055     * @return The date the occurrence of the immunization was first captured in the record - potentially significantly after the occurrence of the event.
2056     */
2057    public Date getRecorded() { 
2058      return this.recorded == null ? null : this.recorded.getValue();
2059    }
2060
2061    /**
2062     * @param value The date the occurrence of the immunization was first captured in the record - potentially significantly after the occurrence of the event.
2063     */
2064    public Immunization setRecorded(Date value) { 
2065      if (value == null)
2066        this.recorded = null;
2067      else {
2068        if (this.recorded == null)
2069          this.recorded = new DateTimeType();
2070        this.recorded.setValue(value);
2071      }
2072      return this;
2073    }
2074
2075    /**
2076     * @return {@link #primarySource} (Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record.). This is the underlying object with id, value and extensions. The accessor "getPrimarySource" gives direct access to the value
2077     */
2078    public BooleanType getPrimarySourceElement() { 
2079      if (this.primarySource == null)
2080        if (Configuration.errorOnAutoCreate())
2081          throw new Error("Attempt to auto-create Immunization.primarySource");
2082        else if (Configuration.doAutoCreate())
2083          this.primarySource = new BooleanType(); // bb
2084      return this.primarySource;
2085    }
2086
2087    public boolean hasPrimarySourceElement() { 
2088      return this.primarySource != null && !this.primarySource.isEmpty();
2089    }
2090
2091    public boolean hasPrimarySource() { 
2092      return this.primarySource != null && !this.primarySource.isEmpty();
2093    }
2094
2095    /**
2096     * @param value {@link #primarySource} (Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record.). This is the underlying object with id, value and extensions. The accessor "getPrimarySource" gives direct access to the value
2097     */
2098    public Immunization setPrimarySourceElement(BooleanType value) { 
2099      this.primarySource = value;
2100      return this;
2101    }
2102
2103    /**
2104     * @return Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record.
2105     */
2106    public boolean getPrimarySource() { 
2107      return this.primarySource == null || this.primarySource.isEmpty() ? false : this.primarySource.getValue();
2108    }
2109
2110    /**
2111     * @param value Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record.
2112     */
2113    public Immunization setPrimarySource(boolean value) { 
2114        if (this.primarySource == null)
2115          this.primarySource = new BooleanType();
2116        this.primarySource.setValue(value);
2117      return this;
2118    }
2119
2120    /**
2121     * @return {@link #informationSource} (Typically the source of the data when the report of the immunization event is not based on information from the person who administered the vaccine.)
2122     */
2123    public Type getInformationSource() { 
2124      return this.informationSource;
2125    }
2126
2127    /**
2128     * @return {@link #informationSource} (Typically the source of the data when the report of the immunization event is not based on information from the person who administered the vaccine.)
2129     */
2130    public CodeableConcept getInformationSourceCodeableConcept() throws FHIRException { 
2131      if (this.informationSource == null)
2132        this.informationSource = new CodeableConcept();
2133      if (!(this.informationSource instanceof CodeableConcept))
2134        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.informationSource.getClass().getName()+" was encountered");
2135      return (CodeableConcept) this.informationSource;
2136    }
2137
2138    public boolean hasInformationSourceCodeableConcept() { 
2139      return this != null && this.informationSource instanceof CodeableConcept;
2140    }
2141
2142    /**
2143     * @return {@link #informationSource} (Typically the source of the data when the report of the immunization event is not based on information from the person who administered the vaccine.)
2144     */
2145    public Reference getInformationSourceReference() throws FHIRException { 
2146      if (this.informationSource == null)
2147        this.informationSource = new Reference();
2148      if (!(this.informationSource instanceof Reference))
2149        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.informationSource.getClass().getName()+" was encountered");
2150      return (Reference) this.informationSource;
2151    }
2152
2153    public boolean hasInformationSourceReference() { 
2154      return this != null && this.informationSource instanceof Reference;
2155    }
2156
2157    public boolean hasInformationSource() { 
2158      return this.informationSource != null && !this.informationSource.isEmpty();
2159    }
2160
2161    /**
2162     * @param value {@link #informationSource} (Typically the source of the data when the report of the immunization event is not based on information from the person who administered the vaccine.)
2163     */
2164    public Immunization setInformationSource(Type value) { 
2165      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2166        throw new Error("Not the right type for Immunization.informationSource[x]: "+value.fhirType());
2167      this.informationSource = value;
2168      return this;
2169    }
2170
2171    /**
2172     * @return {@link #location} (The service delivery location where the vaccine administration occurred.)
2173     */
2174    public Reference getLocation() { 
2175      if (this.location == null)
2176        if (Configuration.errorOnAutoCreate())
2177          throw new Error("Attempt to auto-create Immunization.location");
2178        else if (Configuration.doAutoCreate())
2179          this.location = new Reference(); // cc
2180      return this.location;
2181    }
2182
2183    public boolean hasLocation() { 
2184      return this.location != null && !this.location.isEmpty();
2185    }
2186
2187    /**
2188     * @param value {@link #location} (The service delivery location where the vaccine administration occurred.)
2189     */
2190    public Immunization setLocation(Reference value) { 
2191      this.location = value;
2192      return this;
2193    }
2194
2195    /**
2196     * @return {@link #manufacturer} (Name of vaccine manufacturer.)
2197     */
2198    public Reference getManufacturer() { 
2199      if (this.manufacturer == null)
2200        if (Configuration.errorOnAutoCreate())
2201          throw new Error("Attempt to auto-create Immunization.manufacturer");
2202        else if (Configuration.doAutoCreate())
2203          this.manufacturer = new Reference(); // cc
2204      return this.manufacturer;
2205    }
2206
2207    public boolean hasManufacturer() { 
2208      return this.manufacturer != null && !this.manufacturer.isEmpty();
2209    }
2210
2211    /**
2212     * @param value {@link #manufacturer} (Name of vaccine manufacturer.)
2213     */
2214    public Immunization setManufacturer(Reference value) { 
2215      this.manufacturer = value;
2216      return this;
2217    }
2218
2219    /**
2220     * @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
2221     */
2222    public StringType getLotNumberElement() { 
2223      if (this.lotNumber == null)
2224        if (Configuration.errorOnAutoCreate())
2225          throw new Error("Attempt to auto-create Immunization.lotNumber");
2226        else if (Configuration.doAutoCreate())
2227          this.lotNumber = new StringType(); // bb
2228      return this.lotNumber;
2229    }
2230
2231    public boolean hasLotNumberElement() { 
2232      return this.lotNumber != null && !this.lotNumber.isEmpty();
2233    }
2234
2235    public boolean hasLotNumber() { 
2236      return this.lotNumber != null && !this.lotNumber.isEmpty();
2237    }
2238
2239    /**
2240     * @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
2241     */
2242    public Immunization setLotNumberElement(StringType value) { 
2243      this.lotNumber = value;
2244      return this;
2245    }
2246
2247    /**
2248     * @return Lot number of the  vaccine product.
2249     */
2250    public String getLotNumber() { 
2251      return this.lotNumber == null ? null : this.lotNumber.getValue();
2252    }
2253
2254    /**
2255     * @param value Lot number of the  vaccine product.
2256     */
2257    public Immunization setLotNumber(String value) { 
2258      if (Utilities.noString(value))
2259        this.lotNumber = null;
2260      else {
2261        if (this.lotNumber == null)
2262          this.lotNumber = new StringType();
2263        this.lotNumber.setValue(value);
2264      }
2265      return this;
2266    }
2267
2268    /**
2269     * @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
2270     */
2271    public DateType getExpirationDateElement() { 
2272      if (this.expirationDate == null)
2273        if (Configuration.errorOnAutoCreate())
2274          throw new Error("Attempt to auto-create Immunization.expirationDate");
2275        else if (Configuration.doAutoCreate())
2276          this.expirationDate = new DateType(); // bb
2277      return this.expirationDate;
2278    }
2279
2280    public boolean hasExpirationDateElement() { 
2281      return this.expirationDate != null && !this.expirationDate.isEmpty();
2282    }
2283
2284    public boolean hasExpirationDate() { 
2285      return this.expirationDate != null && !this.expirationDate.isEmpty();
2286    }
2287
2288    /**
2289     * @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
2290     */
2291    public Immunization setExpirationDateElement(DateType value) { 
2292      this.expirationDate = value;
2293      return this;
2294    }
2295
2296    /**
2297     * @return Date vaccine batch expires.
2298     */
2299    public Date getExpirationDate() { 
2300      return this.expirationDate == null ? null : this.expirationDate.getValue();
2301    }
2302
2303    /**
2304     * @param value Date vaccine batch expires.
2305     */
2306    public Immunization setExpirationDate(Date value) { 
2307      if (value == null)
2308        this.expirationDate = null;
2309      else {
2310        if (this.expirationDate == null)
2311          this.expirationDate = new DateType();
2312        this.expirationDate.setValue(value);
2313      }
2314      return this;
2315    }
2316
2317    /**
2318     * @return {@link #site} (Body site where vaccine was administered.)
2319     */
2320    public CodeableConcept getSite() { 
2321      if (this.site == null)
2322        if (Configuration.errorOnAutoCreate())
2323          throw new Error("Attempt to auto-create Immunization.site");
2324        else if (Configuration.doAutoCreate())
2325          this.site = new CodeableConcept(); // cc
2326      return this.site;
2327    }
2328
2329    public boolean hasSite() { 
2330      return this.site != null && !this.site.isEmpty();
2331    }
2332
2333    /**
2334     * @param value {@link #site} (Body site where vaccine was administered.)
2335     */
2336    public Immunization setSite(CodeableConcept value) { 
2337      this.site = value;
2338      return this;
2339    }
2340
2341    /**
2342     * @return {@link #route} (The path by which the vaccine product is taken into the body.)
2343     */
2344    public CodeableConcept getRoute() { 
2345      if (this.route == null)
2346        if (Configuration.errorOnAutoCreate())
2347          throw new Error("Attempt to auto-create Immunization.route");
2348        else if (Configuration.doAutoCreate())
2349          this.route = new CodeableConcept(); // cc
2350      return this.route;
2351    }
2352
2353    public boolean hasRoute() { 
2354      return this.route != null && !this.route.isEmpty();
2355    }
2356
2357    /**
2358     * @param value {@link #route} (The path by which the vaccine product is taken into the body.)
2359     */
2360    public Immunization setRoute(CodeableConcept value) { 
2361      this.route = value;
2362      return this;
2363    }
2364
2365    /**
2366     * @return {@link #doseQuantity} (The quantity of vaccine product that was administered.)
2367     */
2368    public Quantity getDoseQuantity() { 
2369      if (this.doseQuantity == null)
2370        if (Configuration.errorOnAutoCreate())
2371          throw new Error("Attempt to auto-create Immunization.doseQuantity");
2372        else if (Configuration.doAutoCreate())
2373          this.doseQuantity = new Quantity(); // cc
2374      return this.doseQuantity;
2375    }
2376
2377    public boolean hasDoseQuantity() { 
2378      return this.doseQuantity != null && !this.doseQuantity.isEmpty();
2379    }
2380
2381    /**
2382     * @param value {@link #doseQuantity} (The quantity of vaccine product that was administered.)
2383     */
2384    public Immunization setDoseQuantity(Quantity value) { 
2385      this.doseQuantity = value;
2386      return this;
2387    }
2388
2389    /**
2390     * @return {@link #performer} (Indicates who performed the immunization event.)
2391     */
2392    public List<ImmunizationPerformerComponent> getPerformer() { 
2393      if (this.performer == null)
2394        this.performer = new ArrayList<ImmunizationPerformerComponent>();
2395      return this.performer;
2396    }
2397
2398    /**
2399     * @return Returns a reference to <code>this</code> for easy method chaining
2400     */
2401    public Immunization setPerformer(List<ImmunizationPerformerComponent> thePerformer) { 
2402      this.performer = thePerformer;
2403      return this;
2404    }
2405
2406    public boolean hasPerformer() { 
2407      if (this.performer == null)
2408        return false;
2409      for (ImmunizationPerformerComponent item : this.performer)
2410        if (!item.isEmpty())
2411          return true;
2412      return false;
2413    }
2414
2415    public ImmunizationPerformerComponent addPerformer() { //3
2416      ImmunizationPerformerComponent t = new ImmunizationPerformerComponent();
2417      if (this.performer == null)
2418        this.performer = new ArrayList<ImmunizationPerformerComponent>();
2419      this.performer.add(t);
2420      return t;
2421    }
2422
2423    public Immunization addPerformer(ImmunizationPerformerComponent t) { //3
2424      if (t == null)
2425        return this;
2426      if (this.performer == null)
2427        this.performer = new ArrayList<ImmunizationPerformerComponent>();
2428      this.performer.add(t);
2429      return this;
2430    }
2431
2432    /**
2433     * @return The first repetition of repeating field {@link #performer}, creating it if it does not already exist
2434     */
2435    public ImmunizationPerformerComponent getPerformerFirstRep() { 
2436      if (getPerformer().isEmpty()) {
2437        addPerformer();
2438      }
2439      return getPerformer().get(0);
2440    }
2441
2442    /**
2443     * @return {@link #note} (Extra information about the immunization that is not conveyed by the other attributes.)
2444     */
2445    public List<Annotation> getNote() { 
2446      if (this.note == null)
2447        this.note = new ArrayList<Annotation>();
2448      return this.note;
2449    }
2450
2451    /**
2452     * @return Returns a reference to <code>this</code> for easy method chaining
2453     */
2454    public Immunization setNote(List<Annotation> theNote) { 
2455      this.note = theNote;
2456      return this;
2457    }
2458
2459    public boolean hasNote() { 
2460      if (this.note == null)
2461        return false;
2462      for (Annotation item : this.note)
2463        if (!item.isEmpty())
2464          return true;
2465      return false;
2466    }
2467
2468    public Annotation addNote() { //3
2469      Annotation t = new Annotation();
2470      if (this.note == null)
2471        this.note = new ArrayList<Annotation>();
2472      this.note.add(t);
2473      return t;
2474    }
2475
2476    public Immunization addNote(Annotation t) { //3
2477      if (t == null)
2478        return this;
2479      if (this.note == null)
2480        this.note = new ArrayList<Annotation>();
2481      this.note.add(t);
2482      return this;
2483    }
2484
2485    /**
2486     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
2487     */
2488    public Annotation getNoteFirstRep() { 
2489      if (getNote().isEmpty()) {
2490        addNote();
2491      }
2492      return getNote().get(0);
2493    }
2494
2495    /**
2496     * @return {@link #reasonCode} (Describes why the immunization occurred in coded or textual form.)
2497     */
2498    public List<CodeableConcept> getReasonCode() { 
2499      if (this.reasonCode == null)
2500        this.reasonCode = new ArrayList<CodeableConcept>();
2501      return this.reasonCode;
2502    }
2503
2504    /**
2505     * @return Returns a reference to <code>this</code> for easy method chaining
2506     */
2507    public Immunization setReasonCode(List<CodeableConcept> theReasonCode) { 
2508      this.reasonCode = theReasonCode;
2509      return this;
2510    }
2511
2512    public boolean hasReasonCode() { 
2513      if (this.reasonCode == null)
2514        return false;
2515      for (CodeableConcept item : this.reasonCode)
2516        if (!item.isEmpty())
2517          return true;
2518      return false;
2519    }
2520
2521    public CodeableConcept addReasonCode() { //3
2522      CodeableConcept t = new CodeableConcept();
2523      if (this.reasonCode == null)
2524        this.reasonCode = new ArrayList<CodeableConcept>();
2525      this.reasonCode.add(t);
2526      return t;
2527    }
2528
2529    public Immunization addReasonCode(CodeableConcept t) { //3
2530      if (t == null)
2531        return this;
2532      if (this.reasonCode == null)
2533        this.reasonCode = new ArrayList<CodeableConcept>();
2534      this.reasonCode.add(t);
2535      return this;
2536    }
2537
2538    /**
2539     * @return The first repetition of repeating field {@link #reasonCode}, creating it if it does not already exist
2540     */
2541    public CodeableConcept getReasonCodeFirstRep() { 
2542      if (getReasonCode().isEmpty()) {
2543        addReasonCode();
2544      }
2545      return getReasonCode().get(0);
2546    }
2547
2548    /**
2549     * @return {@link #reasonReference} (Indicates another resource (Condition, Observation or DiagnosticReport) whose existence justifies this immunization.)
2550     */
2551    public List<Reference> getReasonReference() { 
2552      if (this.reasonReference == null)
2553        this.reasonReference = new ArrayList<Reference>();
2554      return this.reasonReference;
2555    }
2556
2557    /**
2558     * @return Returns a reference to <code>this</code> for easy method chaining
2559     */
2560    public Immunization setReasonReference(List<Reference> theReasonReference) { 
2561      this.reasonReference = theReasonReference;
2562      return this;
2563    }
2564
2565    public boolean hasReasonReference() { 
2566      if (this.reasonReference == null)
2567        return false;
2568      for (Reference item : this.reasonReference)
2569        if (!item.isEmpty())
2570          return true;
2571      return false;
2572    }
2573
2574    public Reference addReasonReference() { //3
2575      Reference t = new Reference();
2576      if (this.reasonReference == null)
2577        this.reasonReference = new ArrayList<Reference>();
2578      this.reasonReference.add(t);
2579      return t;
2580    }
2581
2582    public Immunization addReasonReference(Reference t) { //3
2583      if (t == null)
2584        return this;
2585      if (this.reasonReference == null)
2586        this.reasonReference = new ArrayList<Reference>();
2587      this.reasonReference.add(t);
2588      return this;
2589    }
2590
2591    /**
2592     * @return The first repetition of repeating field {@link #reasonReference}, creating it if it does not already exist
2593     */
2594    public Reference getReasonReferenceFirstRep() { 
2595      if (getReasonReference().isEmpty()) {
2596        addReasonReference();
2597      }
2598      return getReasonReference().get(0);
2599    }
2600
2601    /**
2602     * @return {@link #isSubpotent} (Indication if a dose is considered to be subpotent. By default, a dose should be considered to be potent.). This is the underlying object with id, value and extensions. The accessor "getIsSubpotent" gives direct access to the value
2603     */
2604    public BooleanType getIsSubpotentElement() { 
2605      if (this.isSubpotent == null)
2606        if (Configuration.errorOnAutoCreate())
2607          throw new Error("Attempt to auto-create Immunization.isSubpotent");
2608        else if (Configuration.doAutoCreate())
2609          this.isSubpotent = new BooleanType(); // bb
2610      return this.isSubpotent;
2611    }
2612
2613    public boolean hasIsSubpotentElement() { 
2614      return this.isSubpotent != null && !this.isSubpotent.isEmpty();
2615    }
2616
2617    public boolean hasIsSubpotent() { 
2618      return this.isSubpotent != null && !this.isSubpotent.isEmpty();
2619    }
2620
2621    /**
2622     * @param value {@link #isSubpotent} (Indication if a dose is considered to be subpotent. By default, a dose should be considered to be potent.). This is the underlying object with id, value and extensions. The accessor "getIsSubpotent" gives direct access to the value
2623     */
2624    public Immunization setIsSubpotentElement(BooleanType value) { 
2625      this.isSubpotent = value;
2626      return this;
2627    }
2628
2629    /**
2630     * @return Indication if a dose is considered to be subpotent. By default, a dose should be considered to be potent.
2631     */
2632    public boolean getIsSubpotent() { 
2633      return this.isSubpotent == null || this.isSubpotent.isEmpty() ? false : this.isSubpotent.getValue();
2634    }
2635
2636    /**
2637     * @param value Indication if a dose is considered to be subpotent. By default, a dose should be considered to be potent.
2638     */
2639    public Immunization setIsSubpotent(boolean value) { 
2640        if (this.isSubpotent == null)
2641          this.isSubpotent = new BooleanType();
2642        this.isSubpotent.setValue(value);
2643      return this;
2644    }
2645
2646    /**
2647     * @return {@link #subpotentReason} (Reason why a dose is considered to be subpotent.)
2648     */
2649    public List<CodeableConcept> getSubpotentReason() { 
2650      if (this.subpotentReason == null)
2651        this.subpotentReason = new ArrayList<CodeableConcept>();
2652      return this.subpotentReason;
2653    }
2654
2655    /**
2656     * @return Returns a reference to <code>this</code> for easy method chaining
2657     */
2658    public Immunization setSubpotentReason(List<CodeableConcept> theSubpotentReason) { 
2659      this.subpotentReason = theSubpotentReason;
2660      return this;
2661    }
2662
2663    public boolean hasSubpotentReason() { 
2664      if (this.subpotentReason == null)
2665        return false;
2666      for (CodeableConcept item : this.subpotentReason)
2667        if (!item.isEmpty())
2668          return true;
2669      return false;
2670    }
2671
2672    public CodeableConcept addSubpotentReason() { //3
2673      CodeableConcept t = new CodeableConcept();
2674      if (this.subpotentReason == null)
2675        this.subpotentReason = new ArrayList<CodeableConcept>();
2676      this.subpotentReason.add(t);
2677      return t;
2678    }
2679
2680    public Immunization addSubpotentReason(CodeableConcept t) { //3
2681      if (t == null)
2682        return this;
2683      if (this.subpotentReason == null)
2684        this.subpotentReason = new ArrayList<CodeableConcept>();
2685      this.subpotentReason.add(t);
2686      return this;
2687    }
2688
2689    /**
2690     * @return The first repetition of repeating field {@link #subpotentReason}, creating it if it does not already exist
2691     */
2692    public CodeableConcept getSubpotentReasonFirstRep() { 
2693      if (getSubpotentReason().isEmpty()) {
2694        addSubpotentReason();
2695      }
2696      return getSubpotentReason().get(0);
2697    }
2698
2699    /**
2700     * @return {@link #education} (Educational material presented to the patient (or guardian) at the time of vaccine administration.)
2701     */
2702    public List<ImmunizationEducationComponent> getEducation() { 
2703      if (this.education == null)
2704        this.education = new ArrayList<ImmunizationEducationComponent>();
2705      return this.education;
2706    }
2707
2708    /**
2709     * @return Returns a reference to <code>this</code> for easy method chaining
2710     */
2711    public Immunization setEducation(List<ImmunizationEducationComponent> theEducation) { 
2712      this.education = theEducation;
2713      return this;
2714    }
2715
2716    public boolean hasEducation() { 
2717      if (this.education == null)
2718        return false;
2719      for (ImmunizationEducationComponent item : this.education)
2720        if (!item.isEmpty())
2721          return true;
2722      return false;
2723    }
2724
2725    public ImmunizationEducationComponent addEducation() { //3
2726      ImmunizationEducationComponent t = new ImmunizationEducationComponent();
2727      if (this.education == null)
2728        this.education = new ArrayList<ImmunizationEducationComponent>();
2729      this.education.add(t);
2730      return t;
2731    }
2732
2733    public Immunization addEducation(ImmunizationEducationComponent t) { //3
2734      if (t == null)
2735        return this;
2736      if (this.education == null)
2737        this.education = new ArrayList<ImmunizationEducationComponent>();
2738      this.education.add(t);
2739      return this;
2740    }
2741
2742    /**
2743     * @return The first repetition of repeating field {@link #education}, creating it if it does not already exist
2744     */
2745    public ImmunizationEducationComponent getEducationFirstRep() { 
2746      if (getEducation().isEmpty()) {
2747        addEducation();
2748      }
2749      return getEducation().get(0);
2750    }
2751
2752    /**
2753     * @return {@link #programEligibility} (Indicates a patient's eligibility for a funding program.)
2754     */
2755    public List<CodeableConcept> getProgramEligibility() { 
2756      if (this.programEligibility == null)
2757        this.programEligibility = new ArrayList<CodeableConcept>();
2758      return this.programEligibility;
2759    }
2760
2761    /**
2762     * @return Returns a reference to <code>this</code> for easy method chaining
2763     */
2764    public Immunization setProgramEligibility(List<CodeableConcept> theProgramEligibility) { 
2765      this.programEligibility = theProgramEligibility;
2766      return this;
2767    }
2768
2769    public boolean hasProgramEligibility() { 
2770      if (this.programEligibility == null)
2771        return false;
2772      for (CodeableConcept item : this.programEligibility)
2773        if (!item.isEmpty())
2774          return true;
2775      return false;
2776    }
2777
2778    public CodeableConcept addProgramEligibility() { //3
2779      CodeableConcept t = new CodeableConcept();
2780      if (this.programEligibility == null)
2781        this.programEligibility = new ArrayList<CodeableConcept>();
2782      this.programEligibility.add(t);
2783      return t;
2784    }
2785
2786    public Immunization addProgramEligibility(CodeableConcept t) { //3
2787      if (t == null)
2788        return this;
2789      if (this.programEligibility == null)
2790        this.programEligibility = new ArrayList<CodeableConcept>();
2791      this.programEligibility.add(t);
2792      return this;
2793    }
2794
2795    /**
2796     * @return The first repetition of repeating field {@link #programEligibility}, creating it if it does not already exist
2797     */
2798    public CodeableConcept getProgramEligibilityFirstRep() { 
2799      if (getProgramEligibility().isEmpty()) {
2800        addProgramEligibility();
2801      }
2802      return getProgramEligibility().get(0);
2803    }
2804
2805    /**
2806     * @return {@link #fundingSource} (Indicates the source of the vaccine actually administered. This may be different than the patient eligibility (e.g. the patient may be eligible for a publically purchased vaccine but due to inventory issues, vaccine purchased with private funds was actually administered).)
2807     */
2808    public CodeableConcept getFundingSource() { 
2809      if (this.fundingSource == null)
2810        if (Configuration.errorOnAutoCreate())
2811          throw new Error("Attempt to auto-create Immunization.fundingSource");
2812        else if (Configuration.doAutoCreate())
2813          this.fundingSource = new CodeableConcept(); // cc
2814      return this.fundingSource;
2815    }
2816
2817    public boolean hasFundingSource() { 
2818      return this.fundingSource != null && !this.fundingSource.isEmpty();
2819    }
2820
2821    /**
2822     * @param value {@link #fundingSource} (Indicates the source of the vaccine actually administered. This may be different than the patient eligibility (e.g. the patient may be eligible for a publically purchased vaccine but due to inventory issues, vaccine purchased with private funds was actually administered).)
2823     */
2824    public Immunization setFundingSource(CodeableConcept value) { 
2825      this.fundingSource = value;
2826      return this;
2827    }
2828
2829    /**
2830     * @return {@link #reaction} (Categorical data indicating that an adverse event is associated in time to an immunization.)
2831     */
2832    public List<ImmunizationReactionComponent> getReaction() { 
2833      if (this.reaction == null)
2834        this.reaction = new ArrayList<ImmunizationReactionComponent>();
2835      return this.reaction;
2836    }
2837
2838    /**
2839     * @return Returns a reference to <code>this</code> for easy method chaining
2840     */
2841    public Immunization setReaction(List<ImmunizationReactionComponent> theReaction) { 
2842      this.reaction = theReaction;
2843      return this;
2844    }
2845
2846    public boolean hasReaction() { 
2847      if (this.reaction == null)
2848        return false;
2849      for (ImmunizationReactionComponent item : this.reaction)
2850        if (!item.isEmpty())
2851          return true;
2852      return false;
2853    }
2854
2855    public ImmunizationReactionComponent addReaction() { //3
2856      ImmunizationReactionComponent t = new ImmunizationReactionComponent();
2857      if (this.reaction == null)
2858        this.reaction = new ArrayList<ImmunizationReactionComponent>();
2859      this.reaction.add(t);
2860      return t;
2861    }
2862
2863    public Immunization addReaction(ImmunizationReactionComponent t) { //3
2864      if (t == null)
2865        return this;
2866      if (this.reaction == null)
2867        this.reaction = new ArrayList<ImmunizationReactionComponent>();
2868      this.reaction.add(t);
2869      return this;
2870    }
2871
2872    /**
2873     * @return The first repetition of repeating field {@link #reaction}, creating it if it does not already exist
2874     */
2875    public ImmunizationReactionComponent getReactionFirstRep() { 
2876      if (getReaction().isEmpty()) {
2877        addReaction();
2878      }
2879      return getReaction().get(0);
2880    }
2881
2882    /**
2883     * @return {@link #protocolApplied} (The protocol (set of recommendations) being followed by the provider who administered the dose.)
2884     */
2885    public List<ImmunizationProtocolAppliedComponent> getProtocolApplied() { 
2886      if (this.protocolApplied == null)
2887        this.protocolApplied = new ArrayList<ImmunizationProtocolAppliedComponent>();
2888      return this.protocolApplied;
2889    }
2890
2891    /**
2892     * @return Returns a reference to <code>this</code> for easy method chaining
2893     */
2894    public Immunization setProtocolApplied(List<ImmunizationProtocolAppliedComponent> theProtocolApplied) { 
2895      this.protocolApplied = theProtocolApplied;
2896      return this;
2897    }
2898
2899    public boolean hasProtocolApplied() { 
2900      if (this.protocolApplied == null)
2901        return false;
2902      for (ImmunizationProtocolAppliedComponent item : this.protocolApplied)
2903        if (!item.isEmpty())
2904          return true;
2905      return false;
2906    }
2907
2908    public ImmunizationProtocolAppliedComponent addProtocolApplied() { //3
2909      ImmunizationProtocolAppliedComponent t = new ImmunizationProtocolAppliedComponent();
2910      if (this.protocolApplied == null)
2911        this.protocolApplied = new ArrayList<ImmunizationProtocolAppliedComponent>();
2912      this.protocolApplied.add(t);
2913      return t;
2914    }
2915
2916    public Immunization addProtocolApplied(ImmunizationProtocolAppliedComponent t) { //3
2917      if (t == null)
2918        return this;
2919      if (this.protocolApplied == null)
2920        this.protocolApplied = new ArrayList<ImmunizationProtocolAppliedComponent>();
2921      this.protocolApplied.add(t);
2922      return this;
2923    }
2924
2925    /**
2926     * @return The first repetition of repeating field {@link #protocolApplied}, creating it if it does not already exist
2927     */
2928    public ImmunizationProtocolAppliedComponent getProtocolAppliedFirstRep() { 
2929      if (getProtocolApplied().isEmpty()) {
2930        addProtocolApplied();
2931      }
2932      return getProtocolApplied().get(0);
2933    }
2934
2935      protected void listChildren(List<Property> children) {
2936        super.listChildren(children);
2937        children.add(new Property("identifier", "Identifier", "A unique identifier assigned to this immunization record.", 0, java.lang.Integer.MAX_VALUE, identifier));
2938        children.add(new Property("status", "code", "Indicates the current status of the immunization event.", 0, 1, status));
2939        children.add(new Property("statusReason", "CodeableConcept", "Indicates the reason the immunization event was not performed.", 0, 1, statusReason));
2940        children.add(new Property("vaccineCode", "CodeableConcept", "Vaccine that was administered or was to be administered.", 0, 1, vaccineCode));
2941        children.add(new Property("patient", "Reference(Patient)", "The patient who either received or did not receive the immunization.", 0, 1, patient));
2942        children.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, 1, encounter));
2943        children.add(new Property("occurrence[x]", "dateTime|string", "Date vaccine administered or was to be administered.", 0, 1, occurrence));
2944        children.add(new Property("recorded", "dateTime", "The date the occurrence of the immunization was first captured in the record - potentially significantly after the occurrence of the event.", 0, 1, recorded));
2945        children.add(new Property("primarySource", "boolean", "Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record.", 0, 1, primarySource));
2946        children.add(new Property("informationSource[x]", "CodeableConcept|Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "Typically 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, 1, informationSource));
2947        children.add(new Property("location", "Reference(Location)", "The service delivery location where the vaccine administration occurred.", 0, 1, location));
2948        children.add(new Property("manufacturer", "Reference(Organization)", "Name of vaccine manufacturer.", 0, 1, manufacturer));
2949        children.add(new Property("lotNumber", "string", "Lot number of the  vaccine product.", 0, 1, lotNumber));
2950        children.add(new Property("expirationDate", "date", "Date vaccine batch expires.", 0, 1, expirationDate));
2951        children.add(new Property("site", "CodeableConcept", "Body site where vaccine was administered.", 0, 1, site));
2952        children.add(new Property("route", "CodeableConcept", "The path by which the vaccine product is taken into the body.", 0, 1, route));
2953        children.add(new Property("doseQuantity", "SimpleQuantity", "The quantity of vaccine product that was administered.", 0, 1, doseQuantity));
2954        children.add(new Property("performer", "", "Indicates who performed the immunization event.", 0, java.lang.Integer.MAX_VALUE, performer));
2955        children.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));
2956        children.add(new Property("reasonCode", "CodeableConcept", "Describes why the immunization occurred in coded or textual form.", 0, java.lang.Integer.MAX_VALUE, reasonCode));
2957        children.add(new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport)", "Indicates another resource (Condition, Observation or DiagnosticReport) whose existence justifies this immunization.", 0, java.lang.Integer.MAX_VALUE, reasonReference));
2958        children.add(new Property("isSubpotent", "boolean", "Indication if a dose is considered to be subpotent. By default, a dose should be considered to be potent.", 0, 1, isSubpotent));
2959        children.add(new Property("subpotentReason", "CodeableConcept", "Reason why a dose is considered to be subpotent.", 0, java.lang.Integer.MAX_VALUE, subpotentReason));
2960        children.add(new Property("education", "", "Educational material presented to the patient (or guardian) at the time of vaccine administration.", 0, java.lang.Integer.MAX_VALUE, education));
2961        children.add(new Property("programEligibility", "CodeableConcept", "Indicates a patient's eligibility for a funding program.", 0, java.lang.Integer.MAX_VALUE, programEligibility));
2962        children.add(new Property("fundingSource", "CodeableConcept", "Indicates the source of the vaccine actually administered. This may be different than the patient eligibility (e.g. the patient may be eligible for a publically purchased vaccine but due to inventory issues, vaccine purchased with private funds was actually administered).", 0, 1, fundingSource));
2963        children.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));
2964        children.add(new Property("protocolApplied", "", "The protocol (set of recommendations) being followed by the provider who administered the dose.", 0, java.lang.Integer.MAX_VALUE, protocolApplied));
2965      }
2966
2967      @Override
2968      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2969        switch (_hash) {
2970        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A unique identifier assigned to this immunization record.", 0, java.lang.Integer.MAX_VALUE, identifier);
2971        case -892481550: /*status*/  return new Property("status", "code", "Indicates the current status of the immunization event.", 0, 1, status);
2972        case 2051346646: /*statusReason*/  return new Property("statusReason", "CodeableConcept", "Indicates the reason the immunization event was not performed.", 0, 1, statusReason);
2973        case 664556354: /*vaccineCode*/  return new Property("vaccineCode", "CodeableConcept", "Vaccine that was administered or was to be administered.", 0, 1, vaccineCode);
2974        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "The patient who either received or did not receive the immunization.", 0, 1, patient);
2975        case 1524132147: /*encounter*/  return 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, 1, encounter);
2976        case -2022646513: /*occurrence[x]*/  return new Property("occurrence[x]", "dateTime|string", "Date vaccine administered or was to be administered.", 0, 1, occurrence);
2977        case 1687874001: /*occurrence*/  return new Property("occurrence[x]", "dateTime|string", "Date vaccine administered or was to be administered.", 0, 1, occurrence);
2978        case -298443636: /*occurrenceDateTime*/  return new Property("occurrence[x]", "dateTime|string", "Date vaccine administered or was to be administered.", 0, 1, occurrence);
2979        case 1496896834: /*occurrenceString*/  return new Property("occurrence[x]", "dateTime|string", "Date vaccine administered or was to be administered.", 0, 1, occurrence);
2980        case -799233872: /*recorded*/  return new Property("recorded", "dateTime", "The date the occurrence of the immunization was first captured in the record - potentially significantly after the occurrence of the event.", 0, 1, recorded);
2981        case -528721731: /*primarySource*/  return new Property("primarySource", "boolean", "Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record.", 0, 1, primarySource);
2982        case -890044743: /*informationSource[x]*/  return new Property("informationSource[x]", "CodeableConcept|Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "Typically 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, 1, informationSource);
2983        case -2123220889: /*informationSource*/  return new Property("informationSource[x]", "CodeableConcept|Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "Typically 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, 1, informationSource);
2984        case -1849314246: /*informationSourceCodeableConcept*/  return new Property("informationSource[x]", "CodeableConcept|Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "Typically 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, 1, informationSource);
2985        case -1721324892: /*informationSourceReference*/  return new Property("informationSource[x]", "CodeableConcept|Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "Typically 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, 1, informationSource);
2986        case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "The service delivery location where the vaccine administration occurred.", 0, 1, location);
2987        case -1969347631: /*manufacturer*/  return new Property("manufacturer", "Reference(Organization)", "Name of vaccine manufacturer.", 0, 1, manufacturer);
2988        case 462547450: /*lotNumber*/  return new Property("lotNumber", "string", "Lot number of the  vaccine product.", 0, 1, lotNumber);
2989        case -668811523: /*expirationDate*/  return new Property("expirationDate", "date", "Date vaccine batch expires.", 0, 1, expirationDate);
2990        case 3530567: /*site*/  return new Property("site", "CodeableConcept", "Body site where vaccine was administered.", 0, 1, site);
2991        case 108704329: /*route*/  return new Property("route", "CodeableConcept", "The path by which the vaccine product is taken into the body.", 0, 1, route);
2992        case -2083618872: /*doseQuantity*/  return new Property("doseQuantity", "SimpleQuantity", "The quantity of vaccine product that was administered.", 0, 1, doseQuantity);
2993        case 481140686: /*performer*/  return new Property("performer", "", "Indicates who performed the immunization event.", 0, java.lang.Integer.MAX_VALUE, performer);
2994        case 3387378: /*note*/  return new Property("note", "Annotation", "Extra information about the immunization that is not conveyed by the other attributes.", 0, java.lang.Integer.MAX_VALUE, note);
2995        case 722137681: /*reasonCode*/  return new Property("reasonCode", "CodeableConcept", "Describes why the immunization occurred in coded or textual form.", 0, java.lang.Integer.MAX_VALUE, reasonCode);
2996        case -1146218137: /*reasonReference*/  return new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport)", "Indicates another resource (Condition, Observation or DiagnosticReport) whose existence justifies this immunization.", 0, java.lang.Integer.MAX_VALUE, reasonReference);
2997        case 1618512556: /*isSubpotent*/  return new Property("isSubpotent", "boolean", "Indication if a dose is considered to be subpotent. By default, a dose should be considered to be potent.", 0, 1, isSubpotent);
2998        case 805168794: /*subpotentReason*/  return new Property("subpotentReason", "CodeableConcept", "Reason why a dose is considered to be subpotent.", 0, java.lang.Integer.MAX_VALUE, subpotentReason);
2999        case -290756696: /*education*/  return new Property("education", "", "Educational material presented to the patient (or guardian) at the time of vaccine administration.", 0, java.lang.Integer.MAX_VALUE, education);
3000        case 1207530089: /*programEligibility*/  return new Property("programEligibility", "CodeableConcept", "Indicates a patient's eligibility for a funding program.", 0, java.lang.Integer.MAX_VALUE, programEligibility);
3001        case 1120150904: /*fundingSource*/  return new Property("fundingSource", "CodeableConcept", "Indicates the source of the vaccine actually administered. This may be different than the patient eligibility (e.g. the patient may be eligible for a publically purchased vaccine but due to inventory issues, vaccine purchased with private funds was actually administered).", 0, 1, fundingSource);
3002        case -867509719: /*reaction*/  return new Property("reaction", "", "Categorical data indicating that an adverse event is associated in time to an immunization.", 0, java.lang.Integer.MAX_VALUE, reaction);
3003        case 607985349: /*protocolApplied*/  return new Property("protocolApplied", "", "The protocol (set of recommendations) being followed by the provider who administered the dose.", 0, java.lang.Integer.MAX_VALUE, protocolApplied);
3004        default: return super.getNamedProperty(_hash, _name, _checkValid);
3005        }
3006
3007      }
3008
3009      @Override
3010      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3011        switch (hash) {
3012        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3013        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ImmunizationStatus>
3014        case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : new Base[] {this.statusReason}; // CodeableConcept
3015        case 664556354: /*vaccineCode*/ return this.vaccineCode == null ? new Base[0] : new Base[] {this.vaccineCode}; // CodeableConcept
3016        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
3017        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
3018        case 1687874001: /*occurrence*/ return this.occurrence == null ? new Base[0] : new Base[] {this.occurrence}; // Type
3019        case -799233872: /*recorded*/ return this.recorded == null ? new Base[0] : new Base[] {this.recorded}; // DateTimeType
3020        case -528721731: /*primarySource*/ return this.primarySource == null ? new Base[0] : new Base[] {this.primarySource}; // BooleanType
3021        case -2123220889: /*informationSource*/ return this.informationSource == null ? new Base[0] : new Base[] {this.informationSource}; // Type
3022        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
3023        case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : new Base[] {this.manufacturer}; // Reference
3024        case 462547450: /*lotNumber*/ return this.lotNumber == null ? new Base[0] : new Base[] {this.lotNumber}; // StringType
3025        case -668811523: /*expirationDate*/ return this.expirationDate == null ? new Base[0] : new Base[] {this.expirationDate}; // DateType
3026        case 3530567: /*site*/ return this.site == null ? new Base[0] : new Base[] {this.site}; // CodeableConcept
3027        case 108704329: /*route*/ return this.route == null ? new Base[0] : new Base[] {this.route}; // CodeableConcept
3028        case -2083618872: /*doseQuantity*/ return this.doseQuantity == null ? new Base[0] : new Base[] {this.doseQuantity}; // Quantity
3029        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : this.performer.toArray(new Base[this.performer.size()]); // ImmunizationPerformerComponent
3030        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
3031        case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
3032        case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
3033        case 1618512556: /*isSubpotent*/ return this.isSubpotent == null ? new Base[0] : new Base[] {this.isSubpotent}; // BooleanType
3034        case 805168794: /*subpotentReason*/ return this.subpotentReason == null ? new Base[0] : this.subpotentReason.toArray(new Base[this.subpotentReason.size()]); // CodeableConcept
3035        case -290756696: /*education*/ return this.education == null ? new Base[0] : this.education.toArray(new Base[this.education.size()]); // ImmunizationEducationComponent
3036        case 1207530089: /*programEligibility*/ return this.programEligibility == null ? new Base[0] : this.programEligibility.toArray(new Base[this.programEligibility.size()]); // CodeableConcept
3037        case 1120150904: /*fundingSource*/ return this.fundingSource == null ? new Base[0] : new Base[] {this.fundingSource}; // CodeableConcept
3038        case -867509719: /*reaction*/ return this.reaction == null ? new Base[0] : this.reaction.toArray(new Base[this.reaction.size()]); // ImmunizationReactionComponent
3039        case 607985349: /*protocolApplied*/ return this.protocolApplied == null ? new Base[0] : this.protocolApplied.toArray(new Base[this.protocolApplied.size()]); // ImmunizationProtocolAppliedComponent
3040        default: return super.getProperty(hash, name, checkValid);
3041        }
3042
3043      }
3044
3045      @Override
3046      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3047        switch (hash) {
3048        case -1618432855: // identifier
3049          this.getIdentifier().add(castToIdentifier(value)); // Identifier
3050          return value;
3051        case -892481550: // status
3052          value = new ImmunizationStatusEnumFactory().fromType(castToCode(value));
3053          this.status = (Enumeration) value; // Enumeration<ImmunizationStatus>
3054          return value;
3055        case 2051346646: // statusReason
3056          this.statusReason = castToCodeableConcept(value); // CodeableConcept
3057          return value;
3058        case 664556354: // vaccineCode
3059          this.vaccineCode = castToCodeableConcept(value); // CodeableConcept
3060          return value;
3061        case -791418107: // patient
3062          this.patient = castToReference(value); // Reference
3063          return value;
3064        case 1524132147: // encounter
3065          this.encounter = castToReference(value); // Reference
3066          return value;
3067        case 1687874001: // occurrence
3068          this.occurrence = castToType(value); // Type
3069          return value;
3070        case -799233872: // recorded
3071          this.recorded = castToDateTime(value); // DateTimeType
3072          return value;
3073        case -528721731: // primarySource
3074          this.primarySource = castToBoolean(value); // BooleanType
3075          return value;
3076        case -2123220889: // informationSource
3077          this.informationSource = castToType(value); // Type
3078          return value;
3079        case 1901043637: // location
3080          this.location = castToReference(value); // Reference
3081          return value;
3082        case -1969347631: // manufacturer
3083          this.manufacturer = castToReference(value); // Reference
3084          return value;
3085        case 462547450: // lotNumber
3086          this.lotNumber = castToString(value); // StringType
3087          return value;
3088        case -668811523: // expirationDate
3089          this.expirationDate = castToDate(value); // DateType
3090          return value;
3091        case 3530567: // site
3092          this.site = castToCodeableConcept(value); // CodeableConcept
3093          return value;
3094        case 108704329: // route
3095          this.route = castToCodeableConcept(value); // CodeableConcept
3096          return value;
3097        case -2083618872: // doseQuantity
3098          this.doseQuantity = castToQuantity(value); // Quantity
3099          return value;
3100        case 481140686: // performer
3101          this.getPerformer().add((ImmunizationPerformerComponent) value); // ImmunizationPerformerComponent
3102          return value;
3103        case 3387378: // note
3104          this.getNote().add(castToAnnotation(value)); // Annotation
3105          return value;
3106        case 722137681: // reasonCode
3107          this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
3108          return value;
3109        case -1146218137: // reasonReference
3110          this.getReasonReference().add(castToReference(value)); // Reference
3111          return value;
3112        case 1618512556: // isSubpotent
3113          this.isSubpotent = castToBoolean(value); // BooleanType
3114          return value;
3115        case 805168794: // subpotentReason
3116          this.getSubpotentReason().add(castToCodeableConcept(value)); // CodeableConcept
3117          return value;
3118        case -290756696: // education
3119          this.getEducation().add((ImmunizationEducationComponent) value); // ImmunizationEducationComponent
3120          return value;
3121        case 1207530089: // programEligibility
3122          this.getProgramEligibility().add(castToCodeableConcept(value)); // CodeableConcept
3123          return value;
3124        case 1120150904: // fundingSource
3125          this.fundingSource = castToCodeableConcept(value); // CodeableConcept
3126          return value;
3127        case -867509719: // reaction
3128          this.getReaction().add((ImmunizationReactionComponent) value); // ImmunizationReactionComponent
3129          return value;
3130        case 607985349: // protocolApplied
3131          this.getProtocolApplied().add((ImmunizationProtocolAppliedComponent) value); // ImmunizationProtocolAppliedComponent
3132          return value;
3133        default: return super.setProperty(hash, name, value);
3134        }
3135
3136      }
3137
3138      @Override
3139      public Base setProperty(String name, Base value) throws FHIRException {
3140        if (name.equals("identifier")) {
3141          this.getIdentifier().add(castToIdentifier(value));
3142        } else if (name.equals("status")) {
3143          value = new ImmunizationStatusEnumFactory().fromType(castToCode(value));
3144          this.status = (Enumeration) value; // Enumeration<ImmunizationStatus>
3145        } else if (name.equals("statusReason")) {
3146          this.statusReason = castToCodeableConcept(value); // CodeableConcept
3147        } else if (name.equals("vaccineCode")) {
3148          this.vaccineCode = castToCodeableConcept(value); // CodeableConcept
3149        } else if (name.equals("patient")) {
3150          this.patient = castToReference(value); // Reference
3151        } else if (name.equals("encounter")) {
3152          this.encounter = castToReference(value); // Reference
3153        } else if (name.equals("occurrence[x]")) {
3154          this.occurrence = castToType(value); // Type
3155        } else if (name.equals("recorded")) {
3156          this.recorded = castToDateTime(value); // DateTimeType
3157        } else if (name.equals("primarySource")) {
3158          this.primarySource = castToBoolean(value); // BooleanType
3159        } else if (name.equals("informationSource[x]")) {
3160          this.informationSource = castToType(value); // Type
3161        } else if (name.equals("location")) {
3162          this.location = castToReference(value); // Reference
3163        } else if (name.equals("manufacturer")) {
3164          this.manufacturer = castToReference(value); // Reference
3165        } else if (name.equals("lotNumber")) {
3166          this.lotNumber = castToString(value); // StringType
3167        } else if (name.equals("expirationDate")) {
3168          this.expirationDate = castToDate(value); // DateType
3169        } else if (name.equals("site")) {
3170          this.site = castToCodeableConcept(value); // CodeableConcept
3171        } else if (name.equals("route")) {
3172          this.route = castToCodeableConcept(value); // CodeableConcept
3173        } else if (name.equals("doseQuantity")) {
3174          this.doseQuantity = castToQuantity(value); // Quantity
3175        } else if (name.equals("performer")) {
3176          this.getPerformer().add((ImmunizationPerformerComponent) value);
3177        } else if (name.equals("note")) {
3178          this.getNote().add(castToAnnotation(value));
3179        } else if (name.equals("reasonCode")) {
3180          this.getReasonCode().add(castToCodeableConcept(value));
3181        } else if (name.equals("reasonReference")) {
3182          this.getReasonReference().add(castToReference(value));
3183        } else if (name.equals("isSubpotent")) {
3184          this.isSubpotent = castToBoolean(value); // BooleanType
3185        } else if (name.equals("subpotentReason")) {
3186          this.getSubpotentReason().add(castToCodeableConcept(value));
3187        } else if (name.equals("education")) {
3188          this.getEducation().add((ImmunizationEducationComponent) value);
3189        } else if (name.equals("programEligibility")) {
3190          this.getProgramEligibility().add(castToCodeableConcept(value));
3191        } else if (name.equals("fundingSource")) {
3192          this.fundingSource = castToCodeableConcept(value); // CodeableConcept
3193        } else if (name.equals("reaction")) {
3194          this.getReaction().add((ImmunizationReactionComponent) value);
3195        } else if (name.equals("protocolApplied")) {
3196          this.getProtocolApplied().add((ImmunizationProtocolAppliedComponent) value);
3197        } else
3198          return super.setProperty(name, value);
3199        return value;
3200      }
3201
3202      @Override
3203      public Base makeProperty(int hash, String name) throws FHIRException {
3204        switch (hash) {
3205        case -1618432855:  return addIdentifier(); 
3206        case -892481550:  return getStatusElement();
3207        case 2051346646:  return getStatusReason();
3208        case 664556354:  return getVaccineCode();
3209        case -791418107:  return getPatient();
3210        case 1524132147:  return getEncounter();
3211        case -2022646513:  return getOccurrence();
3212        case 1687874001:  return getOccurrence();
3213        case -799233872:  return getRecordedElement();
3214        case -528721731:  return getPrimarySourceElement();
3215        case -890044743:  return getInformationSource();
3216        case -2123220889:  return getInformationSource();
3217        case 1901043637:  return getLocation();
3218        case -1969347631:  return getManufacturer();
3219        case 462547450:  return getLotNumberElement();
3220        case -668811523:  return getExpirationDateElement();
3221        case 3530567:  return getSite();
3222        case 108704329:  return getRoute();
3223        case -2083618872:  return getDoseQuantity();
3224        case 481140686:  return addPerformer(); 
3225        case 3387378:  return addNote(); 
3226        case 722137681:  return addReasonCode(); 
3227        case -1146218137:  return addReasonReference(); 
3228        case 1618512556:  return getIsSubpotentElement();
3229        case 805168794:  return addSubpotentReason(); 
3230        case -290756696:  return addEducation(); 
3231        case 1207530089:  return addProgramEligibility(); 
3232        case 1120150904:  return getFundingSource();
3233        case -867509719:  return addReaction(); 
3234        case 607985349:  return addProtocolApplied(); 
3235        default: return super.makeProperty(hash, name);
3236        }
3237
3238      }
3239
3240      @Override
3241      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3242        switch (hash) {
3243        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3244        case -892481550: /*status*/ return new String[] {"code"};
3245        case 2051346646: /*statusReason*/ return new String[] {"CodeableConcept"};
3246        case 664556354: /*vaccineCode*/ return new String[] {"CodeableConcept"};
3247        case -791418107: /*patient*/ return new String[] {"Reference"};
3248        case 1524132147: /*encounter*/ return new String[] {"Reference"};
3249        case 1687874001: /*occurrence*/ return new String[] {"dateTime", "string"};
3250        case -799233872: /*recorded*/ return new String[] {"dateTime"};
3251        case -528721731: /*primarySource*/ return new String[] {"boolean"};
3252        case -2123220889: /*informationSource*/ return new String[] {"CodeableConcept", "Reference"};
3253        case 1901043637: /*location*/ return new String[] {"Reference"};
3254        case -1969347631: /*manufacturer*/ return new String[] {"Reference"};
3255        case 462547450: /*lotNumber*/ return new String[] {"string"};
3256        case -668811523: /*expirationDate*/ return new String[] {"date"};
3257        case 3530567: /*site*/ return new String[] {"CodeableConcept"};
3258        case 108704329: /*route*/ return new String[] {"CodeableConcept"};
3259        case -2083618872: /*doseQuantity*/ return new String[] {"SimpleQuantity"};
3260        case 481140686: /*performer*/ return new String[] {};
3261        case 3387378: /*note*/ return new String[] {"Annotation"};
3262        case 722137681: /*reasonCode*/ return new String[] {"CodeableConcept"};
3263        case -1146218137: /*reasonReference*/ return new String[] {"Reference"};
3264        case 1618512556: /*isSubpotent*/ return new String[] {"boolean"};
3265        case 805168794: /*subpotentReason*/ return new String[] {"CodeableConcept"};
3266        case -290756696: /*education*/ return new String[] {};
3267        case 1207530089: /*programEligibility*/ return new String[] {"CodeableConcept"};
3268        case 1120150904: /*fundingSource*/ return new String[] {"CodeableConcept"};
3269        case -867509719: /*reaction*/ return new String[] {};
3270        case 607985349: /*protocolApplied*/ return new String[] {};
3271        default: return super.getTypesForProperty(hash, name);
3272        }
3273
3274      }
3275
3276      @Override
3277      public Base addChild(String name) throws FHIRException {
3278        if (name.equals("identifier")) {
3279          return addIdentifier();
3280        }
3281        else if (name.equals("status")) {
3282          throw new FHIRException("Cannot call addChild on a primitive type Immunization.status");
3283        }
3284        else if (name.equals("statusReason")) {
3285          this.statusReason = new CodeableConcept();
3286          return this.statusReason;
3287        }
3288        else if (name.equals("vaccineCode")) {
3289          this.vaccineCode = new CodeableConcept();
3290          return this.vaccineCode;
3291        }
3292        else if (name.equals("patient")) {
3293          this.patient = new Reference();
3294          return this.patient;
3295        }
3296        else if (name.equals("encounter")) {
3297          this.encounter = new Reference();
3298          return this.encounter;
3299        }
3300        else if (name.equals("occurrenceDateTime")) {
3301          this.occurrence = new DateTimeType();
3302          return this.occurrence;
3303        }
3304        else if (name.equals("occurrenceString")) {
3305          this.occurrence = new StringType();
3306          return this.occurrence;
3307        }
3308        else if (name.equals("recorded")) {
3309          throw new FHIRException("Cannot call addChild on a primitive type Immunization.recorded");
3310        }
3311        else if (name.equals("primarySource")) {
3312          throw new FHIRException("Cannot call addChild on a primitive type Immunization.primarySource");
3313        }
3314        else if (name.equals("informationSourceCodeableConcept")) {
3315          this.informationSource = new CodeableConcept();
3316          return this.informationSource;
3317        }
3318        else if (name.equals("informationSourceReference")) {
3319          this.informationSource = new Reference();
3320          return this.informationSource;
3321        }
3322        else if (name.equals("location")) {
3323          this.location = new Reference();
3324          return this.location;
3325        }
3326        else if (name.equals("manufacturer")) {
3327          this.manufacturer = new Reference();
3328          return this.manufacturer;
3329        }
3330        else if (name.equals("lotNumber")) {
3331          throw new FHIRException("Cannot call addChild on a primitive type Immunization.lotNumber");
3332        }
3333        else if (name.equals("expirationDate")) {
3334          throw new FHIRException("Cannot call addChild on a primitive type Immunization.expirationDate");
3335        }
3336        else if (name.equals("site")) {
3337          this.site = new CodeableConcept();
3338          return this.site;
3339        }
3340        else if (name.equals("route")) {
3341          this.route = new CodeableConcept();
3342          return this.route;
3343        }
3344        else if (name.equals("doseQuantity")) {
3345          this.doseQuantity = new Quantity();
3346          return this.doseQuantity;
3347        }
3348        else if (name.equals("performer")) {
3349          return addPerformer();
3350        }
3351        else if (name.equals("note")) {
3352          return addNote();
3353        }
3354        else if (name.equals("reasonCode")) {
3355          return addReasonCode();
3356        }
3357        else if (name.equals("reasonReference")) {
3358          return addReasonReference();
3359        }
3360        else if (name.equals("isSubpotent")) {
3361          throw new FHIRException("Cannot call addChild on a primitive type Immunization.isSubpotent");
3362        }
3363        else if (name.equals("subpotentReason")) {
3364          return addSubpotentReason();
3365        }
3366        else if (name.equals("education")) {
3367          return addEducation();
3368        }
3369        else if (name.equals("programEligibility")) {
3370          return addProgramEligibility();
3371        }
3372        else if (name.equals("fundingSource")) {
3373          this.fundingSource = new CodeableConcept();
3374          return this.fundingSource;
3375        }
3376        else if (name.equals("reaction")) {
3377          return addReaction();
3378        }
3379        else if (name.equals("protocolApplied")) {
3380          return addProtocolApplied();
3381        }
3382        else
3383          return super.addChild(name);
3384      }
3385
3386  public String fhirType() {
3387    return "Immunization";
3388
3389  }
3390
3391      public Immunization copy() {
3392        Immunization dst = new Immunization();
3393        copyValues(dst);
3394        return dst;
3395      }
3396
3397      public void copyValues(Immunization dst) {
3398        super.copyValues(dst);
3399        if (identifier != null) {
3400          dst.identifier = new ArrayList<Identifier>();
3401          for (Identifier i : identifier)
3402            dst.identifier.add(i.copy());
3403        };
3404        dst.status = status == null ? null : status.copy();
3405        dst.statusReason = statusReason == null ? null : statusReason.copy();
3406        dst.vaccineCode = vaccineCode == null ? null : vaccineCode.copy();
3407        dst.patient = patient == null ? null : patient.copy();
3408        dst.encounter = encounter == null ? null : encounter.copy();
3409        dst.occurrence = occurrence == null ? null : occurrence.copy();
3410        dst.recorded = recorded == null ? null : recorded.copy();
3411        dst.primarySource = primarySource == null ? null : primarySource.copy();
3412        dst.informationSource = informationSource == null ? null : informationSource.copy();
3413        dst.location = location == null ? null : location.copy();
3414        dst.manufacturer = manufacturer == null ? null : manufacturer.copy();
3415        dst.lotNumber = lotNumber == null ? null : lotNumber.copy();
3416        dst.expirationDate = expirationDate == null ? null : expirationDate.copy();
3417        dst.site = site == null ? null : site.copy();
3418        dst.route = route == null ? null : route.copy();
3419        dst.doseQuantity = doseQuantity == null ? null : doseQuantity.copy();
3420        if (performer != null) {
3421          dst.performer = new ArrayList<ImmunizationPerformerComponent>();
3422          for (ImmunizationPerformerComponent i : performer)
3423            dst.performer.add(i.copy());
3424        };
3425        if (note != null) {
3426          dst.note = new ArrayList<Annotation>();
3427          for (Annotation i : note)
3428            dst.note.add(i.copy());
3429        };
3430        if (reasonCode != null) {
3431          dst.reasonCode = new ArrayList<CodeableConcept>();
3432          for (CodeableConcept i : reasonCode)
3433            dst.reasonCode.add(i.copy());
3434        };
3435        if (reasonReference != null) {
3436          dst.reasonReference = new ArrayList<Reference>();
3437          for (Reference i : reasonReference)
3438            dst.reasonReference.add(i.copy());
3439        };
3440        dst.isSubpotent = isSubpotent == null ? null : isSubpotent.copy();
3441        if (subpotentReason != null) {
3442          dst.subpotentReason = new ArrayList<CodeableConcept>();
3443          for (CodeableConcept i : subpotentReason)
3444            dst.subpotentReason.add(i.copy());
3445        };
3446        if (education != null) {
3447          dst.education = new ArrayList<ImmunizationEducationComponent>();
3448          for (ImmunizationEducationComponent i : education)
3449            dst.education.add(i.copy());
3450        };
3451        if (programEligibility != null) {
3452          dst.programEligibility = new ArrayList<CodeableConcept>();
3453          for (CodeableConcept i : programEligibility)
3454            dst.programEligibility.add(i.copy());
3455        };
3456        dst.fundingSource = fundingSource == null ? null : fundingSource.copy();
3457        if (reaction != null) {
3458          dst.reaction = new ArrayList<ImmunizationReactionComponent>();
3459          for (ImmunizationReactionComponent i : reaction)
3460            dst.reaction.add(i.copy());
3461        };
3462        if (protocolApplied != null) {
3463          dst.protocolApplied = new ArrayList<ImmunizationProtocolAppliedComponent>();
3464          for (ImmunizationProtocolAppliedComponent i : protocolApplied)
3465            dst.protocolApplied.add(i.copy());
3466        };
3467      }
3468
3469      protected Immunization typedCopy() {
3470        return copy();
3471      }
3472
3473      @Override
3474      public boolean equalsDeep(Base other_) {
3475        if (!super.equalsDeep(other_))
3476          return false;
3477        if (!(other_ instanceof Immunization))
3478          return false;
3479        Immunization o = (Immunization) other_;
3480        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(statusReason, o.statusReason, true)
3481           && compareDeep(vaccineCode, o.vaccineCode, true) && compareDeep(patient, o.patient, true) && compareDeep(encounter, o.encounter, true)
3482           && compareDeep(occurrence, o.occurrence, true) && compareDeep(recorded, o.recorded, true) && compareDeep(primarySource, o.primarySource, true)
3483           && compareDeep(informationSource, o.informationSource, true) && compareDeep(location, o.location, true)
3484           && compareDeep(manufacturer, o.manufacturer, true) && compareDeep(lotNumber, o.lotNumber, true)
3485           && compareDeep(expirationDate, o.expirationDate, true) && compareDeep(site, o.site, true) && compareDeep(route, o.route, true)
3486           && compareDeep(doseQuantity, o.doseQuantity, true) && compareDeep(performer, o.performer, true)
3487           && compareDeep(note, o.note, true) && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true)
3488           && compareDeep(isSubpotent, o.isSubpotent, true) && compareDeep(subpotentReason, o.subpotentReason, true)
3489           && compareDeep(education, o.education, true) && compareDeep(programEligibility, o.programEligibility, true)
3490           && compareDeep(fundingSource, o.fundingSource, true) && compareDeep(reaction, o.reaction, true)
3491           && compareDeep(protocolApplied, o.protocolApplied, true);
3492      }
3493
3494      @Override
3495      public boolean equalsShallow(Base other_) {
3496        if (!super.equalsShallow(other_))
3497          return false;
3498        if (!(other_ instanceof Immunization))
3499          return false;
3500        Immunization o = (Immunization) other_;
3501        return compareValues(status, o.status, true) && compareValues(recorded, o.recorded, true) && compareValues(primarySource, o.primarySource, true)
3502           && compareValues(lotNumber, o.lotNumber, true) && compareValues(expirationDate, o.expirationDate, true)
3503           && compareValues(isSubpotent, o.isSubpotent, true);
3504      }
3505
3506      public boolean isEmpty() {
3507        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, statusReason
3508          , vaccineCode, patient, encounter, occurrence, recorded, primarySource, informationSource
3509          , location, manufacturer, lotNumber, expirationDate, site, route, doseQuantity
3510          , performer, note, reasonCode, reasonReference, isSubpotent, subpotentReason, education
3511          , programEligibility, fundingSource, reaction, protocolApplied);
3512      }
3513
3514  @Override
3515  public ResourceType getResourceType() {
3516    return ResourceType.Immunization;
3517   }
3518
3519 /**
3520   * Search parameter: <b>date</b>
3521   * <p>
3522   * Description: <b>Vaccination  (non)-Administration Date</b><br>
3523   * Type: <b>date</b><br>
3524   * Path: <b>Immunization.occurrence[x]</b><br>
3525   * </p>
3526   */
3527  @SearchParamDefinition(name="date", path="Immunization.occurrence", description="Vaccination  (non)-Administration Date", type="date" )
3528  public static final String SP_DATE = "date";
3529 /**
3530   * <b>Fluent Client</b> search parameter constant for <b>date</b>
3531   * <p>
3532   * Description: <b>Vaccination  (non)-Administration Date</b><br>
3533   * Type: <b>date</b><br>
3534   * Path: <b>Immunization.occurrence[x]</b><br>
3535   * </p>
3536   */
3537  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
3538
3539 /**
3540   * Search parameter: <b>identifier</b>
3541   * <p>
3542   * Description: <b>Business identifier</b><br>
3543   * Type: <b>token</b><br>
3544   * Path: <b>Immunization.identifier</b><br>
3545   * </p>
3546   */
3547  @SearchParamDefinition(name="identifier", path="Immunization.identifier", description="Business identifier", type="token" )
3548  public static final String SP_IDENTIFIER = "identifier";
3549 /**
3550   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3551   * <p>
3552   * Description: <b>Business identifier</b><br>
3553   * Type: <b>token</b><br>
3554   * Path: <b>Immunization.identifier</b><br>
3555   * </p>
3556   */
3557  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3558
3559 /**
3560   * Search parameter: <b>performer</b>
3561   * <p>
3562   * Description: <b>The practitioner or organization who played a role in the vaccination</b><br>
3563   * Type: <b>reference</b><br>
3564   * Path: <b>Immunization.performer.actor</b><br>
3565   * </p>
3566   */
3567  @SearchParamDefinition(name="performer", path="Immunization.performer.actor", description="The practitioner or organization who played a role in the vaccination", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Organization.class, Practitioner.class, PractitionerRole.class } )
3568  public static final String SP_PERFORMER = "performer";
3569 /**
3570   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
3571   * <p>
3572   * Description: <b>The practitioner or organization who played a role in the vaccination</b><br>
3573   * Type: <b>reference</b><br>
3574   * Path: <b>Immunization.performer.actor</b><br>
3575   * </p>
3576   */
3577  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PERFORMER);
3578
3579/**
3580   * Constant for fluent queries to be used to add include statements. Specifies
3581   * the path value of "<b>Immunization:performer</b>".
3582   */
3583  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include("Immunization:performer").toLocked();
3584
3585 /**
3586   * Search parameter: <b>reaction</b>
3587   * <p>
3588   * Description: <b>Additional information on reaction</b><br>
3589   * Type: <b>reference</b><br>
3590   * Path: <b>Immunization.reaction.detail</b><br>
3591   * </p>
3592   */
3593  @SearchParamDefinition(name="reaction", path="Immunization.reaction.detail", description="Additional information on reaction", type="reference", target={Observation.class } )
3594  public static final String SP_REACTION = "reaction";
3595 /**
3596   * <b>Fluent Client</b> search parameter constant for <b>reaction</b>
3597   * <p>
3598   * Description: <b>Additional information on reaction</b><br>
3599   * Type: <b>reference</b><br>
3600   * Path: <b>Immunization.reaction.detail</b><br>
3601   * </p>
3602   */
3603  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REACTION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REACTION);
3604
3605/**
3606   * Constant for fluent queries to be used to add include statements. Specifies
3607   * the path value of "<b>Immunization:reaction</b>".
3608   */
3609  public static final ca.uhn.fhir.model.api.Include INCLUDE_REACTION = new ca.uhn.fhir.model.api.Include("Immunization:reaction").toLocked();
3610
3611 /**
3612   * Search parameter: <b>lot-number</b>
3613   * <p>
3614   * Description: <b>Vaccine Lot Number</b><br>
3615   * Type: <b>string</b><br>
3616   * Path: <b>Immunization.lotNumber</b><br>
3617   * </p>
3618   */
3619  @SearchParamDefinition(name="lot-number", path="Immunization.lotNumber", description="Vaccine Lot Number", type="string" )
3620  public static final String SP_LOT_NUMBER = "lot-number";
3621 /**
3622   * <b>Fluent Client</b> search parameter constant for <b>lot-number</b>
3623   * <p>
3624   * Description: <b>Vaccine Lot Number</b><br>
3625   * Type: <b>string</b><br>
3626   * Path: <b>Immunization.lotNumber</b><br>
3627   * </p>
3628   */
3629  public static final ca.uhn.fhir.rest.gclient.StringClientParam LOT_NUMBER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_LOT_NUMBER);
3630
3631 /**
3632   * Search parameter: <b>status-reason</b>
3633   * <p>
3634   * Description: <b>Reason why the vaccine was not administered</b><br>
3635   * Type: <b>token</b><br>
3636   * Path: <b>Immunization.statusReason</b><br>
3637   * </p>
3638   */
3639  @SearchParamDefinition(name="status-reason", path="Immunization.statusReason", description="Reason why the vaccine was not administered", type="token" )
3640  public static final String SP_STATUS_REASON = "status-reason";
3641 /**
3642   * <b>Fluent Client</b> search parameter constant for <b>status-reason</b>
3643   * <p>
3644   * Description: <b>Reason why the vaccine was not administered</b><br>
3645   * Type: <b>token</b><br>
3646   * Path: <b>Immunization.statusReason</b><br>
3647   * </p>
3648   */
3649  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS_REASON = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS_REASON);
3650
3651 /**
3652   * Search parameter: <b>reason-code</b>
3653   * <p>
3654   * Description: <b>Reason why the vaccine was administered</b><br>
3655   * Type: <b>token</b><br>
3656   * Path: <b>Immunization.reasonCode</b><br>
3657   * </p>
3658   */
3659  @SearchParamDefinition(name="reason-code", path="Immunization.reasonCode", description="Reason why the vaccine was administered", type="token" )
3660  public static final String SP_REASON_CODE = "reason-code";
3661 /**
3662   * <b>Fluent Client</b> search parameter constant for <b>reason-code</b>
3663   * <p>
3664   * Description: <b>Reason why the vaccine was administered</b><br>
3665   * Type: <b>token</b><br>
3666   * Path: <b>Immunization.reasonCode</b><br>
3667   * </p>
3668   */
3669  public static final ca.uhn.fhir.rest.gclient.TokenClientParam REASON_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_REASON_CODE);
3670
3671 /**
3672   * Search parameter: <b>manufacturer</b>
3673   * <p>
3674   * Description: <b>Vaccine Manufacturer</b><br>
3675   * Type: <b>reference</b><br>
3676   * Path: <b>Immunization.manufacturer</b><br>
3677   * </p>
3678   */
3679  @SearchParamDefinition(name="manufacturer", path="Immunization.manufacturer", description="Vaccine Manufacturer", type="reference", target={Organization.class } )
3680  public static final String SP_MANUFACTURER = "manufacturer";
3681 /**
3682   * <b>Fluent Client</b> search parameter constant for <b>manufacturer</b>
3683   * <p>
3684   * Description: <b>Vaccine Manufacturer</b><br>
3685   * Type: <b>reference</b><br>
3686   * Path: <b>Immunization.manufacturer</b><br>
3687   * </p>
3688   */
3689  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MANUFACTURER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MANUFACTURER);
3690
3691/**
3692   * Constant for fluent queries to be used to add include statements. Specifies
3693   * the path value of "<b>Immunization:manufacturer</b>".
3694   */
3695  public static final ca.uhn.fhir.model.api.Include INCLUDE_MANUFACTURER = new ca.uhn.fhir.model.api.Include("Immunization:manufacturer").toLocked();
3696
3697 /**
3698   * Search parameter: <b>target-disease</b>
3699   * <p>
3700   * Description: <b>The target disease the dose is being administered against</b><br>
3701   * Type: <b>token</b><br>
3702   * Path: <b>Immunization.protocolApplied.targetDisease</b><br>
3703   * </p>
3704   */
3705  @SearchParamDefinition(name="target-disease", path="Immunization.protocolApplied.targetDisease", description="The target disease the dose is being administered against", type="token" )
3706  public static final String SP_TARGET_DISEASE = "target-disease";
3707 /**
3708   * <b>Fluent Client</b> search parameter constant for <b>target-disease</b>
3709   * <p>
3710   * Description: <b>The target disease the dose is being administered against</b><br>
3711   * Type: <b>token</b><br>
3712   * Path: <b>Immunization.protocolApplied.targetDisease</b><br>
3713   * </p>
3714   */
3715  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TARGET_DISEASE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TARGET_DISEASE);
3716
3717 /**
3718   * Search parameter: <b>patient</b>
3719   * <p>
3720   * Description: <b>The patient for the vaccination record</b><br>
3721   * Type: <b>reference</b><br>
3722   * Path: <b>Immunization.patient</b><br>
3723   * </p>
3724   */
3725  @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 } )
3726  public static final String SP_PATIENT = "patient";
3727 /**
3728   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3729   * <p>
3730   * Description: <b>The patient for the vaccination record</b><br>
3731   * Type: <b>reference</b><br>
3732   * Path: <b>Immunization.patient</b><br>
3733   * </p>
3734   */
3735  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
3736
3737/**
3738   * Constant for fluent queries to be used to add include statements. Specifies
3739   * the path value of "<b>Immunization:patient</b>".
3740   */
3741  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Immunization:patient").toLocked();
3742
3743 /**
3744   * Search parameter: <b>series</b>
3745   * <p>
3746   * Description: <b>The series being followed by the provider</b><br>
3747   * Type: <b>string</b><br>
3748   * Path: <b>Immunization.protocolApplied.series</b><br>
3749   * </p>
3750   */
3751  @SearchParamDefinition(name="series", path="Immunization.protocolApplied.series", description="The series being followed by the provider", type="string" )
3752  public static final String SP_SERIES = "series";
3753 /**
3754   * <b>Fluent Client</b> search parameter constant for <b>series</b>
3755   * <p>
3756   * Description: <b>The series being followed by the provider</b><br>
3757   * Type: <b>string</b><br>
3758   * Path: <b>Immunization.protocolApplied.series</b><br>
3759   * </p>
3760   */
3761  public static final ca.uhn.fhir.rest.gclient.StringClientParam SERIES = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_SERIES);
3762
3763 /**
3764   * Search parameter: <b>vaccine-code</b>
3765   * <p>
3766   * Description: <b>Vaccine Product Administered</b><br>
3767   * Type: <b>token</b><br>
3768   * Path: <b>Immunization.vaccineCode</b><br>
3769   * </p>
3770   */
3771  @SearchParamDefinition(name="vaccine-code", path="Immunization.vaccineCode", description="Vaccine Product Administered", type="token" )
3772  public static final String SP_VACCINE_CODE = "vaccine-code";
3773 /**
3774   * <b>Fluent Client</b> search parameter constant for <b>vaccine-code</b>
3775   * <p>
3776   * Description: <b>Vaccine Product Administered</b><br>
3777   * Type: <b>token</b><br>
3778   * Path: <b>Immunization.vaccineCode</b><br>
3779   * </p>
3780   */
3781  public static final ca.uhn.fhir.rest.gclient.TokenClientParam VACCINE_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_VACCINE_CODE);
3782
3783 /**
3784   * Search parameter: <b>reason-reference</b>
3785   * <p>
3786   * Description: <b>Why immunization occurred</b><br>
3787   * Type: <b>reference</b><br>
3788   * Path: <b>Immunization.reasonReference</b><br>
3789   * </p>
3790   */
3791  @SearchParamDefinition(name="reason-reference", path="Immunization.reasonReference", description="Why immunization occurred", type="reference", target={Condition.class, DiagnosticReport.class, Observation.class } )
3792  public static final String SP_REASON_REFERENCE = "reason-reference";
3793 /**
3794   * <b>Fluent Client</b> search parameter constant for <b>reason-reference</b>
3795   * <p>
3796   * Description: <b>Why immunization occurred</b><br>
3797   * Type: <b>reference</b><br>
3798   * Path: <b>Immunization.reasonReference</b><br>
3799   * </p>
3800   */
3801  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REASON_REFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REASON_REFERENCE);
3802
3803/**
3804   * Constant for fluent queries to be used to add include statements. Specifies
3805   * the path value of "<b>Immunization:reason-reference</b>".
3806   */
3807  public static final ca.uhn.fhir.model.api.Include INCLUDE_REASON_REFERENCE = new ca.uhn.fhir.model.api.Include("Immunization:reason-reference").toLocked();
3808
3809 /**
3810   * Search parameter: <b>location</b>
3811   * <p>
3812   * Description: <b>The service delivery location or facility in which the vaccine was / was to be administered</b><br>
3813   * Type: <b>reference</b><br>
3814   * Path: <b>Immunization.location</b><br>
3815   * </p>
3816   */
3817  @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 } )
3818  public static final String SP_LOCATION = "location";
3819 /**
3820   * <b>Fluent Client</b> search parameter constant for <b>location</b>
3821   * <p>
3822   * Description: <b>The service delivery location or facility in which the vaccine was / was to be administered</b><br>
3823   * Type: <b>reference</b><br>
3824   * Path: <b>Immunization.location</b><br>
3825   * </p>
3826   */
3827  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
3828
3829/**
3830   * Constant for fluent queries to be used to add include statements. Specifies
3831   * the path value of "<b>Immunization:location</b>".
3832   */
3833  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("Immunization:location").toLocked();
3834
3835 /**
3836   * Search parameter: <b>status</b>
3837   * <p>
3838   * Description: <b>Immunization event status</b><br>
3839   * Type: <b>token</b><br>
3840   * Path: <b>Immunization.status</b><br>
3841   * </p>
3842   */
3843  @SearchParamDefinition(name="status", path="Immunization.status", description="Immunization event status", type="token" )
3844  public static final String SP_STATUS = "status";
3845 /**
3846   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3847   * <p>
3848   * Description: <b>Immunization event status</b><br>
3849   * Type: <b>token</b><br>
3850   * Path: <b>Immunization.status</b><br>
3851   * </p>
3852   */
3853  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3854
3855 /**
3856   * Search parameter: <b>reaction-date</b>
3857   * <p>
3858   * Description: <b>When reaction started</b><br>
3859   * Type: <b>date</b><br>
3860   * Path: <b>Immunization.reaction.date</b><br>
3861   * </p>
3862   */
3863  @SearchParamDefinition(name="reaction-date", path="Immunization.reaction.date", description="When reaction started", type="date" )
3864  public static final String SP_REACTION_DATE = "reaction-date";
3865 /**
3866   * <b>Fluent Client</b> search parameter constant for <b>reaction-date</b>
3867   * <p>
3868   * Description: <b>When reaction started</b><br>
3869   * Type: <b>date</b><br>
3870   * Path: <b>Immunization.reaction.date</b><br>
3871   * </p>
3872   */
3873  public static final ca.uhn.fhir.rest.gclient.DateClientParam REACTION_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_REACTION_DATE);
3874
3875
3876}
3877