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