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