001package org.hl7.fhir.instance.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
033import java.util.*;
034
035import org.hl7.fhir.exceptions.FHIRException;
036import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
037import org.hl7.fhir.utilities.Utilities;
038
039import ca.uhn.fhir.model.api.annotation.*;
040/**
041 * A patient's point-in-time immunization and recommendation (i.e. forecasting a patient's immunization eligibility according to a published schedule) with optional supporting justification.
042 */
043@ResourceDef(name="ImmunizationRecommendation", profile="http://hl7.org/fhir/Profile/ImmunizationRecommendation")
044public class ImmunizationRecommendation extends DomainResource {
045
046    @Block()
047    public static class ImmunizationRecommendationRecommendationComponent extends BackboneElement implements IBaseBackboneElement {
048        /**
049         * The date the immunization recommendation was created.
050         */
051        @Child(name = "date", type = {DateTimeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
052        @Description(shortDefinition="Date recommendation created", formalDefinition="The date the immunization recommendation was created." )
053        protected DateTimeType date;
054
055        /**
056         * Vaccine that pertains to the recommendation.
057         */
058        @Child(name = "vaccineCode", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true)
059        @Description(shortDefinition="Vaccine recommendation applies to", formalDefinition="Vaccine that pertains to the recommendation." )
060        protected CodeableConcept vaccineCode;
061
062        /**
063         * This indicates the next recommended dose number (e.g. dose 2 is the next recommended dose).
064         */
065        @Child(name = "doseNumber", type = {PositiveIntType.class}, order=3, min=0, max=1, modifier=false, summary=true)
066        @Description(shortDefinition="Recommended dose number", formalDefinition="This indicates the next recommended dose number (e.g. dose 2 is the next recommended dose)." )
067        protected PositiveIntType doseNumber;
068
069        /**
070         * Vaccine administration status.
071         */
072        @Child(name = "forecastStatus", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=true)
073        @Description(shortDefinition="Vaccine administration status", formalDefinition="Vaccine administration status." )
074        protected CodeableConcept forecastStatus;
075
076        /**
077         * Vaccine date recommendations.  For example, earliest date to administer, latest date to administer, etc.
078         */
079        @Child(name = "dateCriterion", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
080        @Description(shortDefinition="Dates governing proposed immunization", formalDefinition="Vaccine date recommendations.  For example, earliest date to administer, latest date to administer, etc." )
081        protected List<ImmunizationRecommendationRecommendationDateCriterionComponent> dateCriterion;
082
083        /**
084         * Contains information about the protocol under which the vaccine was administered.
085         */
086        @Child(name = "protocol", type = {}, order=6, min=0, max=1, modifier=false, summary=false)
087        @Description(shortDefinition="Protocol used by recommendation", formalDefinition="Contains information about the protocol under which the vaccine was administered." )
088        protected ImmunizationRecommendationRecommendationProtocolComponent protocol;
089
090        /**
091         * Immunization event history that supports the status and recommendation.
092         */
093        @Child(name = "supportingImmunization", type = {Immunization.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
094        @Description(shortDefinition="Past immunizations supporting recommendation", formalDefinition="Immunization event history that supports the status and recommendation." )
095        protected List<Reference> supportingImmunization;
096        /**
097         * The actual objects that are the target of the reference (Immunization event history that supports the status and recommendation.)
098         */
099        protected List<Immunization> supportingImmunizationTarget;
100
101
102        /**
103         * Patient Information that supports the status and recommendation.  This includes patient observations, adverse reactions and allergy/intolerance information.
104         */
105        @Child(name = "supportingPatientInformation", type = {Observation.class, AllergyIntolerance.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
106        @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." )
107        protected List<Reference> supportingPatientInformation;
108        /**
109         * The actual objects that are the target of the reference (Patient Information that supports the status and recommendation.  This includes patient observations, adverse reactions and allergy/intolerance information.)
110         */
111        protected List<Resource> supportingPatientInformationTarget;
112
113
114        private static final long serialVersionUID = 1501347482L;
115
116    /*
117     * Constructor
118     */
119      public ImmunizationRecommendationRecommendationComponent() {
120        super();
121      }
122
123    /*
124     * Constructor
125     */
126      public ImmunizationRecommendationRecommendationComponent(DateTimeType date, CodeableConcept vaccineCode, CodeableConcept forecastStatus) {
127        super();
128        this.date = date;
129        this.vaccineCode = vaccineCode;
130        this.forecastStatus = forecastStatus;
131      }
132
133        /**
134         * @return {@link #date} (The date the immunization recommendation was created.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
135         */
136        public DateTimeType getDateElement() { 
137          if (this.date == null)
138            if (Configuration.errorOnAutoCreate())
139              throw new Error("Attempt to auto-create ImmunizationRecommendationRecommendationComponent.date");
140            else if (Configuration.doAutoCreate())
141              this.date = new DateTimeType(); // bb
142          return this.date;
143        }
144
145        public boolean hasDateElement() { 
146          return this.date != null && !this.date.isEmpty();
147        }
148
149        public boolean hasDate() { 
150          return this.date != null && !this.date.isEmpty();
151        }
152
153        /**
154         * @param value {@link #date} (The date the immunization recommendation was created.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
155         */
156        public ImmunizationRecommendationRecommendationComponent setDateElement(DateTimeType value) { 
157          this.date = value;
158          return this;
159        }
160
161        /**
162         * @return The date the immunization recommendation was created.
163         */
164        public Date getDate() { 
165          return this.date == null ? null : this.date.getValue();
166        }
167
168        /**
169         * @param value The date the immunization recommendation was created.
170         */
171        public ImmunizationRecommendationRecommendationComponent setDate(Date value) { 
172            if (this.date == null)
173              this.date = new DateTimeType();
174            this.date.setValue(value);
175          return this;
176        }
177
178        /**
179         * @return {@link #vaccineCode} (Vaccine that pertains to the recommendation.)
180         */
181        public CodeableConcept getVaccineCode() { 
182          if (this.vaccineCode == null)
183            if (Configuration.errorOnAutoCreate())
184              throw new Error("Attempt to auto-create ImmunizationRecommendationRecommendationComponent.vaccineCode");
185            else if (Configuration.doAutoCreate())
186              this.vaccineCode = new CodeableConcept(); // cc
187          return this.vaccineCode;
188        }
189
190        public boolean hasVaccineCode() { 
191          return this.vaccineCode != null && !this.vaccineCode.isEmpty();
192        }
193
194        /**
195         * @param value {@link #vaccineCode} (Vaccine that pertains to the recommendation.)
196         */
197        public ImmunizationRecommendationRecommendationComponent setVaccineCode(CodeableConcept value) { 
198          this.vaccineCode = value;
199          return this;
200        }
201
202        /**
203         * @return {@link #doseNumber} (This indicates the next recommended dose number (e.g. dose 2 is the next recommended dose).). This is the underlying object with id, value and extensions. The accessor "getDoseNumber" gives direct access to the value
204         */
205        public PositiveIntType getDoseNumberElement() { 
206          if (this.doseNumber == null)
207            if (Configuration.errorOnAutoCreate())
208              throw new Error("Attempt to auto-create ImmunizationRecommendationRecommendationComponent.doseNumber");
209            else if (Configuration.doAutoCreate())
210              this.doseNumber = new PositiveIntType(); // bb
211          return this.doseNumber;
212        }
213
214        public boolean hasDoseNumberElement() { 
215          return this.doseNumber != null && !this.doseNumber.isEmpty();
216        }
217
218        public boolean hasDoseNumber() { 
219          return this.doseNumber != null && !this.doseNumber.isEmpty();
220        }
221
222        /**
223         * @param value {@link #doseNumber} (This indicates the next recommended dose number (e.g. dose 2 is the next recommended dose).). This is the underlying object with id, value and extensions. The accessor "getDoseNumber" gives direct access to the value
224         */
225        public ImmunizationRecommendationRecommendationComponent setDoseNumberElement(PositiveIntType value) { 
226          this.doseNumber = value;
227          return this;
228        }
229
230        /**
231         * @return This indicates the next recommended dose number (e.g. dose 2 is the next recommended dose).
232         */
233        public int getDoseNumber() { 
234          return this.doseNumber == null || this.doseNumber.isEmpty() ? 0 : this.doseNumber.getValue();
235        }
236
237        /**
238         * @param value This indicates the next recommended dose number (e.g. dose 2 is the next recommended dose).
239         */
240        public ImmunizationRecommendationRecommendationComponent setDoseNumber(int value) { 
241            if (this.doseNumber == null)
242              this.doseNumber = new PositiveIntType();
243            this.doseNumber.setValue(value);
244          return this;
245        }
246
247        /**
248         * @return {@link #forecastStatus} (Vaccine administration status.)
249         */
250        public CodeableConcept getForecastStatus() { 
251          if (this.forecastStatus == null)
252            if (Configuration.errorOnAutoCreate())
253              throw new Error("Attempt to auto-create ImmunizationRecommendationRecommendationComponent.forecastStatus");
254            else if (Configuration.doAutoCreate())
255              this.forecastStatus = new CodeableConcept(); // cc
256          return this.forecastStatus;
257        }
258
259        public boolean hasForecastStatus() { 
260          return this.forecastStatus != null && !this.forecastStatus.isEmpty();
261        }
262
263        /**
264         * @param value {@link #forecastStatus} (Vaccine administration status.)
265         */
266        public ImmunizationRecommendationRecommendationComponent setForecastStatus(CodeableConcept value) { 
267          this.forecastStatus = value;
268          return this;
269        }
270
271        /**
272         * @return {@link #dateCriterion} (Vaccine date recommendations.  For example, earliest date to administer, latest date to administer, etc.)
273         */
274        public List<ImmunizationRecommendationRecommendationDateCriterionComponent> getDateCriterion() { 
275          if (this.dateCriterion == null)
276            this.dateCriterion = new ArrayList<ImmunizationRecommendationRecommendationDateCriterionComponent>();
277          return this.dateCriterion;
278        }
279
280        public boolean hasDateCriterion() { 
281          if (this.dateCriterion == null)
282            return false;
283          for (ImmunizationRecommendationRecommendationDateCriterionComponent item : this.dateCriterion)
284            if (!item.isEmpty())
285              return true;
286          return false;
287        }
288
289        /**
290         * @return {@link #dateCriterion} (Vaccine date recommendations.  For example, earliest date to administer, latest date to administer, etc.)
291         */
292    // syntactic sugar
293        public ImmunizationRecommendationRecommendationDateCriterionComponent addDateCriterion() { //3
294          ImmunizationRecommendationRecommendationDateCriterionComponent t = new ImmunizationRecommendationRecommendationDateCriterionComponent();
295          if (this.dateCriterion == null)
296            this.dateCriterion = new ArrayList<ImmunizationRecommendationRecommendationDateCriterionComponent>();
297          this.dateCriterion.add(t);
298          return t;
299        }
300
301    // syntactic sugar
302        public ImmunizationRecommendationRecommendationComponent addDateCriterion(ImmunizationRecommendationRecommendationDateCriterionComponent t) { //3
303          if (t == null)
304            return this;
305          if (this.dateCriterion == null)
306            this.dateCriterion = new ArrayList<ImmunizationRecommendationRecommendationDateCriterionComponent>();
307          this.dateCriterion.add(t);
308          return this;
309        }
310
311        /**
312         * @return {@link #protocol} (Contains information about the protocol under which the vaccine was administered.)
313         */
314        public ImmunizationRecommendationRecommendationProtocolComponent getProtocol() { 
315          if (this.protocol == null)
316            if (Configuration.errorOnAutoCreate())
317              throw new Error("Attempt to auto-create ImmunizationRecommendationRecommendationComponent.protocol");
318            else if (Configuration.doAutoCreate())
319              this.protocol = new ImmunizationRecommendationRecommendationProtocolComponent(); // cc
320          return this.protocol;
321        }
322
323        public boolean hasProtocol() { 
324          return this.protocol != null && !this.protocol.isEmpty();
325        }
326
327        /**
328         * @param value {@link #protocol} (Contains information about the protocol under which the vaccine was administered.)
329         */
330        public ImmunizationRecommendationRecommendationComponent setProtocol(ImmunizationRecommendationRecommendationProtocolComponent value) { 
331          this.protocol = value;
332          return this;
333        }
334
335        /**
336         * @return {@link #supportingImmunization} (Immunization event history that supports the status and recommendation.)
337         */
338        public List<Reference> getSupportingImmunization() { 
339          if (this.supportingImmunization == null)
340            this.supportingImmunization = new ArrayList<Reference>();
341          return this.supportingImmunization;
342        }
343
344        public boolean hasSupportingImmunization() { 
345          if (this.supportingImmunization == null)
346            return false;
347          for (Reference item : this.supportingImmunization)
348            if (!item.isEmpty())
349              return true;
350          return false;
351        }
352
353        /**
354         * @return {@link #supportingImmunization} (Immunization event history that supports the status and recommendation.)
355         */
356    // syntactic sugar
357        public Reference addSupportingImmunization() { //3
358          Reference t = new Reference();
359          if (this.supportingImmunization == null)
360            this.supportingImmunization = new ArrayList<Reference>();
361          this.supportingImmunization.add(t);
362          return t;
363        }
364
365    // syntactic sugar
366        public ImmunizationRecommendationRecommendationComponent addSupportingImmunization(Reference t) { //3
367          if (t == null)
368            return this;
369          if (this.supportingImmunization == null)
370            this.supportingImmunization = new ArrayList<Reference>();
371          this.supportingImmunization.add(t);
372          return this;
373        }
374
375        /**
376         * @return {@link #supportingImmunization} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Immunization event history that supports the status and recommendation.)
377         */
378        public List<Immunization> getSupportingImmunizationTarget() { 
379          if (this.supportingImmunizationTarget == null)
380            this.supportingImmunizationTarget = new ArrayList<Immunization>();
381          return this.supportingImmunizationTarget;
382        }
383
384    // syntactic sugar
385        /**
386         * @return {@link #supportingImmunization} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. Immunization event history that supports the status and recommendation.)
387         */
388        public Immunization addSupportingImmunizationTarget() { 
389          Immunization r = new Immunization();
390          if (this.supportingImmunizationTarget == null)
391            this.supportingImmunizationTarget = new ArrayList<Immunization>();
392          this.supportingImmunizationTarget.add(r);
393          return r;
394        }
395
396        /**
397         * @return {@link #supportingPatientInformation} (Patient Information that supports the status and recommendation.  This includes patient observations, adverse reactions and allergy/intolerance information.)
398         */
399        public List<Reference> getSupportingPatientInformation() { 
400          if (this.supportingPatientInformation == null)
401            this.supportingPatientInformation = new ArrayList<Reference>();
402          return this.supportingPatientInformation;
403        }
404
405        public boolean hasSupportingPatientInformation() { 
406          if (this.supportingPatientInformation == null)
407            return false;
408          for (Reference item : this.supportingPatientInformation)
409            if (!item.isEmpty())
410              return true;
411          return false;
412        }
413
414        /**
415         * @return {@link #supportingPatientInformation} (Patient Information that supports the status and recommendation.  This includes patient observations, adverse reactions and allergy/intolerance information.)
416         */
417    // syntactic sugar
418        public Reference addSupportingPatientInformation() { //3
419          Reference t = new Reference();
420          if (this.supportingPatientInformation == null)
421            this.supportingPatientInformation = new ArrayList<Reference>();
422          this.supportingPatientInformation.add(t);
423          return t;
424        }
425
426    // syntactic sugar
427        public ImmunizationRecommendationRecommendationComponent addSupportingPatientInformation(Reference t) { //3
428          if (t == null)
429            return this;
430          if (this.supportingPatientInformation == null)
431            this.supportingPatientInformation = new ArrayList<Reference>();
432          this.supportingPatientInformation.add(t);
433          return this;
434        }
435
436        /**
437         * @return {@link #supportingPatientInformation} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Patient Information that supports the status and recommendation.  This includes patient observations, adverse reactions and allergy/intolerance information.)
438         */
439        public List<Resource> getSupportingPatientInformationTarget() { 
440          if (this.supportingPatientInformationTarget == null)
441            this.supportingPatientInformationTarget = new ArrayList<Resource>();
442          return this.supportingPatientInformationTarget;
443        }
444
445        protected void listChildren(List<Property> childrenList) {
446          super.listChildren(childrenList);
447          childrenList.add(new Property("date", "dateTime", "The date the immunization recommendation was created.", 0, java.lang.Integer.MAX_VALUE, date));
448          childrenList.add(new Property("vaccineCode", "CodeableConcept", "Vaccine that pertains to the recommendation.", 0, java.lang.Integer.MAX_VALUE, vaccineCode));
449          childrenList.add(new Property("doseNumber", "positiveInt", "This indicates the next recommended dose number (e.g. dose 2 is the next recommended dose).", 0, java.lang.Integer.MAX_VALUE, doseNumber));
450          childrenList.add(new Property("forecastStatus", "CodeableConcept", "Vaccine administration status.", 0, java.lang.Integer.MAX_VALUE, forecastStatus));
451          childrenList.add(new Property("dateCriterion", "", "Vaccine date recommendations.  For example, earliest date to administer, latest date to administer, etc.", 0, java.lang.Integer.MAX_VALUE, dateCriterion));
452          childrenList.add(new Property("protocol", "", "Contains information about the protocol under which the vaccine was administered.", 0, java.lang.Integer.MAX_VALUE, protocol));
453          childrenList.add(new Property("supportingImmunization", "Reference(Immunization)", "Immunization event history that supports the status and recommendation.", 0, java.lang.Integer.MAX_VALUE, supportingImmunization));
454          childrenList.add(new Property("supportingPatientInformation", "Reference(Observation|AllergyIntolerance)", "Patient Information that supports the status and recommendation.  This includes patient observations, adverse reactions and allergy/intolerance information.", 0, java.lang.Integer.MAX_VALUE, supportingPatientInformation));
455        }
456
457      @Override
458      public void setProperty(String name, Base value) throws FHIRException {
459        if (name.equals("date"))
460          this.date = castToDateTime(value); // DateTimeType
461        else if (name.equals("vaccineCode"))
462          this.vaccineCode = castToCodeableConcept(value); // CodeableConcept
463        else if (name.equals("doseNumber"))
464          this.doseNumber = castToPositiveInt(value); // PositiveIntType
465        else if (name.equals("forecastStatus"))
466          this.forecastStatus = castToCodeableConcept(value); // CodeableConcept
467        else if (name.equals("dateCriterion"))
468          this.getDateCriterion().add((ImmunizationRecommendationRecommendationDateCriterionComponent) value);
469        else if (name.equals("protocol"))
470          this.protocol = (ImmunizationRecommendationRecommendationProtocolComponent) value; // ImmunizationRecommendationRecommendationProtocolComponent
471        else if (name.equals("supportingImmunization"))
472          this.getSupportingImmunization().add(castToReference(value));
473        else if (name.equals("supportingPatientInformation"))
474          this.getSupportingPatientInformation().add(castToReference(value));
475        else
476          super.setProperty(name, value);
477      }
478
479      @Override
480      public Base addChild(String name) throws FHIRException {
481        if (name.equals("date")) {
482          throw new FHIRException("Cannot call addChild on a primitive type ImmunizationRecommendation.date");
483        }
484        else if (name.equals("vaccineCode")) {
485          this.vaccineCode = new CodeableConcept();
486          return this.vaccineCode;
487        }
488        else if (name.equals("doseNumber")) {
489          throw new FHIRException("Cannot call addChild on a primitive type ImmunizationRecommendation.doseNumber");
490        }
491        else if (name.equals("forecastStatus")) {
492          this.forecastStatus = new CodeableConcept();
493          return this.forecastStatus;
494        }
495        else if (name.equals("dateCriterion")) {
496          return addDateCriterion();
497        }
498        else if (name.equals("protocol")) {
499          this.protocol = new ImmunizationRecommendationRecommendationProtocolComponent();
500          return this.protocol;
501        }
502        else if (name.equals("supportingImmunization")) {
503          return addSupportingImmunization();
504        }
505        else if (name.equals("supportingPatientInformation")) {
506          return addSupportingPatientInformation();
507        }
508        else
509          return super.addChild(name);
510      }
511
512      public ImmunizationRecommendationRecommendationComponent copy() {
513        ImmunizationRecommendationRecommendationComponent dst = new ImmunizationRecommendationRecommendationComponent();
514        copyValues(dst);
515        dst.date = date == null ? null : date.copy();
516        dst.vaccineCode = vaccineCode == null ? null : vaccineCode.copy();
517        dst.doseNumber = doseNumber == null ? null : doseNumber.copy();
518        dst.forecastStatus = forecastStatus == null ? null : forecastStatus.copy();
519        if (dateCriterion != null) {
520          dst.dateCriterion = new ArrayList<ImmunizationRecommendationRecommendationDateCriterionComponent>();
521          for (ImmunizationRecommendationRecommendationDateCriterionComponent i : dateCriterion)
522            dst.dateCriterion.add(i.copy());
523        };
524        dst.protocol = protocol == null ? null : protocol.copy();
525        if (supportingImmunization != null) {
526          dst.supportingImmunization = new ArrayList<Reference>();
527          for (Reference i : supportingImmunization)
528            dst.supportingImmunization.add(i.copy());
529        };
530        if (supportingPatientInformation != null) {
531          dst.supportingPatientInformation = new ArrayList<Reference>();
532          for (Reference i : supportingPatientInformation)
533            dst.supportingPatientInformation.add(i.copy());
534        };
535        return dst;
536      }
537
538      @Override
539      public boolean equalsDeep(Base other) {
540        if (!super.equalsDeep(other))
541          return false;
542        if (!(other instanceof ImmunizationRecommendationRecommendationComponent))
543          return false;
544        ImmunizationRecommendationRecommendationComponent o = (ImmunizationRecommendationRecommendationComponent) other;
545        return compareDeep(date, o.date, true) && compareDeep(vaccineCode, o.vaccineCode, true) && compareDeep(doseNumber, o.doseNumber, true)
546           && compareDeep(forecastStatus, o.forecastStatus, true) && compareDeep(dateCriterion, o.dateCriterion, true)
547           && compareDeep(protocol, o.protocol, true) && compareDeep(supportingImmunization, o.supportingImmunization, true)
548           && compareDeep(supportingPatientInformation, o.supportingPatientInformation, true);
549      }
550
551      @Override
552      public boolean equalsShallow(Base other) {
553        if (!super.equalsShallow(other))
554          return false;
555        if (!(other instanceof ImmunizationRecommendationRecommendationComponent))
556          return false;
557        ImmunizationRecommendationRecommendationComponent o = (ImmunizationRecommendationRecommendationComponent) other;
558        return compareValues(date, o.date, true) && compareValues(doseNumber, o.doseNumber, true);
559      }
560
561      public boolean isEmpty() {
562        return super.isEmpty() && (date == null || date.isEmpty()) && (vaccineCode == null || vaccineCode.isEmpty())
563           && (doseNumber == null || doseNumber.isEmpty()) && (forecastStatus == null || forecastStatus.isEmpty())
564           && (dateCriterion == null || dateCriterion.isEmpty()) && (protocol == null || protocol.isEmpty())
565           && (supportingImmunization == null || supportingImmunization.isEmpty()) && (supportingPatientInformation == null || supportingPatientInformation.isEmpty())
566          ;
567      }
568
569  public String fhirType() {
570    return "ImmunizationRecommendation.recommendation";
571
572  }
573
574  }
575
576    @Block()
577    public static class ImmunizationRecommendationRecommendationDateCriterionComponent extends BackboneElement implements IBaseBackboneElement {
578        /**
579         * Date classification of recommendation.  For example, earliest date to give, latest date to give, etc.
580         */
581        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
582        @Description(shortDefinition="Type of date", formalDefinition="Date classification of recommendation.  For example, earliest date to give, latest date to give, etc." )
583        protected CodeableConcept code;
584
585        /**
586         * The date whose meaning is specified by dateCriterion.code.
587         */
588        @Child(name = "value", type = {DateTimeType.class}, order=2, min=1, max=1, modifier=false, summary=false)
589        @Description(shortDefinition="Recommended date", formalDefinition="The date whose meaning is specified by dateCriterion.code." )
590        protected DateTimeType value;
591
592        private static final long serialVersionUID = 1036994566L;
593
594    /*
595     * Constructor
596     */
597      public ImmunizationRecommendationRecommendationDateCriterionComponent() {
598        super();
599      }
600
601    /*
602     * Constructor
603     */
604      public ImmunizationRecommendationRecommendationDateCriterionComponent(CodeableConcept code, DateTimeType value) {
605        super();
606        this.code = code;
607        this.value = value;
608      }
609
610        /**
611         * @return {@link #code} (Date classification of recommendation.  For example, earliest date to give, latest date to give, etc.)
612         */
613        public CodeableConcept getCode() { 
614          if (this.code == null)
615            if (Configuration.errorOnAutoCreate())
616              throw new Error("Attempt to auto-create ImmunizationRecommendationRecommendationDateCriterionComponent.code");
617            else if (Configuration.doAutoCreate())
618              this.code = new CodeableConcept(); // cc
619          return this.code;
620        }
621
622        public boolean hasCode() { 
623          return this.code != null && !this.code.isEmpty();
624        }
625
626        /**
627         * @param value {@link #code} (Date classification of recommendation.  For example, earliest date to give, latest date to give, etc.)
628         */
629        public ImmunizationRecommendationRecommendationDateCriterionComponent setCode(CodeableConcept value) { 
630          this.code = value;
631          return this;
632        }
633
634        /**
635         * @return {@link #value} (The date whose meaning is specified by dateCriterion.code.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
636         */
637        public DateTimeType getValueElement() { 
638          if (this.value == null)
639            if (Configuration.errorOnAutoCreate())
640              throw new Error("Attempt to auto-create ImmunizationRecommendationRecommendationDateCriterionComponent.value");
641            else if (Configuration.doAutoCreate())
642              this.value = new DateTimeType(); // bb
643          return this.value;
644        }
645
646        public boolean hasValueElement() { 
647          return this.value != null && !this.value.isEmpty();
648        }
649
650        public boolean hasValue() { 
651          return this.value != null && !this.value.isEmpty();
652        }
653
654        /**
655         * @param value {@link #value} (The date whose meaning is specified by dateCriterion.code.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
656         */
657        public ImmunizationRecommendationRecommendationDateCriterionComponent setValueElement(DateTimeType value) { 
658          this.value = value;
659          return this;
660        }
661
662        /**
663         * @return The date whose meaning is specified by dateCriterion.code.
664         */
665        public Date getValue() { 
666          return this.value == null ? null : this.value.getValue();
667        }
668
669        /**
670         * @param value The date whose meaning is specified by dateCriterion.code.
671         */
672        public ImmunizationRecommendationRecommendationDateCriterionComponent setValue(Date value) { 
673            if (this.value == null)
674              this.value = new DateTimeType();
675            this.value.setValue(value);
676          return this;
677        }
678
679        protected void listChildren(List<Property> childrenList) {
680          super.listChildren(childrenList);
681          childrenList.add(new Property("code", "CodeableConcept", "Date classification of recommendation.  For example, earliest date to give, latest date to give, etc.", 0, java.lang.Integer.MAX_VALUE, code));
682          childrenList.add(new Property("value", "dateTime", "The date whose meaning is specified by dateCriterion.code.", 0, java.lang.Integer.MAX_VALUE, value));
683        }
684
685      @Override
686      public void setProperty(String name, Base value) throws FHIRException {
687        if (name.equals("code"))
688          this.code = castToCodeableConcept(value); // CodeableConcept
689        else if (name.equals("value"))
690          this.value = castToDateTime(value); // DateTimeType
691        else
692          super.setProperty(name, value);
693      }
694
695      @Override
696      public Base addChild(String name) throws FHIRException {
697        if (name.equals("code")) {
698          this.code = new CodeableConcept();
699          return this.code;
700        }
701        else if (name.equals("value")) {
702          throw new FHIRException("Cannot call addChild on a primitive type ImmunizationRecommendation.value");
703        }
704        else
705          return super.addChild(name);
706      }
707
708      public ImmunizationRecommendationRecommendationDateCriterionComponent copy() {
709        ImmunizationRecommendationRecommendationDateCriterionComponent dst = new ImmunizationRecommendationRecommendationDateCriterionComponent();
710        copyValues(dst);
711        dst.code = code == null ? null : code.copy();
712        dst.value = value == null ? null : value.copy();
713        return dst;
714      }
715
716      @Override
717      public boolean equalsDeep(Base other) {
718        if (!super.equalsDeep(other))
719          return false;
720        if (!(other instanceof ImmunizationRecommendationRecommendationDateCriterionComponent))
721          return false;
722        ImmunizationRecommendationRecommendationDateCriterionComponent o = (ImmunizationRecommendationRecommendationDateCriterionComponent) other;
723        return compareDeep(code, o.code, true) && compareDeep(value, o.value, true);
724      }
725
726      @Override
727      public boolean equalsShallow(Base other) {
728        if (!super.equalsShallow(other))
729          return false;
730        if (!(other instanceof ImmunizationRecommendationRecommendationDateCriterionComponent))
731          return false;
732        ImmunizationRecommendationRecommendationDateCriterionComponent o = (ImmunizationRecommendationRecommendationDateCriterionComponent) other;
733        return compareValues(value, o.value, true);
734      }
735
736      public boolean isEmpty() {
737        return super.isEmpty() && (code == null || code.isEmpty()) && (value == null || value.isEmpty())
738          ;
739      }
740
741  public String fhirType() {
742    return "ImmunizationRecommendation.recommendation.dateCriterion";
743
744  }
745
746  }
747
748    @Block()
749    public static class ImmunizationRecommendationRecommendationProtocolComponent extends BackboneElement implements IBaseBackboneElement {
750        /**
751         * Indicates the nominal position in a series of the next dose.  This is the recommended dose number as per a specified protocol.
752         */
753        @Child(name = "doseSequence", type = {IntegerType.class}, order=1, min=0, max=1, modifier=false, summary=false)
754        @Description(shortDefinition="Dose number within sequence", formalDefinition="Indicates the nominal position in a series of the next dose.  This is the recommended dose number as per a specified protocol." )
755        protected IntegerType doseSequence;
756
757        /**
758         * Contains the description about the protocol under which the vaccine was administered.
759         */
760        @Child(name = "description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
761        @Description(shortDefinition="Protocol details", formalDefinition="Contains the description about the protocol under which the vaccine was administered." )
762        protected StringType description;
763
764        /**
765         * Indicates the authority who published the protocol.  For example, ACIP.
766         */
767        @Child(name = "authority", type = {Organization.class}, order=3, min=0, max=1, modifier=false, summary=false)
768        @Description(shortDefinition="Who is responsible for protocol", formalDefinition="Indicates the authority who published the protocol.  For example, ACIP." )
769        protected Reference authority;
770
771        /**
772         * The actual object that is the target of the reference (Indicates the authority who published the protocol.  For example, ACIP.)
773         */
774        protected Organization authorityTarget;
775
776        /**
777         * One possible path to achieve presumed immunity against a disease - within the context of an authority.
778         */
779        @Child(name = "series", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
780        @Description(shortDefinition="Name of vaccination series", formalDefinition="One possible path to achieve presumed immunity against a disease - within the context of an authority." )
781        protected StringType series;
782
783        private static final long serialVersionUID = -512702014L;
784
785    /*
786     * Constructor
787     */
788      public ImmunizationRecommendationRecommendationProtocolComponent() {
789        super();
790      }
791
792        /**
793         * @return {@link #doseSequence} (Indicates the nominal position in a series of the next dose.  This is the recommended dose number as per a specified protocol.). This is the underlying object with id, value and extensions. The accessor "getDoseSequence" gives direct access to the value
794         */
795        public IntegerType getDoseSequenceElement() { 
796          if (this.doseSequence == null)
797            if (Configuration.errorOnAutoCreate())
798              throw new Error("Attempt to auto-create ImmunizationRecommendationRecommendationProtocolComponent.doseSequence");
799            else if (Configuration.doAutoCreate())
800              this.doseSequence = new IntegerType(); // bb
801          return this.doseSequence;
802        }
803
804        public boolean hasDoseSequenceElement() { 
805          return this.doseSequence != null && !this.doseSequence.isEmpty();
806        }
807
808        public boolean hasDoseSequence() { 
809          return this.doseSequence != null && !this.doseSequence.isEmpty();
810        }
811
812        /**
813         * @param value {@link #doseSequence} (Indicates the nominal position in a series of the next dose.  This is the recommended dose number as per a specified protocol.). This is the underlying object with id, value and extensions. The accessor "getDoseSequence" gives direct access to the value
814         */
815        public ImmunizationRecommendationRecommendationProtocolComponent setDoseSequenceElement(IntegerType value) { 
816          this.doseSequence = value;
817          return this;
818        }
819
820        /**
821         * @return Indicates the nominal position in a series of the next dose.  This is the recommended dose number as per a specified protocol.
822         */
823        public int getDoseSequence() { 
824          return this.doseSequence == null || this.doseSequence.isEmpty() ? 0 : this.doseSequence.getValue();
825        }
826
827        /**
828         * @param value Indicates the nominal position in a series of the next dose.  This is the recommended dose number as per a specified protocol.
829         */
830        public ImmunizationRecommendationRecommendationProtocolComponent setDoseSequence(int value) { 
831            if (this.doseSequence == null)
832              this.doseSequence = new IntegerType();
833            this.doseSequence.setValue(value);
834          return this;
835        }
836
837        /**
838         * @return {@link #description} (Contains the description about the protocol under which the vaccine was administered.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
839         */
840        public StringType getDescriptionElement() { 
841          if (this.description == null)
842            if (Configuration.errorOnAutoCreate())
843              throw new Error("Attempt to auto-create ImmunizationRecommendationRecommendationProtocolComponent.description");
844            else if (Configuration.doAutoCreate())
845              this.description = new StringType(); // bb
846          return this.description;
847        }
848
849        public boolean hasDescriptionElement() { 
850          return this.description != null && !this.description.isEmpty();
851        }
852
853        public boolean hasDescription() { 
854          return this.description != null && !this.description.isEmpty();
855        }
856
857        /**
858         * @param value {@link #description} (Contains the description about the protocol under which the vaccine was administered.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
859         */
860        public ImmunizationRecommendationRecommendationProtocolComponent setDescriptionElement(StringType value) { 
861          this.description = value;
862          return this;
863        }
864
865        /**
866         * @return Contains the description about the protocol under which the vaccine was administered.
867         */
868        public String getDescription() { 
869          return this.description == null ? null : this.description.getValue();
870        }
871
872        /**
873         * @param value Contains the description about the protocol under which the vaccine was administered.
874         */
875        public ImmunizationRecommendationRecommendationProtocolComponent setDescription(String value) { 
876          if (Utilities.noString(value))
877            this.description = null;
878          else {
879            if (this.description == null)
880              this.description = new StringType();
881            this.description.setValue(value);
882          }
883          return this;
884        }
885
886        /**
887         * @return {@link #authority} (Indicates the authority who published the protocol.  For example, ACIP.)
888         */
889        public Reference getAuthority() { 
890          if (this.authority == null)
891            if (Configuration.errorOnAutoCreate())
892              throw new Error("Attempt to auto-create ImmunizationRecommendationRecommendationProtocolComponent.authority");
893            else if (Configuration.doAutoCreate())
894              this.authority = new Reference(); // cc
895          return this.authority;
896        }
897
898        public boolean hasAuthority() { 
899          return this.authority != null && !this.authority.isEmpty();
900        }
901
902        /**
903         * @param value {@link #authority} (Indicates the authority who published the protocol.  For example, ACIP.)
904         */
905        public ImmunizationRecommendationRecommendationProtocolComponent setAuthority(Reference value) { 
906          this.authority = value;
907          return this;
908        }
909
910        /**
911         * @return {@link #authority} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Indicates the authority who published the protocol.  For example, ACIP.)
912         */
913        public Organization getAuthorityTarget() { 
914          if (this.authorityTarget == null)
915            if (Configuration.errorOnAutoCreate())
916              throw new Error("Attempt to auto-create ImmunizationRecommendationRecommendationProtocolComponent.authority");
917            else if (Configuration.doAutoCreate())
918              this.authorityTarget = new Organization(); // aa
919          return this.authorityTarget;
920        }
921
922        /**
923         * @param value {@link #authority} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Indicates the authority who published the protocol.  For example, ACIP.)
924         */
925        public ImmunizationRecommendationRecommendationProtocolComponent setAuthorityTarget(Organization value) { 
926          this.authorityTarget = value;
927          return this;
928        }
929
930        /**
931         * @return {@link #series} (One possible path to achieve presumed immunity against a disease - within the context of an authority.). This is the underlying object with id, value and extensions. The accessor "getSeries" gives direct access to the value
932         */
933        public StringType getSeriesElement() { 
934          if (this.series == null)
935            if (Configuration.errorOnAutoCreate())
936              throw new Error("Attempt to auto-create ImmunizationRecommendationRecommendationProtocolComponent.series");
937            else if (Configuration.doAutoCreate())
938              this.series = new StringType(); // bb
939          return this.series;
940        }
941
942        public boolean hasSeriesElement() { 
943          return this.series != null && !this.series.isEmpty();
944        }
945
946        public boolean hasSeries() { 
947          return this.series != null && !this.series.isEmpty();
948        }
949
950        /**
951         * @param value {@link #series} (One possible path to achieve presumed immunity against a disease - within the context of an authority.). This is the underlying object with id, value and extensions. The accessor "getSeries" gives direct access to the value
952         */
953        public ImmunizationRecommendationRecommendationProtocolComponent setSeriesElement(StringType value) { 
954          this.series = value;
955          return this;
956        }
957
958        /**
959         * @return One possible path to achieve presumed immunity against a disease - within the context of an authority.
960         */
961        public String getSeries() { 
962          return this.series == null ? null : this.series.getValue();
963        }
964
965        /**
966         * @param value One possible path to achieve presumed immunity against a disease - within the context of an authority.
967         */
968        public ImmunizationRecommendationRecommendationProtocolComponent setSeries(String value) { 
969          if (Utilities.noString(value))
970            this.series = null;
971          else {
972            if (this.series == null)
973              this.series = new StringType();
974            this.series.setValue(value);
975          }
976          return this;
977        }
978
979        protected void listChildren(List<Property> childrenList) {
980          super.listChildren(childrenList);
981          childrenList.add(new Property("doseSequence", "integer", "Indicates the nominal position in a series of the next dose.  This is the recommended dose number as per a specified protocol.", 0, java.lang.Integer.MAX_VALUE, doseSequence));
982          childrenList.add(new Property("description", "string", "Contains the description about the protocol under which the vaccine was administered.", 0, java.lang.Integer.MAX_VALUE, description));
983          childrenList.add(new Property("authority", "Reference(Organization)", "Indicates the authority who published the protocol.  For example, ACIP.", 0, java.lang.Integer.MAX_VALUE, authority));
984          childrenList.add(new Property("series", "string", "One possible path to achieve presumed immunity against a disease - within the context of an authority.", 0, java.lang.Integer.MAX_VALUE, series));
985        }
986
987      @Override
988      public void setProperty(String name, Base value) throws FHIRException {
989        if (name.equals("doseSequence"))
990          this.doseSequence = castToInteger(value); // IntegerType
991        else if (name.equals("description"))
992          this.description = castToString(value); // StringType
993        else if (name.equals("authority"))
994          this.authority = castToReference(value); // Reference
995        else if (name.equals("series"))
996          this.series = castToString(value); // StringType
997        else
998          super.setProperty(name, value);
999      }
1000
1001      @Override
1002      public Base addChild(String name) throws FHIRException {
1003        if (name.equals("doseSequence")) {
1004          throw new FHIRException("Cannot call addChild on a primitive type ImmunizationRecommendation.doseSequence");
1005        }
1006        else if (name.equals("description")) {
1007          throw new FHIRException("Cannot call addChild on a primitive type ImmunizationRecommendation.description");
1008        }
1009        else if (name.equals("authority")) {
1010          this.authority = new Reference();
1011          return this.authority;
1012        }
1013        else if (name.equals("series")) {
1014          throw new FHIRException("Cannot call addChild on a primitive type ImmunizationRecommendation.series");
1015        }
1016        else
1017          return super.addChild(name);
1018      }
1019
1020      public ImmunizationRecommendationRecommendationProtocolComponent copy() {
1021        ImmunizationRecommendationRecommendationProtocolComponent dst = new ImmunizationRecommendationRecommendationProtocolComponent();
1022        copyValues(dst);
1023        dst.doseSequence = doseSequence == null ? null : doseSequence.copy();
1024        dst.description = description == null ? null : description.copy();
1025        dst.authority = authority == null ? null : authority.copy();
1026        dst.series = series == null ? null : series.copy();
1027        return dst;
1028      }
1029
1030      @Override
1031      public boolean equalsDeep(Base other) {
1032        if (!super.equalsDeep(other))
1033          return false;
1034        if (!(other instanceof ImmunizationRecommendationRecommendationProtocolComponent))
1035          return false;
1036        ImmunizationRecommendationRecommendationProtocolComponent o = (ImmunizationRecommendationRecommendationProtocolComponent) other;
1037        return compareDeep(doseSequence, o.doseSequence, true) && compareDeep(description, o.description, true)
1038           && compareDeep(authority, o.authority, true) && compareDeep(series, o.series, true);
1039      }
1040
1041      @Override
1042      public boolean equalsShallow(Base other) {
1043        if (!super.equalsShallow(other))
1044          return false;
1045        if (!(other instanceof ImmunizationRecommendationRecommendationProtocolComponent))
1046          return false;
1047        ImmunizationRecommendationRecommendationProtocolComponent o = (ImmunizationRecommendationRecommendationProtocolComponent) other;
1048        return compareValues(doseSequence, o.doseSequence, true) && compareValues(description, o.description, true)
1049           && compareValues(series, o.series, true);
1050      }
1051
1052      public boolean isEmpty() {
1053        return super.isEmpty() && (doseSequence == null || doseSequence.isEmpty()) && (description == null || description.isEmpty())
1054           && (authority == null || authority.isEmpty()) && (series == null || series.isEmpty());
1055      }
1056
1057  public String fhirType() {
1058    return "ImmunizationRecommendation.recommendation.protocol";
1059
1060  }
1061
1062  }
1063
1064    /**
1065     * A unique identifier assigned to this particular recommendation record.
1066     */
1067    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1068    @Description(shortDefinition="Business identifier", formalDefinition="A unique identifier assigned to this particular recommendation record." )
1069    protected List<Identifier> identifier;
1070
1071    /**
1072     * The patient for whom the recommendations are for.
1073     */
1074    @Child(name = "patient", type = {Patient.class}, order=1, min=1, max=1, modifier=false, summary=true)
1075    @Description(shortDefinition="Who this profile is for", formalDefinition="The patient for whom the recommendations are for." )
1076    protected Reference patient;
1077
1078    /**
1079     * The actual object that is the target of the reference (The patient for whom the recommendations are for.)
1080     */
1081    protected Patient patientTarget;
1082
1083    /**
1084     * Vaccine administration recommendations.
1085     */
1086    @Child(name = "recommendation", type = {}, order=2, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1087    @Description(shortDefinition="Vaccine administration recommendations", formalDefinition="Vaccine administration recommendations." )
1088    protected List<ImmunizationRecommendationRecommendationComponent> recommendation;
1089
1090    private static final long serialVersionUID = 641058495L;
1091
1092  /*
1093   * Constructor
1094   */
1095    public ImmunizationRecommendation() {
1096      super();
1097    }
1098
1099  /*
1100   * Constructor
1101   */
1102    public ImmunizationRecommendation(Reference patient) {
1103      super();
1104      this.patient = patient;
1105    }
1106
1107    /**
1108     * @return {@link #identifier} (A unique identifier assigned to this particular recommendation record.)
1109     */
1110    public List<Identifier> getIdentifier() { 
1111      if (this.identifier == null)
1112        this.identifier = new ArrayList<Identifier>();
1113      return this.identifier;
1114    }
1115
1116    public boolean hasIdentifier() { 
1117      if (this.identifier == null)
1118        return false;
1119      for (Identifier item : this.identifier)
1120        if (!item.isEmpty())
1121          return true;
1122      return false;
1123    }
1124
1125    /**
1126     * @return {@link #identifier} (A unique identifier assigned to this particular recommendation record.)
1127     */
1128    // syntactic sugar
1129    public Identifier addIdentifier() { //3
1130      Identifier t = new Identifier();
1131      if (this.identifier == null)
1132        this.identifier = new ArrayList<Identifier>();
1133      this.identifier.add(t);
1134      return t;
1135    }
1136
1137    // syntactic sugar
1138    public ImmunizationRecommendation addIdentifier(Identifier t) { //3
1139      if (t == null)
1140        return this;
1141      if (this.identifier == null)
1142        this.identifier = new ArrayList<Identifier>();
1143      this.identifier.add(t);
1144      return this;
1145    }
1146
1147    /**
1148     * @return {@link #patient} (The patient for whom the recommendations are for.)
1149     */
1150    public Reference getPatient() { 
1151      if (this.patient == null)
1152        if (Configuration.errorOnAutoCreate())
1153          throw new Error("Attempt to auto-create ImmunizationRecommendation.patient");
1154        else if (Configuration.doAutoCreate())
1155          this.patient = new Reference(); // cc
1156      return this.patient;
1157    }
1158
1159    public boolean hasPatient() { 
1160      return this.patient != null && !this.patient.isEmpty();
1161    }
1162
1163    /**
1164     * @param value {@link #patient} (The patient for whom the recommendations are for.)
1165     */
1166    public ImmunizationRecommendation setPatient(Reference value) { 
1167      this.patient = value;
1168      return this;
1169    }
1170
1171    /**
1172     * @return {@link #patient} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The patient for whom the recommendations are for.)
1173     */
1174    public Patient getPatientTarget() { 
1175      if (this.patientTarget == null)
1176        if (Configuration.errorOnAutoCreate())
1177          throw new Error("Attempt to auto-create ImmunizationRecommendation.patient");
1178        else if (Configuration.doAutoCreate())
1179          this.patientTarget = new Patient(); // aa
1180      return this.patientTarget;
1181    }
1182
1183    /**
1184     * @param value {@link #patient} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The patient for whom the recommendations are for.)
1185     */
1186    public ImmunizationRecommendation setPatientTarget(Patient value) { 
1187      this.patientTarget = value;
1188      return this;
1189    }
1190
1191    /**
1192     * @return {@link #recommendation} (Vaccine administration recommendations.)
1193     */
1194    public List<ImmunizationRecommendationRecommendationComponent> getRecommendation() { 
1195      if (this.recommendation == null)
1196        this.recommendation = new ArrayList<ImmunizationRecommendationRecommendationComponent>();
1197      return this.recommendation;
1198    }
1199
1200    public boolean hasRecommendation() { 
1201      if (this.recommendation == null)
1202        return false;
1203      for (ImmunizationRecommendationRecommendationComponent item : this.recommendation)
1204        if (!item.isEmpty())
1205          return true;
1206      return false;
1207    }
1208
1209    /**
1210     * @return {@link #recommendation} (Vaccine administration recommendations.)
1211     */
1212    // syntactic sugar
1213    public ImmunizationRecommendationRecommendationComponent addRecommendation() { //3
1214      ImmunizationRecommendationRecommendationComponent t = new ImmunizationRecommendationRecommendationComponent();
1215      if (this.recommendation == null)
1216        this.recommendation = new ArrayList<ImmunizationRecommendationRecommendationComponent>();
1217      this.recommendation.add(t);
1218      return t;
1219    }
1220
1221    // syntactic sugar
1222    public ImmunizationRecommendation addRecommendation(ImmunizationRecommendationRecommendationComponent t) { //3
1223      if (t == null)
1224        return this;
1225      if (this.recommendation == null)
1226        this.recommendation = new ArrayList<ImmunizationRecommendationRecommendationComponent>();
1227      this.recommendation.add(t);
1228      return this;
1229    }
1230
1231      protected void listChildren(List<Property> childrenList) {
1232        super.listChildren(childrenList);
1233        childrenList.add(new Property("identifier", "Identifier", "A unique identifier assigned to this particular recommendation record.", 0, java.lang.Integer.MAX_VALUE, identifier));
1234        childrenList.add(new Property("patient", "Reference(Patient)", "The patient for whom the recommendations are for.", 0, java.lang.Integer.MAX_VALUE, patient));
1235        childrenList.add(new Property("recommendation", "", "Vaccine administration recommendations.", 0, java.lang.Integer.MAX_VALUE, recommendation));
1236      }
1237
1238      @Override
1239      public void setProperty(String name, Base value) throws FHIRException {
1240        if (name.equals("identifier"))
1241          this.getIdentifier().add(castToIdentifier(value));
1242        else if (name.equals("patient"))
1243          this.patient = castToReference(value); // Reference
1244        else if (name.equals("recommendation"))
1245          this.getRecommendation().add((ImmunizationRecommendationRecommendationComponent) value);
1246        else
1247          super.setProperty(name, value);
1248      }
1249
1250      @Override
1251      public Base addChild(String name) throws FHIRException {
1252        if (name.equals("identifier")) {
1253          return addIdentifier();
1254        }
1255        else if (name.equals("patient")) {
1256          this.patient = new Reference();
1257          return this.patient;
1258        }
1259        else if (name.equals("recommendation")) {
1260          return addRecommendation();
1261        }
1262        else
1263          return super.addChild(name);
1264      }
1265
1266  public String fhirType() {
1267    return "ImmunizationRecommendation";
1268
1269  }
1270
1271      public ImmunizationRecommendation copy() {
1272        ImmunizationRecommendation dst = new ImmunizationRecommendation();
1273        copyValues(dst);
1274        if (identifier != null) {
1275          dst.identifier = new ArrayList<Identifier>();
1276          for (Identifier i : identifier)
1277            dst.identifier.add(i.copy());
1278        };
1279        dst.patient = patient == null ? null : patient.copy();
1280        if (recommendation != null) {
1281          dst.recommendation = new ArrayList<ImmunizationRecommendationRecommendationComponent>();
1282          for (ImmunizationRecommendationRecommendationComponent i : recommendation)
1283            dst.recommendation.add(i.copy());
1284        };
1285        return dst;
1286      }
1287
1288      protected ImmunizationRecommendation typedCopy() {
1289        return copy();
1290      }
1291
1292      @Override
1293      public boolean equalsDeep(Base other) {
1294        if (!super.equalsDeep(other))
1295          return false;
1296        if (!(other instanceof ImmunizationRecommendation))
1297          return false;
1298        ImmunizationRecommendation o = (ImmunizationRecommendation) other;
1299        return compareDeep(identifier, o.identifier, true) && compareDeep(patient, o.patient, true) && compareDeep(recommendation, o.recommendation, true)
1300          ;
1301      }
1302
1303      @Override
1304      public boolean equalsShallow(Base other) {
1305        if (!super.equalsShallow(other))
1306          return false;
1307        if (!(other instanceof ImmunizationRecommendation))
1308          return false;
1309        ImmunizationRecommendation o = (ImmunizationRecommendation) other;
1310        return true;
1311      }
1312
1313      public boolean isEmpty() {
1314        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (patient == null || patient.isEmpty())
1315           && (recommendation == null || recommendation.isEmpty());
1316      }
1317
1318  @Override
1319  public ResourceType getResourceType() {
1320    return ResourceType.ImmunizationRecommendation;
1321   }
1322
1323  @SearchParamDefinition(name="date", path="ImmunizationRecommendation.recommendation.date", description="Date recommendation created", type="date" )
1324  public static final String SP_DATE = "date";
1325  @SearchParamDefinition(name="identifier", path="ImmunizationRecommendation.identifier", description="Business identifier", type="token" )
1326  public static final String SP_IDENTIFIER = "identifier";
1327  @SearchParamDefinition(name="dose-sequence", path="ImmunizationRecommendation.recommendation.protocol.doseSequence", description="Dose number within sequence", type="number" )
1328  public static final String SP_DOSESEQUENCE = "dose-sequence";
1329  @SearchParamDefinition(name="patient", path="ImmunizationRecommendation.patient", description="Who this profile is for", type="reference" )
1330  public static final String SP_PATIENT = "patient";
1331  @SearchParamDefinition(name="vaccine-type", path="ImmunizationRecommendation.recommendation.vaccineCode", description="Vaccine recommendation applies to", type="token" )
1332  public static final String SP_VACCINETYPE = "vaccine-type";
1333  @SearchParamDefinition(name="dose-number", path="ImmunizationRecommendation.recommendation.doseNumber", description="Recommended dose number", type="number" )
1334  public static final String SP_DOSENUMBER = "dose-number";
1335  @SearchParamDefinition(name="information", path="ImmunizationRecommendation.recommendation.supportingPatientInformation", description="Patient observations supporting recommendation", type="reference" )
1336  public static final String SP_INFORMATION = "information";
1337  @SearchParamDefinition(name="support", path="ImmunizationRecommendation.recommendation.supportingImmunization", description="Past immunizations supporting recommendation", type="reference" )
1338  public static final String SP_SUPPORT = "support";
1339  @SearchParamDefinition(name="status", path="ImmunizationRecommendation.recommendation.forecastStatus", description="Vaccine administration status", type="token" )
1340  public static final String SP_STATUS = "status";
1341
1342}
1343