001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.utilities.Utilities;
040
041import ca.uhn.fhir.model.api.annotation.Block;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.ResourceDef;
045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
046
047/**
048 * A patient's point-in-time set of recommendations (i.e. forecasting) according
049 * to a published schedule with optional supporting justification.
050 */
051@ResourceDef(name = "ImmunizationRecommendation", profile = "http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation")
052public class ImmunizationRecommendation extends DomainResource {
053
054  @Block()
055  public static class ImmunizationRecommendationRecommendationComponent extends BackboneElement
056      implements IBaseBackboneElement {
057    /**
058     * Vaccine(s) or vaccine group that pertain to the recommendation.
059     */
060    @Child(name = "vaccineCode", type = {
061        CodeableConcept.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
062    @Description(shortDefinition = "Vaccine  or vaccine group recommendation applies to", formalDefinition = "Vaccine(s) or vaccine group that pertain to the recommendation.")
063    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/vaccine-code")
064    protected List<CodeableConcept> vaccineCode;
065
066    /**
067     * The targeted disease for the recommendation.
068     */
069    @Child(name = "targetDisease", type = {
070        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
071    @Description(shortDefinition = "Disease to be immunized against", formalDefinition = "The targeted disease for the recommendation.")
072    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/immunization-recommendation-target-disease")
073    protected CodeableConcept targetDisease;
074
075    /**
076     * Vaccine(s) which should not be used to fulfill the recommendation.
077     */
078    @Child(name = "contraindicatedVaccineCode", type = {
079        CodeableConcept.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
080    @Description(shortDefinition = "Vaccine which is contraindicated to fulfill the recommendation", formalDefinition = "Vaccine(s) which should not be used to fulfill the recommendation.")
081    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/vaccine-code")
082    protected List<CodeableConcept> contraindicatedVaccineCode;
083
084    /**
085     * Indicates the patient status with respect to the path to immunity for the
086     * target disease.
087     */
088    @Child(name = "forecastStatus", type = {
089        CodeableConcept.class }, order = 4, min = 1, max = 1, modifier = true, summary = true)
090    @Description(shortDefinition = "Vaccine recommendation status", formalDefinition = "Indicates the patient status with respect to the path to immunity for the target disease.")
091    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/immunization-recommendation-status")
092    protected CodeableConcept forecastStatus;
093
094    /**
095     * The reason for the assigned forecast status.
096     */
097    @Child(name = "forecastReason", type = {
098        CodeableConcept.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
099    @Description(shortDefinition = "Vaccine administration status reason", formalDefinition = "The reason for the assigned forecast status.")
100    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/immunization-recommendation-reason")
101    protected List<CodeableConcept> forecastReason;
102
103    /**
104     * Vaccine date recommendations. For example, earliest date to administer,
105     * latest date to administer, etc.
106     */
107    @Child(name = "dateCriterion", type = {}, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
108    @Description(shortDefinition = "Dates governing proposed immunization", formalDefinition = "Vaccine date recommendations.  For example, earliest date to administer, latest date to administer, etc.")
109    protected List<ImmunizationRecommendationRecommendationDateCriterionComponent> dateCriterion;
110
111    /**
112     * Contains the description about the protocol under which the vaccine was
113     * administered.
114     */
115    @Child(name = "description", type = {
116        StringType.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
117    @Description(shortDefinition = "Protocol details", formalDefinition = "Contains the description about the protocol under which the vaccine was administered.")
118    protected StringType description;
119
120    /**
121     * One possible path to achieve presumed immunity against a disease - within the
122     * context of an authority.
123     */
124    @Child(name = "series", type = { StringType.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
125    @Description(shortDefinition = "Name of vaccination series", formalDefinition = "One possible path to achieve presumed immunity against a disease - within the context of an authority.")
126    protected StringType series;
127
128    /**
129     * Nominal position of the recommended dose in a series (e.g. dose 2 is the next
130     * recommended dose).
131     */
132    @Child(name = "doseNumber", type = { PositiveIntType.class,
133        StringType.class }, order = 9, min = 0, max = 1, modifier = false, summary = true)
134    @Description(shortDefinition = "Recommended dose number within series", formalDefinition = "Nominal position of the recommended dose in a series (e.g. dose 2 is the next recommended dose).")
135    protected Type doseNumber;
136
137    /**
138     * The recommended number of doses to achieve immunity.
139     */
140    @Child(name = "seriesDoses", type = { PositiveIntType.class,
141        StringType.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
142    @Description(shortDefinition = "Recommended number of doses for immunity", formalDefinition = "The recommended number of doses to achieve immunity.")
143    protected Type seriesDoses;
144
145    /**
146     * Immunization event history and/or evaluation that supports the status and
147     * recommendation.
148     */
149    @Child(name = "supportingImmunization", type = { Immunization.class,
150        ImmunizationEvaluation.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
151    @Description(shortDefinition = "Past immunizations supporting recommendation", formalDefinition = "Immunization event history and/or evaluation that supports the status and recommendation.")
152    protected List<Reference> supportingImmunization;
153    /**
154     * The actual objects that are the target of the reference (Immunization event
155     * history and/or evaluation that supports the status and recommendation.)
156     */
157    protected List<Resource> supportingImmunizationTarget;
158
159    /**
160     * Patient Information that supports the status and recommendation. This
161     * includes patient observations, adverse reactions and allergy/intolerance
162     * information.
163     */
164    @Child(name = "supportingPatientInformation", type = {
165        Reference.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
166    @Description(shortDefinition = "Patient observations supporting recommendation", formalDefinition = "Patient Information that supports the status and recommendation.  This includes patient observations, adverse reactions and allergy/intolerance information.")
167    protected List<Reference> supportingPatientInformation;
168    /**
169     * The actual objects that are the target of the reference (Patient Information
170     * that supports the status and recommendation. This includes patient
171     * observations, adverse reactions and allergy/intolerance information.)
172     */
173    protected List<Resource> supportingPatientInformationTarget;
174
175    private static final long serialVersionUID = -667399405L;
176
177    /**
178     * Constructor
179     */
180    public ImmunizationRecommendationRecommendationComponent() {
181      super();
182    }
183
184    /**
185     * Constructor
186     */
187    public ImmunizationRecommendationRecommendationComponent(CodeableConcept forecastStatus) {
188      super();
189      this.forecastStatus = forecastStatus;
190    }
191
192    /**
193     * @return {@link #vaccineCode} (Vaccine(s) or vaccine group that pertain to the
194     *         recommendation.)
195     */
196    public List<CodeableConcept> getVaccineCode() {
197      if (this.vaccineCode == null)
198        this.vaccineCode = new ArrayList<CodeableConcept>();
199      return this.vaccineCode;
200    }
201
202    /**
203     * @return Returns a reference to <code>this</code> for easy method chaining
204     */
205    public ImmunizationRecommendationRecommendationComponent setVaccineCode(List<CodeableConcept> theVaccineCode) {
206      this.vaccineCode = theVaccineCode;
207      return this;
208    }
209
210    public boolean hasVaccineCode() {
211      if (this.vaccineCode == null)
212        return false;
213      for (CodeableConcept item : this.vaccineCode)
214        if (!item.isEmpty())
215          return true;
216      return false;
217    }
218
219    public CodeableConcept addVaccineCode() { // 3
220      CodeableConcept t = new CodeableConcept();
221      if (this.vaccineCode == null)
222        this.vaccineCode = new ArrayList<CodeableConcept>();
223      this.vaccineCode.add(t);
224      return t;
225    }
226
227    public ImmunizationRecommendationRecommendationComponent addVaccineCode(CodeableConcept t) { // 3
228      if (t == null)
229        return this;
230      if (this.vaccineCode == null)
231        this.vaccineCode = new ArrayList<CodeableConcept>();
232      this.vaccineCode.add(t);
233      return this;
234    }
235
236    /**
237     * @return The first repetition of repeating field {@link #vaccineCode},
238     *         creating it if it does not already exist
239     */
240    public CodeableConcept getVaccineCodeFirstRep() {
241      if (getVaccineCode().isEmpty()) {
242        addVaccineCode();
243      }
244      return getVaccineCode().get(0);
245    }
246
247    /**
248     * @return {@link #targetDisease} (The targeted disease for the recommendation.)
249     */
250    public CodeableConcept getTargetDisease() {
251      if (this.targetDisease == null)
252        if (Configuration.errorOnAutoCreate())
253          throw new Error("Attempt to auto-create ImmunizationRecommendationRecommendationComponent.targetDisease");
254        else if (Configuration.doAutoCreate())
255          this.targetDisease = new CodeableConcept(); // cc
256      return this.targetDisease;
257    }
258
259    public boolean hasTargetDisease() {
260      return this.targetDisease != null && !this.targetDisease.isEmpty();
261    }
262
263    /**
264     * @param value {@link #targetDisease} (The targeted disease for the
265     *              recommendation.)
266     */
267    public ImmunizationRecommendationRecommendationComponent setTargetDisease(CodeableConcept value) {
268      this.targetDisease = value;
269      return this;
270    }
271
272    /**
273     * @return {@link #contraindicatedVaccineCode} (Vaccine(s) which should not be
274     *         used to fulfill the recommendation.)
275     */
276    public List<CodeableConcept> getContraindicatedVaccineCode() {
277      if (this.contraindicatedVaccineCode == null)
278        this.contraindicatedVaccineCode = new ArrayList<CodeableConcept>();
279      return this.contraindicatedVaccineCode;
280    }
281
282    /**
283     * @return Returns a reference to <code>this</code> for easy method chaining
284     */
285    public ImmunizationRecommendationRecommendationComponent setContraindicatedVaccineCode(
286        List<CodeableConcept> theContraindicatedVaccineCode) {
287      this.contraindicatedVaccineCode = theContraindicatedVaccineCode;
288      return this;
289    }
290
291    public boolean hasContraindicatedVaccineCode() {
292      if (this.contraindicatedVaccineCode == null)
293        return false;
294      for (CodeableConcept item : this.contraindicatedVaccineCode)
295        if (!item.isEmpty())
296          return true;
297      return false;
298    }
299
300    public CodeableConcept addContraindicatedVaccineCode() { // 3
301      CodeableConcept t = new CodeableConcept();
302      if (this.contraindicatedVaccineCode == null)
303        this.contraindicatedVaccineCode = new ArrayList<CodeableConcept>();
304      this.contraindicatedVaccineCode.add(t);
305      return t;
306    }
307
308    public ImmunizationRecommendationRecommendationComponent addContraindicatedVaccineCode(CodeableConcept t) { // 3
309      if (t == null)
310        return this;
311      if (this.contraindicatedVaccineCode == null)
312        this.contraindicatedVaccineCode = new ArrayList<CodeableConcept>();
313      this.contraindicatedVaccineCode.add(t);
314      return this;
315    }
316
317    /**
318     * @return The first repetition of repeating field
319     *         {@link #contraindicatedVaccineCode}, creating it if it does not
320     *         already exist
321     */
322    public CodeableConcept getContraindicatedVaccineCodeFirstRep() {
323      if (getContraindicatedVaccineCode().isEmpty()) {
324        addContraindicatedVaccineCode();
325      }
326      return getContraindicatedVaccineCode().get(0);
327    }
328
329    /**
330     * @return {@link #forecastStatus} (Indicates the patient status with respect to
331     *         the path to immunity for the target disease.)
332     */
333    public CodeableConcept getForecastStatus() {
334      if (this.forecastStatus == null)
335        if (Configuration.errorOnAutoCreate())
336          throw new Error("Attempt to auto-create ImmunizationRecommendationRecommendationComponent.forecastStatus");
337        else if (Configuration.doAutoCreate())
338          this.forecastStatus = new CodeableConcept(); // cc
339      return this.forecastStatus;
340    }
341
342    public boolean hasForecastStatus() {
343      return this.forecastStatus != null && !this.forecastStatus.isEmpty();
344    }
345
346    /**
347     * @param value {@link #forecastStatus} (Indicates the patient status with
348     *              respect to the path to immunity for the target disease.)
349     */
350    public ImmunizationRecommendationRecommendationComponent setForecastStatus(CodeableConcept value) {
351      this.forecastStatus = value;
352      return this;
353    }
354
355    /**
356     * @return {@link #forecastReason} (The reason for the assigned forecast
357     *         status.)
358     */
359    public List<CodeableConcept> getForecastReason() {
360      if (this.forecastReason == null)
361        this.forecastReason = new ArrayList<CodeableConcept>();
362      return this.forecastReason;
363    }
364
365    /**
366     * @return Returns a reference to <code>this</code> for easy method chaining
367     */
368    public ImmunizationRecommendationRecommendationComponent setForecastReason(
369        List<CodeableConcept> theForecastReason) {
370      this.forecastReason = theForecastReason;
371      return this;
372    }
373
374    public boolean hasForecastReason() {
375      if (this.forecastReason == null)
376        return false;
377      for (CodeableConcept item : this.forecastReason)
378        if (!item.isEmpty())
379          return true;
380      return false;
381    }
382
383    public CodeableConcept addForecastReason() { // 3
384      CodeableConcept t = new CodeableConcept();
385      if (this.forecastReason == null)
386        this.forecastReason = new ArrayList<CodeableConcept>();
387      this.forecastReason.add(t);
388      return t;
389    }
390
391    public ImmunizationRecommendationRecommendationComponent addForecastReason(CodeableConcept t) { // 3
392      if (t == null)
393        return this;
394      if (this.forecastReason == null)
395        this.forecastReason = new ArrayList<CodeableConcept>();
396      this.forecastReason.add(t);
397      return this;
398    }
399
400    /**
401     * @return The first repetition of repeating field {@link #forecastReason},
402     *         creating it if it does not already exist
403     */
404    public CodeableConcept getForecastReasonFirstRep() {
405      if (getForecastReason().isEmpty()) {
406        addForecastReason();
407      }
408      return getForecastReason().get(0);
409    }
410
411    /**
412     * @return {@link #dateCriterion} (Vaccine date recommendations. For example,
413     *         earliest date to administer, latest date to administer, etc.)
414     */
415    public List<ImmunizationRecommendationRecommendationDateCriterionComponent> getDateCriterion() {
416      if (this.dateCriterion == null)
417        this.dateCriterion = new ArrayList<ImmunizationRecommendationRecommendationDateCriterionComponent>();
418      return this.dateCriterion;
419    }
420
421    /**
422     * @return Returns a reference to <code>this</code> for easy method chaining
423     */
424    public ImmunizationRecommendationRecommendationComponent setDateCriterion(
425        List<ImmunizationRecommendationRecommendationDateCriterionComponent> theDateCriterion) {
426      this.dateCriterion = theDateCriterion;
427      return this;
428    }
429
430    public boolean hasDateCriterion() {
431      if (this.dateCriterion == null)
432        return false;
433      for (ImmunizationRecommendationRecommendationDateCriterionComponent item : this.dateCriterion)
434        if (!item.isEmpty())
435          return true;
436      return false;
437    }
438
439    public ImmunizationRecommendationRecommendationDateCriterionComponent addDateCriterion() { // 3
440      ImmunizationRecommendationRecommendationDateCriterionComponent t = new ImmunizationRecommendationRecommendationDateCriterionComponent();
441      if (this.dateCriterion == null)
442        this.dateCriterion = new ArrayList<ImmunizationRecommendationRecommendationDateCriterionComponent>();
443      this.dateCriterion.add(t);
444      return t;
445    }
446
447    public ImmunizationRecommendationRecommendationComponent addDateCriterion(
448        ImmunizationRecommendationRecommendationDateCriterionComponent t) { // 3
449      if (t == null)
450        return this;
451      if (this.dateCriterion == null)
452        this.dateCriterion = new ArrayList<ImmunizationRecommendationRecommendationDateCriterionComponent>();
453      this.dateCriterion.add(t);
454      return this;
455    }
456
457    /**
458     * @return The first repetition of repeating field {@link #dateCriterion},
459     *         creating it if it does not already exist
460     */
461    public ImmunizationRecommendationRecommendationDateCriterionComponent getDateCriterionFirstRep() {
462      if (getDateCriterion().isEmpty()) {
463        addDateCriterion();
464      }
465      return getDateCriterion().get(0);
466    }
467
468    /**
469     * @return {@link #description} (Contains the description about the protocol
470     *         under which the vaccine was administered.). This is the underlying
471     *         object with id, value and extensions. The accessor "getDescription"
472     *         gives direct access to the value
473     */
474    public StringType getDescriptionElement() {
475      if (this.description == null)
476        if (Configuration.errorOnAutoCreate())
477          throw new Error("Attempt to auto-create ImmunizationRecommendationRecommendationComponent.description");
478        else if (Configuration.doAutoCreate())
479          this.description = new StringType(); // bb
480      return this.description;
481    }
482
483    public boolean hasDescriptionElement() {
484      return this.description != null && !this.description.isEmpty();
485    }
486
487    public boolean hasDescription() {
488      return this.description != null && !this.description.isEmpty();
489    }
490
491    /**
492     * @param value {@link #description} (Contains the description about the
493     *              protocol under which the vaccine was administered.). This is the
494     *              underlying object with id, value and extensions. The accessor
495     *              "getDescription" gives direct access to the value
496     */
497    public ImmunizationRecommendationRecommendationComponent setDescriptionElement(StringType value) {
498      this.description = value;
499      return this;
500    }
501
502    /**
503     * @return Contains the description about the protocol under which the vaccine
504     *         was administered.
505     */
506    public String getDescription() {
507      return this.description == null ? null : this.description.getValue();
508    }
509
510    /**
511     * @param value Contains the description about the protocol under which the
512     *              vaccine was administered.
513     */
514    public ImmunizationRecommendationRecommendationComponent setDescription(String value) {
515      if (Utilities.noString(value))
516        this.description = null;
517      else {
518        if (this.description == null)
519          this.description = new StringType();
520        this.description.setValue(value);
521      }
522      return this;
523    }
524
525    /**
526     * @return {@link #series} (One possible path to achieve presumed immunity
527     *         against a disease - within the context of an authority.). This is the
528     *         underlying object with id, value and extensions. The accessor
529     *         "getSeries" gives direct access to the value
530     */
531    public StringType getSeriesElement() {
532      if (this.series == null)
533        if (Configuration.errorOnAutoCreate())
534          throw new Error("Attempt to auto-create ImmunizationRecommendationRecommendationComponent.series");
535        else if (Configuration.doAutoCreate())
536          this.series = new StringType(); // bb
537      return this.series;
538    }
539
540    public boolean hasSeriesElement() {
541      return this.series != null && !this.series.isEmpty();
542    }
543
544    public boolean hasSeries() {
545      return this.series != null && !this.series.isEmpty();
546    }
547
548    /**
549     * @param value {@link #series} (One possible path to achieve presumed immunity
550     *              against a disease - within the context of an authority.). This
551     *              is the underlying object with id, value and extensions. The
552     *              accessor "getSeries" gives direct access to the value
553     */
554    public ImmunizationRecommendationRecommendationComponent setSeriesElement(StringType value) {
555      this.series = value;
556      return this;
557    }
558
559    /**
560     * @return One possible path to achieve presumed immunity against a disease -
561     *         within the context of an authority.
562     */
563    public String getSeries() {
564      return this.series == null ? null : this.series.getValue();
565    }
566
567    /**
568     * @param value One possible path to achieve presumed immunity against a disease
569     *              - within the context of an authority.
570     */
571    public ImmunizationRecommendationRecommendationComponent setSeries(String value) {
572      if (Utilities.noString(value))
573        this.series = null;
574      else {
575        if (this.series == null)
576          this.series = new StringType();
577        this.series.setValue(value);
578      }
579      return this;
580    }
581
582    /**
583     * @return {@link #doseNumber} (Nominal position of the recommended dose in a
584     *         series (e.g. dose 2 is the next recommended dose).)
585     */
586    public Type getDoseNumber() {
587      return this.doseNumber;
588    }
589
590    /**
591     * @return {@link #doseNumber} (Nominal position of the recommended dose in a
592     *         series (e.g. dose 2 is the next recommended dose).)
593     */
594    public PositiveIntType getDoseNumberPositiveIntType() throws FHIRException {
595      if (this.doseNumber == null)
596        this.doseNumber = new PositiveIntType();
597      if (!(this.doseNumber instanceof PositiveIntType))
598        throw new FHIRException("Type mismatch: the type PositiveIntType was expected, but "
599            + this.doseNumber.getClass().getName() + " was encountered");
600      return (PositiveIntType) this.doseNumber;
601    }
602
603    public boolean hasDoseNumberPositiveIntType() {
604      return this != null && this.doseNumber instanceof PositiveIntType;
605    }
606
607    /**
608     * @return {@link #doseNumber} (Nominal position of the recommended dose in a
609     *         series (e.g. dose 2 is the next recommended dose).)
610     */
611    public StringType getDoseNumberStringType() throws FHIRException {
612      if (this.doseNumber == null)
613        this.doseNumber = new StringType();
614      if (!(this.doseNumber instanceof StringType))
615        throw new FHIRException("Type mismatch: the type StringType was expected, but "
616            + this.doseNumber.getClass().getName() + " was encountered");
617      return (StringType) this.doseNumber;
618    }
619
620    public boolean hasDoseNumberStringType() {
621      return this != null && this.doseNumber instanceof StringType;
622    }
623
624    public boolean hasDoseNumber() {
625      return this.doseNumber != null && !this.doseNumber.isEmpty();
626    }
627
628    /**
629     * @param value {@link #doseNumber} (Nominal position of the recommended dose in
630     *              a series (e.g. dose 2 is the next recommended dose).)
631     */
632    public ImmunizationRecommendationRecommendationComponent setDoseNumber(Type value) {
633      if (value != null && !(value instanceof PositiveIntType || value instanceof StringType))
634        throw new Error(
635            "Not the right type for ImmunizationRecommendation.recommendation.doseNumber[x]: " + value.fhirType());
636      this.doseNumber = value;
637      return this;
638    }
639
640    /**
641     * @return {@link #seriesDoses} (The recommended number of doses to achieve
642     *         immunity.)
643     */
644    public Type getSeriesDoses() {
645      return this.seriesDoses;
646    }
647
648    /**
649     * @return {@link #seriesDoses} (The recommended number of doses to achieve
650     *         immunity.)
651     */
652    public PositiveIntType getSeriesDosesPositiveIntType() throws FHIRException {
653      if (this.seriesDoses == null)
654        this.seriesDoses = new PositiveIntType();
655      if (!(this.seriesDoses instanceof PositiveIntType))
656        throw new FHIRException("Type mismatch: the type PositiveIntType was expected, but "
657            + this.seriesDoses.getClass().getName() + " was encountered");
658      return (PositiveIntType) this.seriesDoses;
659    }
660
661    public boolean hasSeriesDosesPositiveIntType() {
662      return this != null && this.seriesDoses instanceof PositiveIntType;
663    }
664
665    /**
666     * @return {@link #seriesDoses} (The recommended number of doses to achieve
667     *         immunity.)
668     */
669    public StringType getSeriesDosesStringType() throws FHIRException {
670      if (this.seriesDoses == null)
671        this.seriesDoses = new StringType();
672      if (!(this.seriesDoses instanceof StringType))
673        throw new FHIRException("Type mismatch: the type StringType was expected, but "
674            + this.seriesDoses.getClass().getName() + " was encountered");
675      return (StringType) this.seriesDoses;
676    }
677
678    public boolean hasSeriesDosesStringType() {
679      return this != null && this.seriesDoses instanceof StringType;
680    }
681
682    public boolean hasSeriesDoses() {
683      return this.seriesDoses != null && !this.seriesDoses.isEmpty();
684    }
685
686    /**
687     * @param value {@link #seriesDoses} (The recommended number of doses to achieve
688     *              immunity.)
689     */
690    public ImmunizationRecommendationRecommendationComponent setSeriesDoses(Type value) {
691      if (value != null && !(value instanceof PositiveIntType || value instanceof StringType))
692        throw new Error(
693            "Not the right type for ImmunizationRecommendation.recommendation.seriesDoses[x]: " + value.fhirType());
694      this.seriesDoses = value;
695      return this;
696    }
697
698    /**
699     * @return {@link #supportingImmunization} (Immunization event history and/or
700     *         evaluation that supports the status and recommendation.)
701     */
702    public List<Reference> getSupportingImmunization() {
703      if (this.supportingImmunization == null)
704        this.supportingImmunization = new ArrayList<Reference>();
705      return this.supportingImmunization;
706    }
707
708    /**
709     * @return Returns a reference to <code>this</code> for easy method chaining
710     */
711    public ImmunizationRecommendationRecommendationComponent setSupportingImmunization(
712        List<Reference> theSupportingImmunization) {
713      this.supportingImmunization = theSupportingImmunization;
714      return this;
715    }
716
717    public boolean hasSupportingImmunization() {
718      if (this.supportingImmunization == null)
719        return false;
720      for (Reference item : this.supportingImmunization)
721        if (!item.isEmpty())
722          return true;
723      return false;
724    }
725
726    public Reference addSupportingImmunization() { // 3
727      Reference t = new Reference();
728      if (this.supportingImmunization == null)
729        this.supportingImmunization = new ArrayList<Reference>();
730      this.supportingImmunization.add(t);
731      return t;
732    }
733
734    public ImmunizationRecommendationRecommendationComponent addSupportingImmunization(Reference t) { // 3
735      if (t == null)
736        return this;
737      if (this.supportingImmunization == null)
738        this.supportingImmunization = new ArrayList<Reference>();
739      this.supportingImmunization.add(t);
740      return this;
741    }
742
743    /**
744     * @return The first repetition of repeating field
745     *         {@link #supportingImmunization}, creating it if it does not already
746     *         exist
747     */
748    public Reference getSupportingImmunizationFirstRep() {
749      if (getSupportingImmunization().isEmpty()) {
750        addSupportingImmunization();
751      }
752      return getSupportingImmunization().get(0);
753    }
754
755    /**
756     * @deprecated Use Reference#setResource(IBaseResource) instead
757     */
758    @Deprecated
759    public List<Resource> getSupportingImmunizationTarget() {
760      if (this.supportingImmunizationTarget == null)
761        this.supportingImmunizationTarget = new ArrayList<Resource>();
762      return this.supportingImmunizationTarget;
763    }
764
765    /**
766     * @return {@link #supportingPatientInformation} (Patient Information that
767     *         supports the status and recommendation. This includes patient
768     *         observations, adverse reactions and allergy/intolerance information.)
769     */
770    public List<Reference> getSupportingPatientInformation() {
771      if (this.supportingPatientInformation == null)
772        this.supportingPatientInformation = new ArrayList<Reference>();
773      return this.supportingPatientInformation;
774    }
775
776    /**
777     * @return Returns a reference to <code>this</code> for easy method chaining
778     */
779    public ImmunizationRecommendationRecommendationComponent setSupportingPatientInformation(
780        List<Reference> theSupportingPatientInformation) {
781      this.supportingPatientInformation = theSupportingPatientInformation;
782      return this;
783    }
784
785    public boolean hasSupportingPatientInformation() {
786      if (this.supportingPatientInformation == null)
787        return false;
788      for (Reference item : this.supportingPatientInformation)
789        if (!item.isEmpty())
790          return true;
791      return false;
792    }
793
794    public Reference addSupportingPatientInformation() { // 3
795      Reference t = new Reference();
796      if (this.supportingPatientInformation == null)
797        this.supportingPatientInformation = new ArrayList<Reference>();
798      this.supportingPatientInformation.add(t);
799      return t;
800    }
801
802    public ImmunizationRecommendationRecommendationComponent addSupportingPatientInformation(Reference t) { // 3
803      if (t == null)
804        return this;
805      if (this.supportingPatientInformation == null)
806        this.supportingPatientInformation = new ArrayList<Reference>();
807      this.supportingPatientInformation.add(t);
808      return this;
809    }
810
811    /**
812     * @return The first repetition of repeating field
813     *         {@link #supportingPatientInformation}, creating it if it does not
814     *         already exist
815     */
816    public Reference getSupportingPatientInformationFirstRep() {
817      if (getSupportingPatientInformation().isEmpty()) {
818        addSupportingPatientInformation();
819      }
820      return getSupportingPatientInformation().get(0);
821    }
822
823    /**
824     * @deprecated Use Reference#setResource(IBaseResource) instead
825     */
826    @Deprecated
827    public List<Resource> getSupportingPatientInformationTarget() {
828      if (this.supportingPatientInformationTarget == null)
829        this.supportingPatientInformationTarget = new ArrayList<Resource>();
830      return this.supportingPatientInformationTarget;
831    }
832
833    protected void listChildren(List<Property> children) {
834      super.listChildren(children);
835      children.add(new Property("vaccineCode", "CodeableConcept",
836          "Vaccine(s) or vaccine group that pertain to the recommendation.", 0, java.lang.Integer.MAX_VALUE,
837          vaccineCode));
838      children.add(new Property("targetDisease", "CodeableConcept", "The targeted disease for the recommendation.", 0,
839          1, targetDisease));
840      children.add(new Property("contraindicatedVaccineCode", "CodeableConcept",
841          "Vaccine(s) which should not be used to fulfill the recommendation.", 0, java.lang.Integer.MAX_VALUE,
842          contraindicatedVaccineCode));
843      children.add(new Property("forecastStatus", "CodeableConcept",
844          "Indicates the patient status with respect to the path to immunity for the target disease.", 0, 1,
845          forecastStatus));
846      children.add(new Property("forecastReason", "CodeableConcept", "The reason for the assigned forecast status.", 0,
847          java.lang.Integer.MAX_VALUE, forecastReason));
848      children.add(new Property("dateCriterion", "",
849          "Vaccine date recommendations.  For example, earliest date to administer, latest date to administer, etc.", 0,
850          java.lang.Integer.MAX_VALUE, dateCriterion));
851      children.add(new Property("description", "string",
852          "Contains the description about the protocol under which the vaccine was administered.", 0, 1, description));
853      children.add(new Property("series", "string",
854          "One possible path to achieve presumed immunity against a disease - within the context of an authority.", 0,
855          1, series));
856      children.add(new Property("doseNumber[x]", "positiveInt|string",
857          "Nominal position of the recommended dose in a series (e.g. dose 2 is the next recommended dose).", 0, 1,
858          doseNumber));
859      children.add(new Property("seriesDoses[x]", "positiveInt|string",
860          "The recommended number of doses to achieve immunity.", 0, 1, seriesDoses));
861      children.add(new Property("supportingImmunization", "Reference(Immunization|ImmunizationEvaluation)",
862          "Immunization event history and/or evaluation that supports the status and recommendation.", 0,
863          java.lang.Integer.MAX_VALUE, supportingImmunization));
864      children.add(new Property("supportingPatientInformation", "Reference(Any)",
865          "Patient Information that supports the status and recommendation.  This includes patient observations, adverse reactions and allergy/intolerance information.",
866          0, java.lang.Integer.MAX_VALUE, supportingPatientInformation));
867    }
868
869    @Override
870    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
871      switch (_hash) {
872      case 664556354:
873        /* vaccineCode */ return new Property("vaccineCode", "CodeableConcept",
874            "Vaccine(s) or vaccine group that pertain to the recommendation.", 0, java.lang.Integer.MAX_VALUE,
875            vaccineCode);
876      case -319593813:
877        /* targetDisease */ return new Property("targetDisease", "CodeableConcept",
878            "The targeted disease for the recommendation.", 0, 1, targetDisease);
879      case 571105240:
880        /* contraindicatedVaccineCode */ return new Property("contraindicatedVaccineCode", "CodeableConcept",
881            "Vaccine(s) which should not be used to fulfill the recommendation.", 0, java.lang.Integer.MAX_VALUE,
882            contraindicatedVaccineCode);
883      case 1904598477:
884        /* forecastStatus */ return new Property("forecastStatus", "CodeableConcept",
885            "Indicates the patient status with respect to the path to immunity for the target disease.", 0, 1,
886            forecastStatus);
887      case 1862115359:
888        /* forecastReason */ return new Property("forecastReason", "CodeableConcept",
889            "The reason for the assigned forecast status.", 0, java.lang.Integer.MAX_VALUE, forecastReason);
890      case 2087518867:
891        /* dateCriterion */ return new Property("dateCriterion", "",
892            "Vaccine date recommendations.  For example, earliest date to administer, latest date to administer, etc.",
893            0, java.lang.Integer.MAX_VALUE, dateCriterion);
894      case -1724546052:
895        /* description */ return new Property("description", "string",
896            "Contains the description about the protocol under which the vaccine was administered.", 0, 1, description);
897      case -905838985:
898        /* series */ return new Property("series", "string",
899            "One possible path to achieve presumed immunity against a disease - within the context of an authority.", 0,
900            1, series);
901      case -1632295686:
902        /* doseNumber[x] */ return new Property("doseNumber[x]", "positiveInt|string",
903            "Nominal position of the recommended dose in a series (e.g. dose 2 is the next recommended dose).", 0, 1,
904            doseNumber);
905      case -887709242:
906        /* doseNumber */ return new Property("doseNumber[x]", "positiveInt|string",
907            "Nominal position of the recommended dose in a series (e.g. dose 2 is the next recommended dose).", 0, 1,
908            doseNumber);
909      case -1826134640:
910        /* doseNumberPositiveInt */ return new Property("doseNumber[x]", "positiveInt|string",
911            "Nominal position of the recommended dose in a series (e.g. dose 2 is the next recommended dose).", 0, 1,
912            doseNumber);
913      case -333053577:
914        /* doseNumberString */ return new Property("doseNumber[x]", "positiveInt|string",
915            "Nominal position of the recommended dose in a series (e.g. dose 2 is the next recommended dose).", 0, 1,
916            doseNumber);
917      case 1553560673:
918        /* seriesDoses[x] */ return new Property("seriesDoses[x]", "positiveInt|string",
919            "The recommended number of doses to achieve immunity.", 0, 1, seriesDoses);
920      case -1936727105:
921        /* seriesDoses */ return new Property("seriesDoses[x]", "positiveInt|string",
922            "The recommended number of doses to achieve immunity.", 0, 1, seriesDoses);
923      case -220897801:
924        /* seriesDosesPositiveInt */ return new Property("seriesDoses[x]", "positiveInt|string",
925            "The recommended number of doses to achieve immunity.", 0, 1, seriesDoses);
926      case -673569616:
927        /* seriesDosesString */ return new Property("seriesDoses[x]", "positiveInt|string",
928            "The recommended number of doses to achieve immunity.", 0, 1, seriesDoses);
929      case 1171592021:
930        /* supportingImmunization */ return new Property("supportingImmunization",
931            "Reference(Immunization|ImmunizationEvaluation)",
932            "Immunization event history and/or evaluation that supports the status and recommendation.", 0,
933            java.lang.Integer.MAX_VALUE, supportingImmunization);
934      case -1234160646:
935        /* supportingPatientInformation */ return new Property("supportingPatientInformation", "Reference(Any)",
936            "Patient Information that supports the status and recommendation.  This includes patient observations, adverse reactions and allergy/intolerance information.",
937            0, java.lang.Integer.MAX_VALUE, supportingPatientInformation);
938      default:
939        return super.getNamedProperty(_hash, _name, _checkValid);
940      }
941
942    }
943
944    @Override
945    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
946      switch (hash) {
947      case 664556354:
948        /* vaccineCode */ return this.vaccineCode == null ? new Base[0]
949            : this.vaccineCode.toArray(new Base[this.vaccineCode.size()]); // CodeableConcept
950      case -319593813:
951        /* targetDisease */ return this.targetDisease == null ? new Base[0] : new Base[] { this.targetDisease }; // CodeableConcept
952      case 571105240:
953        /* contraindicatedVaccineCode */ return this.contraindicatedVaccineCode == null ? new Base[0]
954            : this.contraindicatedVaccineCode.toArray(new Base[this.contraindicatedVaccineCode.size()]); // CodeableConcept
955      case 1904598477:
956        /* forecastStatus */ return this.forecastStatus == null ? new Base[0] : new Base[] { this.forecastStatus }; // CodeableConcept
957      case 1862115359:
958        /* forecastReason */ return this.forecastReason == null ? new Base[0]
959            : this.forecastReason.toArray(new Base[this.forecastReason.size()]); // CodeableConcept
960      case 2087518867:
961        /* dateCriterion */ return this.dateCriterion == null ? new Base[0]
962            : this.dateCriterion.toArray(new Base[this.dateCriterion.size()]); // ImmunizationRecommendationRecommendationDateCriterionComponent
963      case -1724546052:
964        /* description */ return this.description == null ? new Base[0] : new Base[] { this.description }; // StringType
965      case -905838985:
966        /* series */ return this.series == null ? new Base[0] : new Base[] { this.series }; // StringType
967      case -887709242:
968        /* doseNumber */ return this.doseNumber == null ? new Base[0] : new Base[] { this.doseNumber }; // Type
969      case -1936727105:
970        /* seriesDoses */ return this.seriesDoses == null ? new Base[0] : new Base[] { this.seriesDoses }; // Type
971      case 1171592021:
972        /* supportingImmunization */ return this.supportingImmunization == null ? new Base[0]
973            : this.supportingImmunization.toArray(new Base[this.supportingImmunization.size()]); // Reference
974      case -1234160646:
975        /* supportingPatientInformation */ return this.supportingPatientInformation == null ? new Base[0]
976            : this.supportingPatientInformation.toArray(new Base[this.supportingPatientInformation.size()]); // Reference
977      default:
978        return super.getProperty(hash, name, checkValid);
979      }
980
981    }
982
983    @Override
984    public Base setProperty(int hash, String name, Base value) throws FHIRException {
985      switch (hash) {
986      case 664556354: // vaccineCode
987        this.getVaccineCode().add(castToCodeableConcept(value)); // CodeableConcept
988        return value;
989      case -319593813: // targetDisease
990        this.targetDisease = castToCodeableConcept(value); // CodeableConcept
991        return value;
992      case 571105240: // contraindicatedVaccineCode
993        this.getContraindicatedVaccineCode().add(castToCodeableConcept(value)); // CodeableConcept
994        return value;
995      case 1904598477: // forecastStatus
996        this.forecastStatus = castToCodeableConcept(value); // CodeableConcept
997        return value;
998      case 1862115359: // forecastReason
999        this.getForecastReason().add(castToCodeableConcept(value)); // CodeableConcept
1000        return value;
1001      case 2087518867: // dateCriterion
1002        this.getDateCriterion().add((ImmunizationRecommendationRecommendationDateCriterionComponent) value); // ImmunizationRecommendationRecommendationDateCriterionComponent
1003        return value;
1004      case -1724546052: // description
1005        this.description = castToString(value); // StringType
1006        return value;
1007      case -905838985: // series
1008        this.series = castToString(value); // StringType
1009        return value;
1010      case -887709242: // doseNumber
1011        this.doseNumber = castToType(value); // Type
1012        return value;
1013      case -1936727105: // seriesDoses
1014        this.seriesDoses = castToType(value); // Type
1015        return value;
1016      case 1171592021: // supportingImmunization
1017        this.getSupportingImmunization().add(castToReference(value)); // Reference
1018        return value;
1019      case -1234160646: // supportingPatientInformation
1020        this.getSupportingPatientInformation().add(castToReference(value)); // Reference
1021        return value;
1022      default:
1023        return super.setProperty(hash, name, value);
1024      }
1025
1026    }
1027
1028    @Override
1029    public Base setProperty(String name, Base value) throws FHIRException {
1030      if (name.equals("vaccineCode")) {
1031        this.getVaccineCode().add(castToCodeableConcept(value));
1032      } else if (name.equals("targetDisease")) {
1033        this.targetDisease = castToCodeableConcept(value); // CodeableConcept
1034      } else if (name.equals("contraindicatedVaccineCode")) {
1035        this.getContraindicatedVaccineCode().add(castToCodeableConcept(value));
1036      } else if (name.equals("forecastStatus")) {
1037        this.forecastStatus = castToCodeableConcept(value); // CodeableConcept
1038      } else if (name.equals("forecastReason")) {
1039        this.getForecastReason().add(castToCodeableConcept(value));
1040      } else if (name.equals("dateCriterion")) {
1041        this.getDateCriterion().add((ImmunizationRecommendationRecommendationDateCriterionComponent) value);
1042      } else if (name.equals("description")) {
1043        this.description = castToString(value); // StringType
1044      } else if (name.equals("series")) {
1045        this.series = castToString(value); // StringType
1046      } else if (name.equals("doseNumber[x]")) {
1047        this.doseNumber = castToType(value); // Type
1048      } else if (name.equals("seriesDoses[x]")) {
1049        this.seriesDoses = castToType(value); // Type
1050      } else if (name.equals("supportingImmunization")) {
1051        this.getSupportingImmunization().add(castToReference(value));
1052      } else if (name.equals("supportingPatientInformation")) {
1053        this.getSupportingPatientInformation().add(castToReference(value));
1054      } else
1055        return super.setProperty(name, value);
1056      return value;
1057    }
1058
1059    @Override
1060    public Base makeProperty(int hash, String name) throws FHIRException {
1061      switch (hash) {
1062      case 664556354:
1063        return addVaccineCode();
1064      case -319593813:
1065        return getTargetDisease();
1066      case 571105240:
1067        return addContraindicatedVaccineCode();
1068      case 1904598477:
1069        return getForecastStatus();
1070      case 1862115359:
1071        return addForecastReason();
1072      case 2087518867:
1073        return addDateCriterion();
1074      case -1724546052:
1075        return getDescriptionElement();
1076      case -905838985:
1077        return getSeriesElement();
1078      case -1632295686:
1079        return getDoseNumber();
1080      case -887709242:
1081        return getDoseNumber();
1082      case 1553560673:
1083        return getSeriesDoses();
1084      case -1936727105:
1085        return getSeriesDoses();
1086      case 1171592021:
1087        return addSupportingImmunization();
1088      case -1234160646:
1089        return addSupportingPatientInformation();
1090      default:
1091        return super.makeProperty(hash, name);
1092      }
1093
1094    }
1095
1096    @Override
1097    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1098      switch (hash) {
1099      case 664556354:
1100        /* vaccineCode */ return new String[] { "CodeableConcept" };
1101      case -319593813:
1102        /* targetDisease */ return new String[] { "CodeableConcept" };
1103      case 571105240:
1104        /* contraindicatedVaccineCode */ return new String[] { "CodeableConcept" };
1105      case 1904598477:
1106        /* forecastStatus */ return new String[] { "CodeableConcept" };
1107      case 1862115359:
1108        /* forecastReason */ return new String[] { "CodeableConcept" };
1109      case 2087518867:
1110        /* dateCriterion */ return new String[] {};
1111      case -1724546052:
1112        /* description */ return new String[] { "string" };
1113      case -905838985:
1114        /* series */ return new String[] { "string" };
1115      case -887709242:
1116        /* doseNumber */ return new String[] { "positiveInt", "string" };
1117      case -1936727105:
1118        /* seriesDoses */ return new String[] { "positiveInt", "string" };
1119      case 1171592021:
1120        /* supportingImmunization */ return new String[] { "Reference" };
1121      case -1234160646:
1122        /* supportingPatientInformation */ return new String[] { "Reference" };
1123      default:
1124        return super.getTypesForProperty(hash, name);
1125      }
1126
1127    }
1128
1129    @Override
1130    public Base addChild(String name) throws FHIRException {
1131      if (name.equals("vaccineCode")) {
1132        return addVaccineCode();
1133      } else if (name.equals("targetDisease")) {
1134        this.targetDisease = new CodeableConcept();
1135        return this.targetDisease;
1136      } else if (name.equals("contraindicatedVaccineCode")) {
1137        return addContraindicatedVaccineCode();
1138      } else if (name.equals("forecastStatus")) {
1139        this.forecastStatus = new CodeableConcept();
1140        return this.forecastStatus;
1141      } else if (name.equals("forecastReason")) {
1142        return addForecastReason();
1143      } else if (name.equals("dateCriterion")) {
1144        return addDateCriterion();
1145      } else if (name.equals("description")) {
1146        throw new FHIRException("Cannot call addChild on a singleton property ImmunizationRecommendation.description");
1147      } else if (name.equals("series")) {
1148        throw new FHIRException("Cannot call addChild on a singleton property ImmunizationRecommendation.series");
1149      } else if (name.equals("doseNumberPositiveInt")) {
1150        this.doseNumber = new PositiveIntType();
1151        return this.doseNumber;
1152      } else if (name.equals("doseNumberString")) {
1153        this.doseNumber = new StringType();
1154        return this.doseNumber;
1155      } else if (name.equals("seriesDosesPositiveInt")) {
1156        this.seriesDoses = new PositiveIntType();
1157        return this.seriesDoses;
1158      } else if (name.equals("seriesDosesString")) {
1159        this.seriesDoses = new StringType();
1160        return this.seriesDoses;
1161      } else if (name.equals("supportingImmunization")) {
1162        return addSupportingImmunization();
1163      } else if (name.equals("supportingPatientInformation")) {
1164        return addSupportingPatientInformation();
1165      } else
1166        return super.addChild(name);
1167    }
1168
1169    public ImmunizationRecommendationRecommendationComponent copy() {
1170      ImmunizationRecommendationRecommendationComponent dst = new ImmunizationRecommendationRecommendationComponent();
1171      copyValues(dst);
1172      return dst;
1173    }
1174
1175    public void copyValues(ImmunizationRecommendationRecommendationComponent dst) {
1176      super.copyValues(dst);
1177      if (vaccineCode != null) {
1178        dst.vaccineCode = new ArrayList<CodeableConcept>();
1179        for (CodeableConcept i : vaccineCode)
1180          dst.vaccineCode.add(i.copy());
1181      }
1182      ;
1183      dst.targetDisease = targetDisease == null ? null : targetDisease.copy();
1184      if (contraindicatedVaccineCode != null) {
1185        dst.contraindicatedVaccineCode = new ArrayList<CodeableConcept>();
1186        for (CodeableConcept i : contraindicatedVaccineCode)
1187          dst.contraindicatedVaccineCode.add(i.copy());
1188      }
1189      ;
1190      dst.forecastStatus = forecastStatus == null ? null : forecastStatus.copy();
1191      if (forecastReason != null) {
1192        dst.forecastReason = new ArrayList<CodeableConcept>();
1193        for (CodeableConcept i : forecastReason)
1194          dst.forecastReason.add(i.copy());
1195      }
1196      ;
1197      if (dateCriterion != null) {
1198        dst.dateCriterion = new ArrayList<ImmunizationRecommendationRecommendationDateCriterionComponent>();
1199        for (ImmunizationRecommendationRecommendationDateCriterionComponent i : dateCriterion)
1200          dst.dateCriterion.add(i.copy());
1201      }
1202      ;
1203      dst.description = description == null ? null : description.copy();
1204      dst.series = series == null ? null : series.copy();
1205      dst.doseNumber = doseNumber == null ? null : doseNumber.copy();
1206      dst.seriesDoses = seriesDoses == null ? null : seriesDoses.copy();
1207      if (supportingImmunization != null) {
1208        dst.supportingImmunization = new ArrayList<Reference>();
1209        for (Reference i : supportingImmunization)
1210          dst.supportingImmunization.add(i.copy());
1211      }
1212      ;
1213      if (supportingPatientInformation != null) {
1214        dst.supportingPatientInformation = new ArrayList<Reference>();
1215        for (Reference i : supportingPatientInformation)
1216          dst.supportingPatientInformation.add(i.copy());
1217      }
1218      ;
1219    }
1220
1221    @Override
1222    public boolean equalsDeep(Base other_) {
1223      if (!super.equalsDeep(other_))
1224        return false;
1225      if (!(other_ instanceof ImmunizationRecommendationRecommendationComponent))
1226        return false;
1227      ImmunizationRecommendationRecommendationComponent o = (ImmunizationRecommendationRecommendationComponent) other_;
1228      return compareDeep(vaccineCode, o.vaccineCode, true) && compareDeep(targetDisease, o.targetDisease, true)
1229          && compareDeep(contraindicatedVaccineCode, o.contraindicatedVaccineCode, true)
1230          && compareDeep(forecastStatus, o.forecastStatus, true) && compareDeep(forecastReason, o.forecastReason, true)
1231          && compareDeep(dateCriterion, o.dateCriterion, true) && compareDeep(description, o.description, true)
1232          && compareDeep(series, o.series, true) && compareDeep(doseNumber, o.doseNumber, true)
1233          && compareDeep(seriesDoses, o.seriesDoses, true)
1234          && compareDeep(supportingImmunization, o.supportingImmunization, true)
1235          && compareDeep(supportingPatientInformation, o.supportingPatientInformation, true);
1236    }
1237
1238    @Override
1239    public boolean equalsShallow(Base other_) {
1240      if (!super.equalsShallow(other_))
1241        return false;
1242      if (!(other_ instanceof ImmunizationRecommendationRecommendationComponent))
1243        return false;
1244      ImmunizationRecommendationRecommendationComponent o = (ImmunizationRecommendationRecommendationComponent) other_;
1245      return compareValues(description, o.description, true) && compareValues(series, o.series, true);
1246    }
1247
1248    public boolean isEmpty() {
1249      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(vaccineCode, targetDisease,
1250          contraindicatedVaccineCode, forecastStatus, forecastReason, dateCriterion, description, series, doseNumber,
1251          seriesDoses, supportingImmunization, supportingPatientInformation);
1252    }
1253
1254    public String fhirType() {
1255      return "ImmunizationRecommendation.recommendation";
1256
1257    }
1258
1259  }
1260
1261  @Block()
1262  public static class ImmunizationRecommendationRecommendationDateCriterionComponent extends BackboneElement
1263      implements IBaseBackboneElement {
1264    /**
1265     * Date classification of recommendation. For example, earliest date to give,
1266     * latest date to give, etc.
1267     */
1268    @Child(name = "code", type = {
1269        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
1270    @Description(shortDefinition = "Type of date", formalDefinition = "Date classification of recommendation.  For example, earliest date to give, latest date to give, etc.")
1271    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/immunization-recommendation-date-criterion")
1272    protected CodeableConcept code;
1273
1274    /**
1275     * The date whose meaning is specified by dateCriterion.code.
1276     */
1277    @Child(name = "value", type = {
1278        DateTimeType.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
1279    @Description(shortDefinition = "Recommended date", formalDefinition = "The date whose meaning is specified by dateCriterion.code.")
1280    protected DateTimeType value;
1281
1282    private static final long serialVersionUID = 1036994566L;
1283
1284    /**
1285     * Constructor
1286     */
1287    public ImmunizationRecommendationRecommendationDateCriterionComponent() {
1288      super();
1289    }
1290
1291    /**
1292     * Constructor
1293     */
1294    public ImmunizationRecommendationRecommendationDateCriterionComponent(CodeableConcept code, DateTimeType value) {
1295      super();
1296      this.code = code;
1297      this.value = value;
1298    }
1299
1300    /**
1301     * @return {@link #code} (Date classification of recommendation. For example,
1302     *         earliest date to give, latest date to give, etc.)
1303     */
1304    public CodeableConcept getCode() {
1305      if (this.code == null)
1306        if (Configuration.errorOnAutoCreate())
1307          throw new Error("Attempt to auto-create ImmunizationRecommendationRecommendationDateCriterionComponent.code");
1308        else if (Configuration.doAutoCreate())
1309          this.code = new CodeableConcept(); // cc
1310      return this.code;
1311    }
1312
1313    public boolean hasCode() {
1314      return this.code != null && !this.code.isEmpty();
1315    }
1316
1317    /**
1318     * @param value {@link #code} (Date classification of recommendation. For
1319     *              example, earliest date to give, latest date to give, etc.)
1320     */
1321    public ImmunizationRecommendationRecommendationDateCriterionComponent setCode(CodeableConcept value) {
1322      this.code = value;
1323      return this;
1324    }
1325
1326    /**
1327     * @return {@link #value} (The date whose meaning is specified by
1328     *         dateCriterion.code.). This is the underlying object with id, value
1329     *         and extensions. The accessor "getValue" gives direct access to the
1330     *         value
1331     */
1332    public DateTimeType getValueElement() {
1333      if (this.value == null)
1334        if (Configuration.errorOnAutoCreate())
1335          throw new Error(
1336              "Attempt to auto-create ImmunizationRecommendationRecommendationDateCriterionComponent.value");
1337        else if (Configuration.doAutoCreate())
1338          this.value = new DateTimeType(); // bb
1339      return this.value;
1340    }
1341
1342    public boolean hasValueElement() {
1343      return this.value != null && !this.value.isEmpty();
1344    }
1345
1346    public boolean hasValue() {
1347      return this.value != null && !this.value.isEmpty();
1348    }
1349
1350    /**
1351     * @param value {@link #value} (The date whose meaning is specified by
1352     *              dateCriterion.code.). This is the underlying object with id,
1353     *              value and extensions. The accessor "getValue" gives direct
1354     *              access to the value
1355     */
1356    public ImmunizationRecommendationRecommendationDateCriterionComponent setValueElement(DateTimeType value) {
1357      this.value = value;
1358      return this;
1359    }
1360
1361    /**
1362     * @return The date whose meaning is specified by dateCriterion.code.
1363     */
1364    public Date getValue() {
1365      return this.value == null ? null : this.value.getValue();
1366    }
1367
1368    /**
1369     * @param value The date whose meaning is specified by dateCriterion.code.
1370     */
1371    public ImmunizationRecommendationRecommendationDateCriterionComponent setValue(Date value) {
1372      if (this.value == null)
1373        this.value = new DateTimeType();
1374      this.value.setValue(value);
1375      return this;
1376    }
1377
1378    protected void listChildren(List<Property> children) {
1379      super.listChildren(children);
1380      children.add(new Property("code", "CodeableConcept",
1381          "Date classification of recommendation.  For example, earliest date to give, latest date to give, etc.", 0, 1,
1382          code));
1383      children.add(
1384          new Property("value", "dateTime", "The date whose meaning is specified by dateCriterion.code.", 0, 1, value));
1385    }
1386
1387    @Override
1388    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1389      switch (_hash) {
1390      case 3059181:
1391        /* code */ return new Property("code", "CodeableConcept",
1392            "Date classification of recommendation.  For example, earliest date to give, latest date to give, etc.", 0,
1393            1, code);
1394      case 111972721:
1395        /* value */ return new Property("value", "dateTime",
1396            "The date whose meaning is specified by dateCriterion.code.", 0, 1, value);
1397      default:
1398        return super.getNamedProperty(_hash, _name, _checkValid);
1399      }
1400
1401    }
1402
1403    @Override
1404    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1405      switch (hash) {
1406      case 3059181:
1407        /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
1408      case 111972721:
1409        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // DateTimeType
1410      default:
1411        return super.getProperty(hash, name, checkValid);
1412      }
1413
1414    }
1415
1416    @Override
1417    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1418      switch (hash) {
1419      case 3059181: // code
1420        this.code = castToCodeableConcept(value); // CodeableConcept
1421        return value;
1422      case 111972721: // value
1423        this.value = castToDateTime(value); // DateTimeType
1424        return value;
1425      default:
1426        return super.setProperty(hash, name, value);
1427      }
1428
1429    }
1430
1431    @Override
1432    public Base setProperty(String name, Base value) throws FHIRException {
1433      if (name.equals("code")) {
1434        this.code = castToCodeableConcept(value); // CodeableConcept
1435      } else if (name.equals("value")) {
1436        this.value = castToDateTime(value); // DateTimeType
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 3059181:
1446        return getCode();
1447      case 111972721:
1448        return getValueElement();
1449      default:
1450        return super.makeProperty(hash, name);
1451      }
1452
1453    }
1454
1455    @Override
1456    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1457      switch (hash) {
1458      case 3059181:
1459        /* code */ return new String[] { "CodeableConcept" };
1460      case 111972721:
1461        /* value */ return new String[] { "dateTime" };
1462      default:
1463        return super.getTypesForProperty(hash, name);
1464      }
1465
1466    }
1467
1468    @Override
1469    public Base addChild(String name) throws FHIRException {
1470      if (name.equals("code")) {
1471        this.code = new CodeableConcept();
1472        return this.code;
1473      } else if (name.equals("value")) {
1474        throw new FHIRException("Cannot call addChild on a singleton property ImmunizationRecommendation.value");
1475      } else
1476        return super.addChild(name);
1477    }
1478
1479    public ImmunizationRecommendationRecommendationDateCriterionComponent copy() {
1480      ImmunizationRecommendationRecommendationDateCriterionComponent dst = new ImmunizationRecommendationRecommendationDateCriterionComponent();
1481      copyValues(dst);
1482      return dst;
1483    }
1484
1485    public void copyValues(ImmunizationRecommendationRecommendationDateCriterionComponent dst) {
1486      super.copyValues(dst);
1487      dst.code = code == null ? null : code.copy();
1488      dst.value = value == null ? null : value.copy();
1489    }
1490
1491    @Override
1492    public boolean equalsDeep(Base other_) {
1493      if (!super.equalsDeep(other_))
1494        return false;
1495      if (!(other_ instanceof ImmunizationRecommendationRecommendationDateCriterionComponent))
1496        return false;
1497      ImmunizationRecommendationRecommendationDateCriterionComponent o = (ImmunizationRecommendationRecommendationDateCriterionComponent) other_;
1498      return compareDeep(code, o.code, true) && compareDeep(value, o.value, true);
1499    }
1500
1501    @Override
1502    public boolean equalsShallow(Base other_) {
1503      if (!super.equalsShallow(other_))
1504        return false;
1505      if (!(other_ instanceof ImmunizationRecommendationRecommendationDateCriterionComponent))
1506        return false;
1507      ImmunizationRecommendationRecommendationDateCriterionComponent o = (ImmunizationRecommendationRecommendationDateCriterionComponent) other_;
1508      return compareValues(value, o.value, true);
1509    }
1510
1511    public boolean isEmpty() {
1512      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, value);
1513    }
1514
1515    public String fhirType() {
1516      return "ImmunizationRecommendation.recommendation.dateCriterion";
1517
1518    }
1519
1520  }
1521
1522  /**
1523   * A unique identifier assigned to this particular recommendation record.
1524   */
1525  @Child(name = "identifier", type = {
1526      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1527  @Description(shortDefinition = "Business identifier", formalDefinition = "A unique identifier assigned to this particular recommendation record.")
1528  protected List<Identifier> identifier;
1529
1530  /**
1531   * The patient the recommendation(s) are for.
1532   */
1533  @Child(name = "patient", type = { Patient.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
1534  @Description(shortDefinition = "Who this profile is for", formalDefinition = "The patient the recommendation(s) are for.")
1535  protected Reference patient;
1536
1537  /**
1538   * The actual object that is the target of the reference (The patient the
1539   * recommendation(s) are for.)
1540   */
1541  protected Patient patientTarget;
1542
1543  /**
1544   * The date the immunization recommendation(s) were created.
1545   */
1546  @Child(name = "date", type = { DateTimeType.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
1547  @Description(shortDefinition = "Date recommendation(s) created", formalDefinition = "The date the immunization recommendation(s) were created.")
1548  protected DateTimeType date;
1549
1550  /**
1551   * Indicates the authority who published the protocol (e.g. ACIP).
1552   */
1553  @Child(name = "authority", type = {
1554      Organization.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
1555  @Description(shortDefinition = "Who is responsible for protocol", formalDefinition = "Indicates the authority who published the protocol (e.g. ACIP).")
1556  protected Reference authority;
1557
1558  /**
1559   * The actual object that is the target of the reference (Indicates the
1560   * authority who published the protocol (e.g. ACIP).)
1561   */
1562  protected Organization authorityTarget;
1563
1564  /**
1565   * Vaccine administration recommendations.
1566   */
1567  @Child(name = "recommendation", type = {}, order = 4, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1568  @Description(shortDefinition = "Vaccine administration recommendations", formalDefinition = "Vaccine administration recommendations.")
1569  protected List<ImmunizationRecommendationRecommendationComponent> recommendation;
1570
1571  private static final long serialVersionUID = -2031711761L;
1572
1573  /**
1574   * Constructor
1575   */
1576  public ImmunizationRecommendation() {
1577    super();
1578  }
1579
1580  /**
1581   * Constructor
1582   */
1583  public ImmunizationRecommendation(Reference patient, DateTimeType date) {
1584    super();
1585    this.patient = patient;
1586    this.date = date;
1587  }
1588
1589  /**
1590   * @return {@link #identifier} (A unique identifier assigned to this particular
1591   *         recommendation record.)
1592   */
1593  public List<Identifier> getIdentifier() {
1594    if (this.identifier == null)
1595      this.identifier = new ArrayList<Identifier>();
1596    return this.identifier;
1597  }
1598
1599  /**
1600   * @return Returns a reference to <code>this</code> for easy method chaining
1601   */
1602  public ImmunizationRecommendation setIdentifier(List<Identifier> theIdentifier) {
1603    this.identifier = theIdentifier;
1604    return this;
1605  }
1606
1607  public boolean hasIdentifier() {
1608    if (this.identifier == null)
1609      return false;
1610    for (Identifier item : this.identifier)
1611      if (!item.isEmpty())
1612        return true;
1613    return false;
1614  }
1615
1616  public Identifier addIdentifier() { // 3
1617    Identifier t = new Identifier();
1618    if (this.identifier == null)
1619      this.identifier = new ArrayList<Identifier>();
1620    this.identifier.add(t);
1621    return t;
1622  }
1623
1624  public ImmunizationRecommendation addIdentifier(Identifier t) { // 3
1625    if (t == null)
1626      return this;
1627    if (this.identifier == null)
1628      this.identifier = new ArrayList<Identifier>();
1629    this.identifier.add(t);
1630    return this;
1631  }
1632
1633  /**
1634   * @return The first repetition of repeating field {@link #identifier}, creating
1635   *         it if it does not already exist
1636   */
1637  public Identifier getIdentifierFirstRep() {
1638    if (getIdentifier().isEmpty()) {
1639      addIdentifier();
1640    }
1641    return getIdentifier().get(0);
1642  }
1643
1644  /**
1645   * @return {@link #patient} (The patient the recommendation(s) are for.)
1646   */
1647  public Reference getPatient() {
1648    if (this.patient == null)
1649      if (Configuration.errorOnAutoCreate())
1650        throw new Error("Attempt to auto-create ImmunizationRecommendation.patient");
1651      else if (Configuration.doAutoCreate())
1652        this.patient = new Reference(); // cc
1653    return this.patient;
1654  }
1655
1656  public boolean hasPatient() {
1657    return this.patient != null && !this.patient.isEmpty();
1658  }
1659
1660  /**
1661   * @param value {@link #patient} (The patient the recommendation(s) are for.)
1662   */
1663  public ImmunizationRecommendation setPatient(Reference value) {
1664    this.patient = value;
1665    return this;
1666  }
1667
1668  /**
1669   * @return {@link #patient} The actual object that is the target of the
1670   *         reference. The reference library doesn't populate this, but you can
1671   *         use it to hold the resource if you resolve it. (The patient the
1672   *         recommendation(s) are for.)
1673   */
1674  public Patient getPatientTarget() {
1675    if (this.patientTarget == null)
1676      if (Configuration.errorOnAutoCreate())
1677        throw new Error("Attempt to auto-create ImmunizationRecommendation.patient");
1678      else if (Configuration.doAutoCreate())
1679        this.patientTarget = new Patient(); // aa
1680    return this.patientTarget;
1681  }
1682
1683  /**
1684   * @param value {@link #patient} The actual object that is the target of the
1685   *              reference. The reference library doesn't use these, but you can
1686   *              use it to hold the resource if you resolve it. (The patient the
1687   *              recommendation(s) are for.)
1688   */
1689  public ImmunizationRecommendation setPatientTarget(Patient value) {
1690    this.patientTarget = value;
1691    return this;
1692  }
1693
1694  /**
1695   * @return {@link #date} (The date the immunization recommendation(s) were
1696   *         created.). This is the underlying object with id, value and
1697   *         extensions. The accessor "getDate" gives direct access to the value
1698   */
1699  public DateTimeType getDateElement() {
1700    if (this.date == null)
1701      if (Configuration.errorOnAutoCreate())
1702        throw new Error("Attempt to auto-create ImmunizationRecommendation.date");
1703      else if (Configuration.doAutoCreate())
1704        this.date = new DateTimeType(); // bb
1705    return this.date;
1706  }
1707
1708  public boolean hasDateElement() {
1709    return this.date != null && !this.date.isEmpty();
1710  }
1711
1712  public boolean hasDate() {
1713    return this.date != null && !this.date.isEmpty();
1714  }
1715
1716  /**
1717   * @param value {@link #date} (The date the immunization recommendation(s) were
1718   *              created.). This is the underlying object with id, value and
1719   *              extensions. The accessor "getDate" gives direct access to the
1720   *              value
1721   */
1722  public ImmunizationRecommendation setDateElement(DateTimeType value) {
1723    this.date = value;
1724    return this;
1725  }
1726
1727  /**
1728   * @return The date the immunization recommendation(s) were created.
1729   */
1730  public Date getDate() {
1731    return this.date == null ? null : this.date.getValue();
1732  }
1733
1734  /**
1735   * @param value The date the immunization recommendation(s) were created.
1736   */
1737  public ImmunizationRecommendation setDate(Date value) {
1738    if (this.date == null)
1739      this.date = new DateTimeType();
1740    this.date.setValue(value);
1741    return this;
1742  }
1743
1744  /**
1745   * @return {@link #authority} (Indicates the authority who published the
1746   *         protocol (e.g. ACIP).)
1747   */
1748  public Reference getAuthority() {
1749    if (this.authority == null)
1750      if (Configuration.errorOnAutoCreate())
1751        throw new Error("Attempt to auto-create ImmunizationRecommendation.authority");
1752      else if (Configuration.doAutoCreate())
1753        this.authority = new Reference(); // cc
1754    return this.authority;
1755  }
1756
1757  public boolean hasAuthority() {
1758    return this.authority != null && !this.authority.isEmpty();
1759  }
1760
1761  /**
1762   * @param value {@link #authority} (Indicates the authority who published the
1763   *              protocol (e.g. ACIP).)
1764   */
1765  public ImmunizationRecommendation setAuthority(Reference value) {
1766    this.authority = value;
1767    return this;
1768  }
1769
1770  /**
1771   * @return {@link #authority} The actual object that is the target of the
1772   *         reference. The reference library doesn't populate this, but you can
1773   *         use it to hold the resource if you resolve it. (Indicates the
1774   *         authority who published the protocol (e.g. ACIP).)
1775   */
1776  public Organization getAuthorityTarget() {
1777    if (this.authorityTarget == null)
1778      if (Configuration.errorOnAutoCreate())
1779        throw new Error("Attempt to auto-create ImmunizationRecommendation.authority");
1780      else if (Configuration.doAutoCreate())
1781        this.authorityTarget = new Organization(); // aa
1782    return this.authorityTarget;
1783  }
1784
1785  /**
1786   * @param value {@link #authority} The actual object that is the target of the
1787   *              reference. The reference library doesn't use these, but you can
1788   *              use it to hold the resource if you resolve it. (Indicates the
1789   *              authority who published the protocol (e.g. ACIP).)
1790   */
1791  public ImmunizationRecommendation setAuthorityTarget(Organization value) {
1792    this.authorityTarget = value;
1793    return this;
1794  }
1795
1796  /**
1797   * @return {@link #recommendation} (Vaccine administration recommendations.)
1798   */
1799  public List<ImmunizationRecommendationRecommendationComponent> getRecommendation() {
1800    if (this.recommendation == null)
1801      this.recommendation = new ArrayList<ImmunizationRecommendationRecommendationComponent>();
1802    return this.recommendation;
1803  }
1804
1805  /**
1806   * @return Returns a reference to <code>this</code> for easy method chaining
1807   */
1808  public ImmunizationRecommendation setRecommendation(
1809      List<ImmunizationRecommendationRecommendationComponent> theRecommendation) {
1810    this.recommendation = theRecommendation;
1811    return this;
1812  }
1813
1814  public boolean hasRecommendation() {
1815    if (this.recommendation == null)
1816      return false;
1817    for (ImmunizationRecommendationRecommendationComponent item : this.recommendation)
1818      if (!item.isEmpty())
1819        return true;
1820    return false;
1821  }
1822
1823  public ImmunizationRecommendationRecommendationComponent addRecommendation() { // 3
1824    ImmunizationRecommendationRecommendationComponent t = new ImmunizationRecommendationRecommendationComponent();
1825    if (this.recommendation == null)
1826      this.recommendation = new ArrayList<ImmunizationRecommendationRecommendationComponent>();
1827    this.recommendation.add(t);
1828    return t;
1829  }
1830
1831  public ImmunizationRecommendation addRecommendation(ImmunizationRecommendationRecommendationComponent t) { // 3
1832    if (t == null)
1833      return this;
1834    if (this.recommendation == null)
1835      this.recommendation = new ArrayList<ImmunizationRecommendationRecommendationComponent>();
1836    this.recommendation.add(t);
1837    return this;
1838  }
1839
1840  /**
1841   * @return The first repetition of repeating field {@link #recommendation},
1842   *         creating it if it does not already exist
1843   */
1844  public ImmunizationRecommendationRecommendationComponent getRecommendationFirstRep() {
1845    if (getRecommendation().isEmpty()) {
1846      addRecommendation();
1847    }
1848    return getRecommendation().get(0);
1849  }
1850
1851  protected void listChildren(List<Property> children) {
1852    super.listChildren(children);
1853    children.add(new Property("identifier", "Identifier",
1854        "A unique identifier assigned to this particular recommendation record.", 0, java.lang.Integer.MAX_VALUE,
1855        identifier));
1856    children.add(
1857        new Property("patient", "Reference(Patient)", "The patient the recommendation(s) are for.", 0, 1, patient));
1858    children
1859        .add(new Property("date", "dateTime", "The date the immunization recommendation(s) were created.", 0, 1, date));
1860    children.add(new Property("authority", "Reference(Organization)",
1861        "Indicates the authority who published the protocol (e.g. ACIP).", 0, 1, authority));
1862    children.add(new Property("recommendation", "", "Vaccine administration recommendations.", 0,
1863        java.lang.Integer.MAX_VALUE, recommendation));
1864  }
1865
1866  @Override
1867  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1868    switch (_hash) {
1869    case -1618432855:
1870      /* identifier */ return new Property("identifier", "Identifier",
1871          "A unique identifier assigned to this particular recommendation record.", 0, java.lang.Integer.MAX_VALUE,
1872          identifier);
1873    case -791418107:
1874      /* patient */ return new Property("patient", "Reference(Patient)", "The patient the recommendation(s) are for.",
1875          0, 1, patient);
1876    case 3076014:
1877      /* date */ return new Property("date", "dateTime", "The date the immunization recommendation(s) were created.", 0,
1878          1, date);
1879    case 1475610435:
1880      /* authority */ return new Property("authority", "Reference(Organization)",
1881          "Indicates the authority who published the protocol (e.g. ACIP).", 0, 1, authority);
1882    case -1028636743:
1883      /* recommendation */ return new Property("recommendation", "", "Vaccine administration recommendations.", 0,
1884          java.lang.Integer.MAX_VALUE, recommendation);
1885    default:
1886      return super.getNamedProperty(_hash, _name, _checkValid);
1887    }
1888
1889  }
1890
1891  @Override
1892  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1893    switch (hash) {
1894    case -1618432855:
1895      /* identifier */ return this.identifier == null ? new Base[0]
1896          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1897    case -791418107:
1898      /* patient */ return this.patient == null ? new Base[0] : new Base[] { this.patient }; // Reference
1899    case 3076014:
1900      /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateTimeType
1901    case 1475610435:
1902      /* authority */ return this.authority == null ? new Base[0] : new Base[] { this.authority }; // Reference
1903    case -1028636743:
1904      /* recommendation */ return this.recommendation == null ? new Base[0]
1905          : this.recommendation.toArray(new Base[this.recommendation.size()]); // ImmunizationRecommendationRecommendationComponent
1906    default:
1907      return super.getProperty(hash, name, checkValid);
1908    }
1909
1910  }
1911
1912  @Override
1913  public Base setProperty(int hash, String name, Base value) throws FHIRException {
1914    switch (hash) {
1915    case -1618432855: // identifier
1916      this.getIdentifier().add(castToIdentifier(value)); // Identifier
1917      return value;
1918    case -791418107: // patient
1919      this.patient = castToReference(value); // Reference
1920      return value;
1921    case 3076014: // date
1922      this.date = castToDateTime(value); // DateTimeType
1923      return value;
1924    case 1475610435: // authority
1925      this.authority = castToReference(value); // Reference
1926      return value;
1927    case -1028636743: // recommendation
1928      this.getRecommendation().add((ImmunizationRecommendationRecommendationComponent) value); // ImmunizationRecommendationRecommendationComponent
1929      return value;
1930    default:
1931      return super.setProperty(hash, name, value);
1932    }
1933
1934  }
1935
1936  @Override
1937  public Base setProperty(String name, Base value) throws FHIRException {
1938    if (name.equals("identifier")) {
1939      this.getIdentifier().add(castToIdentifier(value));
1940    } else if (name.equals("patient")) {
1941      this.patient = castToReference(value); // Reference
1942    } else if (name.equals("date")) {
1943      this.date = castToDateTime(value); // DateTimeType
1944    } else if (name.equals("authority")) {
1945      this.authority = castToReference(value); // Reference
1946    } else if (name.equals("recommendation")) {
1947      this.getRecommendation().add((ImmunizationRecommendationRecommendationComponent) value);
1948    } else
1949      return super.setProperty(name, value);
1950    return value;
1951  }
1952
1953  @Override
1954  public Base makeProperty(int hash, String name) throws FHIRException {
1955    switch (hash) {
1956    case -1618432855:
1957      return addIdentifier();
1958    case -791418107:
1959      return getPatient();
1960    case 3076014:
1961      return getDateElement();
1962    case 1475610435:
1963      return getAuthority();
1964    case -1028636743:
1965      return addRecommendation();
1966    default:
1967      return super.makeProperty(hash, name);
1968    }
1969
1970  }
1971
1972  @Override
1973  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1974    switch (hash) {
1975    case -1618432855:
1976      /* identifier */ return new String[] { "Identifier" };
1977    case -791418107:
1978      /* patient */ return new String[] { "Reference" };
1979    case 3076014:
1980      /* date */ return new String[] { "dateTime" };
1981    case 1475610435:
1982      /* authority */ return new String[] { "Reference" };
1983    case -1028636743:
1984      /* recommendation */ return new String[] {};
1985    default:
1986      return super.getTypesForProperty(hash, name);
1987    }
1988
1989  }
1990
1991  @Override
1992  public Base addChild(String name) throws FHIRException {
1993    if (name.equals("identifier")) {
1994      return addIdentifier();
1995    } else if (name.equals("patient")) {
1996      this.patient = new Reference();
1997      return this.patient;
1998    } else if (name.equals("date")) {
1999      throw new FHIRException("Cannot call addChild on a singleton property ImmunizationRecommendation.date");
2000    } else if (name.equals("authority")) {
2001      this.authority = new Reference();
2002      return this.authority;
2003    } else if (name.equals("recommendation")) {
2004      return addRecommendation();
2005    } else
2006      return super.addChild(name);
2007  }
2008
2009  public String fhirType() {
2010    return "ImmunizationRecommendation";
2011
2012  }
2013
2014  public ImmunizationRecommendation copy() {
2015    ImmunizationRecommendation dst = new ImmunizationRecommendation();
2016    copyValues(dst);
2017    return dst;
2018  }
2019
2020  public void copyValues(ImmunizationRecommendation dst) {
2021    super.copyValues(dst);
2022    if (identifier != null) {
2023      dst.identifier = new ArrayList<Identifier>();
2024      for (Identifier i : identifier)
2025        dst.identifier.add(i.copy());
2026    }
2027    ;
2028    dst.patient = patient == null ? null : patient.copy();
2029    dst.date = date == null ? null : date.copy();
2030    dst.authority = authority == null ? null : authority.copy();
2031    if (recommendation != null) {
2032      dst.recommendation = new ArrayList<ImmunizationRecommendationRecommendationComponent>();
2033      for (ImmunizationRecommendationRecommendationComponent i : recommendation)
2034        dst.recommendation.add(i.copy());
2035    }
2036    ;
2037  }
2038
2039  protected ImmunizationRecommendation typedCopy() {
2040    return copy();
2041  }
2042
2043  @Override
2044  public boolean equalsDeep(Base other_) {
2045    if (!super.equalsDeep(other_))
2046      return false;
2047    if (!(other_ instanceof ImmunizationRecommendation))
2048      return false;
2049    ImmunizationRecommendation o = (ImmunizationRecommendation) other_;
2050    return compareDeep(identifier, o.identifier, true) && compareDeep(patient, o.patient, true)
2051        && compareDeep(date, o.date, true) && compareDeep(authority, o.authority, true)
2052        && compareDeep(recommendation, o.recommendation, true);
2053  }
2054
2055  @Override
2056  public boolean equalsShallow(Base other_) {
2057    if (!super.equalsShallow(other_))
2058      return false;
2059    if (!(other_ instanceof ImmunizationRecommendation))
2060      return false;
2061    ImmunizationRecommendation o = (ImmunizationRecommendation) other_;
2062    return compareValues(date, o.date, true);
2063  }
2064
2065  public boolean isEmpty() {
2066    return super.isEmpty()
2067        && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, patient, date, authority, recommendation);
2068  }
2069
2070  @Override
2071  public ResourceType getResourceType() {
2072    return ResourceType.ImmunizationRecommendation;
2073  }
2074
2075  /**
2076   * Search parameter: <b>date</b>
2077   * <p>
2078   * Description: <b>Date recommendation(s) created</b><br>
2079   * Type: <b>date</b><br>
2080   * Path: <b>ImmunizationRecommendation.date</b><br>
2081   * </p>
2082   */
2083  @SearchParamDefinition(name = "date", path = "ImmunizationRecommendation.date", description = "Date recommendation(s) created", type = "date")
2084  public static final String SP_DATE = "date";
2085  /**
2086   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2087   * <p>
2088   * Description: <b>Date recommendation(s) created</b><br>
2089   * Type: <b>date</b><br>
2090   * Path: <b>ImmunizationRecommendation.date</b><br>
2091   * </p>
2092   */
2093  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
2094      SP_DATE);
2095
2096  /**
2097   * Search parameter: <b>identifier</b>
2098   * <p>
2099   * Description: <b>Business identifier</b><br>
2100   * Type: <b>token</b><br>
2101   * Path: <b>ImmunizationRecommendation.identifier</b><br>
2102   * </p>
2103   */
2104  @SearchParamDefinition(name = "identifier", path = "ImmunizationRecommendation.identifier", description = "Business identifier", type = "token")
2105  public static final String SP_IDENTIFIER = "identifier";
2106  /**
2107   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2108   * <p>
2109   * Description: <b>Business identifier</b><br>
2110   * Type: <b>token</b><br>
2111   * Path: <b>ImmunizationRecommendation.identifier</b><br>
2112   * </p>
2113   */
2114  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2115      SP_IDENTIFIER);
2116
2117  /**
2118   * Search parameter: <b>target-disease</b>
2119   * <p>
2120   * Description: <b>Disease to be immunized against</b><br>
2121   * Type: <b>token</b><br>
2122   * Path: <b>ImmunizationRecommendation.recommendation.targetDisease</b><br>
2123   * </p>
2124   */
2125  @SearchParamDefinition(name = "target-disease", path = "ImmunizationRecommendation.recommendation.targetDisease", description = "Disease to be immunized against", type = "token")
2126  public static final String SP_TARGET_DISEASE = "target-disease";
2127  /**
2128   * <b>Fluent Client</b> search parameter constant for <b>target-disease</b>
2129   * <p>
2130   * Description: <b>Disease to be immunized against</b><br>
2131   * Type: <b>token</b><br>
2132   * Path: <b>ImmunizationRecommendation.recommendation.targetDisease</b><br>
2133   * </p>
2134   */
2135  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TARGET_DISEASE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2136      SP_TARGET_DISEASE);
2137
2138  /**
2139   * Search parameter: <b>patient</b>
2140   * <p>
2141   * Description: <b>Who this profile is for</b><br>
2142   * Type: <b>reference</b><br>
2143   * Path: <b>ImmunizationRecommendation.patient</b><br>
2144   * </p>
2145   */
2146  @SearchParamDefinition(name = "patient", path = "ImmunizationRecommendation.patient", description = "Who this profile is for", type = "reference", providesMembershipIn = {
2147      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Patient.class })
2148  public static final String SP_PATIENT = "patient";
2149  /**
2150   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2151   * <p>
2152   * Description: <b>Who this profile is for</b><br>
2153   * Type: <b>reference</b><br>
2154   * Path: <b>ImmunizationRecommendation.patient</b><br>
2155   * </p>
2156   */
2157  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2158      SP_PATIENT);
2159
2160  /**
2161   * Constant for fluent queries to be used to add include statements. Specifies
2162   * the path value of "<b>ImmunizationRecommendation:patient</b>".
2163   */
2164  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
2165      "ImmunizationRecommendation:patient").toLocked();
2166
2167  /**
2168   * Search parameter: <b>vaccine-type</b>
2169   * <p>
2170   * Description: <b>Vaccine or vaccine group recommendation applies to</b><br>
2171   * Type: <b>token</b><br>
2172   * Path: <b>ImmunizationRecommendation.recommendation.vaccineCode</b><br>
2173   * </p>
2174   */
2175  @SearchParamDefinition(name = "vaccine-type", path = "ImmunizationRecommendation.recommendation.vaccineCode", description = "Vaccine  or vaccine group recommendation applies to", type = "token")
2176  public static final String SP_VACCINE_TYPE = "vaccine-type";
2177  /**
2178   * <b>Fluent Client</b> search parameter constant for <b>vaccine-type</b>
2179   * <p>
2180   * Description: <b>Vaccine or vaccine group recommendation applies to</b><br>
2181   * Type: <b>token</b><br>
2182   * Path: <b>ImmunizationRecommendation.recommendation.vaccineCode</b><br>
2183   * </p>
2184   */
2185  public static final ca.uhn.fhir.rest.gclient.TokenClientParam VACCINE_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2186      SP_VACCINE_TYPE);
2187
2188  /**
2189   * Search parameter: <b>information</b>
2190   * <p>
2191   * Description: <b>Patient observations supporting recommendation</b><br>
2192   * Type: <b>reference</b><br>
2193   * Path:
2194   * <b>ImmunizationRecommendation.recommendation.supportingPatientInformation</b><br>
2195   * </p>
2196   */
2197  @SearchParamDefinition(name = "information", path = "ImmunizationRecommendation.recommendation.supportingPatientInformation", description = "Patient observations supporting recommendation", type = "reference")
2198  public static final String SP_INFORMATION = "information";
2199  /**
2200   * <b>Fluent Client</b> search parameter constant for <b>information</b>
2201   * <p>
2202   * Description: <b>Patient observations supporting recommendation</b><br>
2203   * Type: <b>reference</b><br>
2204   * Path:
2205   * <b>ImmunizationRecommendation.recommendation.supportingPatientInformation</b><br>
2206   * </p>
2207   */
2208  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INFORMATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2209      SP_INFORMATION);
2210
2211  /**
2212   * Constant for fluent queries to be used to add include statements. Specifies
2213   * the path value of "<b>ImmunizationRecommendation:information</b>".
2214   */
2215  public static final ca.uhn.fhir.model.api.Include INCLUDE_INFORMATION = new ca.uhn.fhir.model.api.Include(
2216      "ImmunizationRecommendation:information").toLocked();
2217
2218  /**
2219   * Search parameter: <b>support</b>
2220   * <p>
2221   * Description: <b>Past immunizations supporting recommendation</b><br>
2222   * Type: <b>reference</b><br>
2223   * Path:
2224   * <b>ImmunizationRecommendation.recommendation.supportingImmunization</b><br>
2225   * </p>
2226   */
2227  @SearchParamDefinition(name = "support", path = "ImmunizationRecommendation.recommendation.supportingImmunization", description = "Past immunizations supporting recommendation", type = "reference", target = {
2228      Immunization.class, ImmunizationEvaluation.class })
2229  public static final String SP_SUPPORT = "support";
2230  /**
2231   * <b>Fluent Client</b> search parameter constant for <b>support</b>
2232   * <p>
2233   * Description: <b>Past immunizations supporting recommendation</b><br>
2234   * Type: <b>reference</b><br>
2235   * Path:
2236   * <b>ImmunizationRecommendation.recommendation.supportingImmunization</b><br>
2237   * </p>
2238   */
2239  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUPPORT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2240      SP_SUPPORT);
2241
2242  /**
2243   * Constant for fluent queries to be used to add include statements. Specifies
2244   * the path value of "<b>ImmunizationRecommendation:support</b>".
2245   */
2246  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUPPORT = new ca.uhn.fhir.model.api.Include(
2247      "ImmunizationRecommendation:support").toLocked();
2248
2249  /**
2250   * Search parameter: <b>status</b>
2251   * <p>
2252   * Description: <b>Vaccine recommendation status</b><br>
2253   * Type: <b>token</b><br>
2254   * Path: <b>ImmunizationRecommendation.recommendation.forecastStatus</b><br>
2255   * </p>
2256   */
2257  @SearchParamDefinition(name = "status", path = "ImmunizationRecommendation.recommendation.forecastStatus", description = "Vaccine recommendation status", type = "token")
2258  public static final String SP_STATUS = "status";
2259  /**
2260   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2261   * <p>
2262   * Description: <b>Vaccine recommendation status</b><br>
2263   * Type: <b>token</b><br>
2264   * Path: <b>ImmunizationRecommendation.recommendation.forecastStatus</b><br>
2265   * </p>
2266   */
2267  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2268      SP_STATUS);
2269
2270}