001package org.hl7.fhir.dstu2016may.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 Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
036import java.util.ArrayList;
037import java.util.Date;
038import java.util.List;
039
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
042import org.hl7.fhir.utilities.Utilities;
043
044import ca.uhn.fhir.model.api.annotation.Block;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.Description;
047import ca.uhn.fhir.model.api.annotation.ResourceDef;
048import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
049/**
050 * Risk of harmful or undesirable, physiological response which is unique to an individual and associated with exposure to a substance.
051 */
052@ResourceDef(name="AllergyIntolerance", profile="http://hl7.org/fhir/Profile/AllergyIntolerance")
053public class AllergyIntolerance extends DomainResource {
054
055    public enum AllergyIntoleranceStatus {
056        /**
057         * An active record of a reaction to the identified Substance.
058         */
059        ACTIVE, 
060        /**
061         * A low level of certainty about the propensity for a reaction to the identified Substance.
062         */
063        UNCONFIRMED, 
064        /**
065         * A high level of certainty about the propensity for a reaction to the identified Substance, which may include clinical evidence by testing or rechallenge.
066         */
067        CONFIRMED, 
068        /**
069         * An inactive record of a reaction to the identified Substance.
070         */
071        INACTIVE, 
072        /**
073         * A reaction to the identified Substance has been clinically reassessed by testing or rechallenge and considered to be resolved.
074         */
075        RESOLVED, 
076        /**
077         * A propensity for a reaction to the identified Substance has been disproven with a high level of clinical certainty, which may include testing or rechallenge, and is refuted.
078         */
079        REFUTED, 
080        /**
081         * The statement was entered in error and is not valid.
082         */
083        ENTEREDINERROR, 
084        /**
085         * added to help the parsers
086         */
087        NULL;
088        public static AllergyIntoleranceStatus fromCode(String codeString) throws FHIRException {
089            if (codeString == null || "".equals(codeString))
090                return null;
091        if ("active".equals(codeString))
092          return ACTIVE;
093        if ("unconfirmed".equals(codeString))
094          return UNCONFIRMED;
095        if ("confirmed".equals(codeString))
096          return CONFIRMED;
097        if ("inactive".equals(codeString))
098          return INACTIVE;
099        if ("resolved".equals(codeString))
100          return RESOLVED;
101        if ("refuted".equals(codeString))
102          return REFUTED;
103        if ("entered-in-error".equals(codeString))
104          return ENTEREDINERROR;
105        throw new FHIRException("Unknown AllergyIntoleranceStatus code '"+codeString+"'");
106        }
107        public String toCode() {
108          switch (this) {
109            case ACTIVE: return "active";
110            case UNCONFIRMED: return "unconfirmed";
111            case CONFIRMED: return "confirmed";
112            case INACTIVE: return "inactive";
113            case RESOLVED: return "resolved";
114            case REFUTED: return "refuted";
115            case ENTEREDINERROR: return "entered-in-error";
116            case NULL: return null;
117            default: return "?";
118          }
119        }
120        public String getSystem() {
121          switch (this) {
122            case ACTIVE: return "http://hl7.org/fhir/allergy-intolerance-status";
123            case UNCONFIRMED: return "http://hl7.org/fhir/allergy-intolerance-status";
124            case CONFIRMED: return "http://hl7.org/fhir/allergy-intolerance-status";
125            case INACTIVE: return "http://hl7.org/fhir/allergy-intolerance-status";
126            case RESOLVED: return "http://hl7.org/fhir/allergy-intolerance-status";
127            case REFUTED: return "http://hl7.org/fhir/allergy-intolerance-status";
128            case ENTEREDINERROR: return "http://hl7.org/fhir/allergy-intolerance-status";
129            case NULL: return null;
130            default: return "?";
131          }
132        }
133        public String getDefinition() {
134          switch (this) {
135            case ACTIVE: return "An active record of a reaction to the identified Substance.";
136            case UNCONFIRMED: return "A low level of certainty about the propensity for a reaction to the identified Substance.";
137            case CONFIRMED: return "A high level of certainty about the propensity for a reaction to the identified Substance, which may include clinical evidence by testing or rechallenge.";
138            case INACTIVE: return "An inactive record of a reaction to the identified Substance.";
139            case RESOLVED: return "A reaction to the identified Substance has been clinically reassessed by testing or rechallenge and considered to be resolved.";
140            case REFUTED: return "A propensity for a reaction to the identified Substance has been disproven with a high level of clinical certainty, which may include testing or rechallenge, and is refuted.";
141            case ENTEREDINERROR: return "The statement was entered in error and is not valid.";
142            case NULL: return null;
143            default: return "?";
144          }
145        }
146        public String getDisplay() {
147          switch (this) {
148            case ACTIVE: return "Active";
149            case UNCONFIRMED: return "Unconfirmed";
150            case CONFIRMED: return "Confirmed";
151            case INACTIVE: return "Inactive";
152            case RESOLVED: return "Resolved";
153            case REFUTED: return "Refuted";
154            case ENTEREDINERROR: return "Entered In Error";
155            case NULL: return null;
156            default: return "?";
157          }
158        }
159    }
160
161  public static class AllergyIntoleranceStatusEnumFactory implements EnumFactory<AllergyIntoleranceStatus> {
162    public AllergyIntoleranceStatus fromCode(String codeString) throws IllegalArgumentException {
163      if (codeString == null || "".equals(codeString))
164            if (codeString == null || "".equals(codeString))
165                return null;
166        if ("active".equals(codeString))
167          return AllergyIntoleranceStatus.ACTIVE;
168        if ("unconfirmed".equals(codeString))
169          return AllergyIntoleranceStatus.UNCONFIRMED;
170        if ("confirmed".equals(codeString))
171          return AllergyIntoleranceStatus.CONFIRMED;
172        if ("inactive".equals(codeString))
173          return AllergyIntoleranceStatus.INACTIVE;
174        if ("resolved".equals(codeString))
175          return AllergyIntoleranceStatus.RESOLVED;
176        if ("refuted".equals(codeString))
177          return AllergyIntoleranceStatus.REFUTED;
178        if ("entered-in-error".equals(codeString))
179          return AllergyIntoleranceStatus.ENTEREDINERROR;
180        throw new IllegalArgumentException("Unknown AllergyIntoleranceStatus code '"+codeString+"'");
181        }
182        public Enumeration<AllergyIntoleranceStatus> fromType(Base code) throws FHIRException {
183          if (code == null || code.isEmpty())
184            return null;
185          String codeString = ((PrimitiveType) code).asStringValue();
186          if (codeString == null || "".equals(codeString))
187            return null;
188        if ("active".equals(codeString))
189          return new Enumeration<AllergyIntoleranceStatus>(this, AllergyIntoleranceStatus.ACTIVE);
190        if ("unconfirmed".equals(codeString))
191          return new Enumeration<AllergyIntoleranceStatus>(this, AllergyIntoleranceStatus.UNCONFIRMED);
192        if ("confirmed".equals(codeString))
193          return new Enumeration<AllergyIntoleranceStatus>(this, AllergyIntoleranceStatus.CONFIRMED);
194        if ("inactive".equals(codeString))
195          return new Enumeration<AllergyIntoleranceStatus>(this, AllergyIntoleranceStatus.INACTIVE);
196        if ("resolved".equals(codeString))
197          return new Enumeration<AllergyIntoleranceStatus>(this, AllergyIntoleranceStatus.RESOLVED);
198        if ("refuted".equals(codeString))
199          return new Enumeration<AllergyIntoleranceStatus>(this, AllergyIntoleranceStatus.REFUTED);
200        if ("entered-in-error".equals(codeString))
201          return new Enumeration<AllergyIntoleranceStatus>(this, AllergyIntoleranceStatus.ENTEREDINERROR);
202        throw new FHIRException("Unknown AllergyIntoleranceStatus code '"+codeString+"'");
203        }
204    public String toCode(AllergyIntoleranceStatus code) {
205      if (code == AllergyIntoleranceStatus.ACTIVE)
206        return "active";
207      if (code == AllergyIntoleranceStatus.UNCONFIRMED)
208        return "unconfirmed";
209      if (code == AllergyIntoleranceStatus.CONFIRMED)
210        return "confirmed";
211      if (code == AllergyIntoleranceStatus.INACTIVE)
212        return "inactive";
213      if (code == AllergyIntoleranceStatus.RESOLVED)
214        return "resolved";
215      if (code == AllergyIntoleranceStatus.REFUTED)
216        return "refuted";
217      if (code == AllergyIntoleranceStatus.ENTEREDINERROR)
218        return "entered-in-error";
219      return "?";
220      }
221    public String toSystem(AllergyIntoleranceStatus code) {
222      return code.getSystem();
223      }
224    }
225
226    public enum AllergyIntoleranceType {
227        /**
228         * A propensity for hypersensitivity reaction(s) to a substance.  These reactions are most typically type I hypersensitivity, plus other "allergy-like" reactions, including pseudoallergy.
229         */
230        ALLERGY, 
231        /**
232         * A propensity for adverse reactions to a substance that is not judged to be allergic or "allergy-like".  These reactions are typically (but not necessarily) non-immune.  They are to some degree idiosyncratic and/or individually specific (i.e. are not a reaction that is expected to occur with most or all patients given similar circumstances).
233         */
234        INTOLERANCE, 
235        /**
236         * added to help the parsers
237         */
238        NULL;
239        public static AllergyIntoleranceType fromCode(String codeString) throws FHIRException {
240            if (codeString == null || "".equals(codeString))
241                return null;
242        if ("allergy".equals(codeString))
243          return ALLERGY;
244        if ("intolerance".equals(codeString))
245          return INTOLERANCE;
246        throw new FHIRException("Unknown AllergyIntoleranceType code '"+codeString+"'");
247        }
248        public String toCode() {
249          switch (this) {
250            case ALLERGY: return "allergy";
251            case INTOLERANCE: return "intolerance";
252            case NULL: return null;
253            default: return "?";
254          }
255        }
256        public String getSystem() {
257          switch (this) {
258            case ALLERGY: return "http://hl7.org/fhir/allergy-intolerance-type";
259            case INTOLERANCE: return "http://hl7.org/fhir/allergy-intolerance-type";
260            case NULL: return null;
261            default: return "?";
262          }
263        }
264        public String getDefinition() {
265          switch (this) {
266            case ALLERGY: return "A propensity for hypersensitivity reaction(s) to a substance.  These reactions are most typically type I hypersensitivity, plus other \"allergy-like\" reactions, including pseudoallergy.";
267            case INTOLERANCE: return "A propensity for adverse reactions to a substance that is not judged to be allergic or \"allergy-like\".  These reactions are typically (but not necessarily) non-immune.  They are to some degree idiosyncratic and/or individually specific (i.e. are not a reaction that is expected to occur with most or all patients given similar circumstances).";
268            case NULL: return null;
269            default: return "?";
270          }
271        }
272        public String getDisplay() {
273          switch (this) {
274            case ALLERGY: return "Allergy";
275            case INTOLERANCE: return "Intolerance";
276            case NULL: return null;
277            default: return "?";
278          }
279        }
280    }
281
282  public static class AllergyIntoleranceTypeEnumFactory implements EnumFactory<AllergyIntoleranceType> {
283    public AllergyIntoleranceType fromCode(String codeString) throws IllegalArgumentException {
284      if (codeString == null || "".equals(codeString))
285            if (codeString == null || "".equals(codeString))
286                return null;
287        if ("allergy".equals(codeString))
288          return AllergyIntoleranceType.ALLERGY;
289        if ("intolerance".equals(codeString))
290          return AllergyIntoleranceType.INTOLERANCE;
291        throw new IllegalArgumentException("Unknown AllergyIntoleranceType code '"+codeString+"'");
292        }
293        public Enumeration<AllergyIntoleranceType> fromType(Base code) throws FHIRException {
294          if (code == null || code.isEmpty())
295            return null;
296          String codeString = ((PrimitiveType) code).asStringValue();
297          if (codeString == null || "".equals(codeString))
298            return null;
299        if ("allergy".equals(codeString))
300          return new Enumeration<AllergyIntoleranceType>(this, AllergyIntoleranceType.ALLERGY);
301        if ("intolerance".equals(codeString))
302          return new Enumeration<AllergyIntoleranceType>(this, AllergyIntoleranceType.INTOLERANCE);
303        throw new FHIRException("Unknown AllergyIntoleranceType code '"+codeString+"'");
304        }
305    public String toCode(AllergyIntoleranceType code) {
306      if (code == AllergyIntoleranceType.ALLERGY)
307        return "allergy";
308      if (code == AllergyIntoleranceType.INTOLERANCE)
309        return "intolerance";
310      return "?";
311      }
312    public String toSystem(AllergyIntoleranceType code) {
313      return code.getSystem();
314      }
315    }
316
317    public enum AllergyIntoleranceCategory {
318        /**
319         * Any substance consumed to provide nutritional support for the body.
320         */
321        FOOD, 
322        /**
323         * Substances administered to achieve a physiological effect.
324         */
325        MEDICATION, 
326        /**
327         * Substances that are encountered in the environment.
328         */
329        ENVIRONMENT, 
330        /**
331         * Other substances that are not covered by any other category.
332         */
333        OTHER, 
334        /**
335         * added to help the parsers
336         */
337        NULL;
338        public static AllergyIntoleranceCategory fromCode(String codeString) throws FHIRException {
339            if (codeString == null || "".equals(codeString))
340                return null;
341        if ("food".equals(codeString))
342          return FOOD;
343        if ("medication".equals(codeString))
344          return MEDICATION;
345        if ("environment".equals(codeString))
346          return ENVIRONMENT;
347        if ("other".equals(codeString))
348          return OTHER;
349        throw new FHIRException("Unknown AllergyIntoleranceCategory code '"+codeString+"'");
350        }
351        public String toCode() {
352          switch (this) {
353            case FOOD: return "food";
354            case MEDICATION: return "medication";
355            case ENVIRONMENT: return "environment";
356            case OTHER: return "other";
357            case NULL: return null;
358            default: return "?";
359          }
360        }
361        public String getSystem() {
362          switch (this) {
363            case FOOD: return "http://hl7.org/fhir/allergy-intolerance-category";
364            case MEDICATION: return "http://hl7.org/fhir/allergy-intolerance-category";
365            case ENVIRONMENT: return "http://hl7.org/fhir/allergy-intolerance-category";
366            case OTHER: return "http://hl7.org/fhir/allergy-intolerance-category";
367            case NULL: return null;
368            default: return "?";
369          }
370        }
371        public String getDefinition() {
372          switch (this) {
373            case FOOD: return "Any substance consumed to provide nutritional support for the body.";
374            case MEDICATION: return "Substances administered to achieve a physiological effect.";
375            case ENVIRONMENT: return "Substances that are encountered in the environment.";
376            case OTHER: return "Other substances that are not covered by any other category.";
377            case NULL: return null;
378            default: return "?";
379          }
380        }
381        public String getDisplay() {
382          switch (this) {
383            case FOOD: return "Food";
384            case MEDICATION: return "Medication";
385            case ENVIRONMENT: return "Environment";
386            case OTHER: return "Other";
387            case NULL: return null;
388            default: return "?";
389          }
390        }
391    }
392
393  public static class AllergyIntoleranceCategoryEnumFactory implements EnumFactory<AllergyIntoleranceCategory> {
394    public AllergyIntoleranceCategory fromCode(String codeString) throws IllegalArgumentException {
395      if (codeString == null || "".equals(codeString))
396            if (codeString == null || "".equals(codeString))
397                return null;
398        if ("food".equals(codeString))
399          return AllergyIntoleranceCategory.FOOD;
400        if ("medication".equals(codeString))
401          return AllergyIntoleranceCategory.MEDICATION;
402        if ("environment".equals(codeString))
403          return AllergyIntoleranceCategory.ENVIRONMENT;
404        if ("other".equals(codeString))
405          return AllergyIntoleranceCategory.OTHER;
406        throw new IllegalArgumentException("Unknown AllergyIntoleranceCategory code '"+codeString+"'");
407        }
408        public Enumeration<AllergyIntoleranceCategory> fromType(Base code) throws FHIRException {
409          if (code == null || code.isEmpty())
410            return null;
411          String codeString = ((PrimitiveType) code).asStringValue();
412          if (codeString == null || "".equals(codeString))
413            return null;
414        if ("food".equals(codeString))
415          return new Enumeration<AllergyIntoleranceCategory>(this, AllergyIntoleranceCategory.FOOD);
416        if ("medication".equals(codeString))
417          return new Enumeration<AllergyIntoleranceCategory>(this, AllergyIntoleranceCategory.MEDICATION);
418        if ("environment".equals(codeString))
419          return new Enumeration<AllergyIntoleranceCategory>(this, AllergyIntoleranceCategory.ENVIRONMENT);
420        if ("other".equals(codeString))
421          return new Enumeration<AllergyIntoleranceCategory>(this, AllergyIntoleranceCategory.OTHER);
422        throw new FHIRException("Unknown AllergyIntoleranceCategory code '"+codeString+"'");
423        }
424    public String toCode(AllergyIntoleranceCategory code) {
425      if (code == AllergyIntoleranceCategory.FOOD)
426        return "food";
427      if (code == AllergyIntoleranceCategory.MEDICATION)
428        return "medication";
429      if (code == AllergyIntoleranceCategory.ENVIRONMENT)
430        return "environment";
431      if (code == AllergyIntoleranceCategory.OTHER)
432        return "other";
433      return "?";
434      }
435    public String toSystem(AllergyIntoleranceCategory code) {
436      return code.getSystem();
437      }
438    }
439
440    public enum AllergyIntoleranceCriticality {
441        /**
442         * Worst case result of a future exposure is not assessed to be life-threatening or having high potential for organ system failure.
443         */
444        LOW, 
445        /**
446         * Worst case result of a future exposure is assessed to be life-threatening or having high potential for organ system failure.
447         */
448        HIGH, 
449        /**
450         * Unable to assess the worst case result of a future exposure.
451         */
452        UNABLETOASSESS, 
453        /**
454         * added to help the parsers
455         */
456        NULL;
457        public static AllergyIntoleranceCriticality fromCode(String codeString) throws FHIRException {
458            if (codeString == null || "".equals(codeString))
459                return null;
460        if ("low".equals(codeString))
461          return LOW;
462        if ("high".equals(codeString))
463          return HIGH;
464        if ("unable-to-assess".equals(codeString))
465          return UNABLETOASSESS;
466        throw new FHIRException("Unknown AllergyIntoleranceCriticality code '"+codeString+"'");
467        }
468        public String toCode() {
469          switch (this) {
470            case LOW: return "low";
471            case HIGH: return "high";
472            case UNABLETOASSESS: return "unable-to-assess";
473            case NULL: return null;
474            default: return "?";
475          }
476        }
477        public String getSystem() {
478          switch (this) {
479            case LOW: return "http://hl7.org/fhir/allergy-intolerance-criticality";
480            case HIGH: return "http://hl7.org/fhir/allergy-intolerance-criticality";
481            case UNABLETOASSESS: return "http://hl7.org/fhir/allergy-intolerance-criticality";
482            case NULL: return null;
483            default: return "?";
484          }
485        }
486        public String getDefinition() {
487          switch (this) {
488            case LOW: return "Worst case result of a future exposure is not assessed to be life-threatening or having high potential for organ system failure.";
489            case HIGH: return "Worst case result of a future exposure is assessed to be life-threatening or having high potential for organ system failure.";
490            case UNABLETOASSESS: return "Unable to assess the worst case result of a future exposure.";
491            case NULL: return null;
492            default: return "?";
493          }
494        }
495        public String getDisplay() {
496          switch (this) {
497            case LOW: return "Low Risk";
498            case HIGH: return "High Risk";
499            case UNABLETOASSESS: return "Unable to Assess Risk";
500            case NULL: return null;
501            default: return "?";
502          }
503        }
504    }
505
506  public static class AllergyIntoleranceCriticalityEnumFactory implements EnumFactory<AllergyIntoleranceCriticality> {
507    public AllergyIntoleranceCriticality fromCode(String codeString) throws IllegalArgumentException {
508      if (codeString == null || "".equals(codeString))
509            if (codeString == null || "".equals(codeString))
510                return null;
511        if ("low".equals(codeString))
512          return AllergyIntoleranceCriticality.LOW;
513        if ("high".equals(codeString))
514          return AllergyIntoleranceCriticality.HIGH;
515        if ("unable-to-assess".equals(codeString))
516          return AllergyIntoleranceCriticality.UNABLETOASSESS;
517        throw new IllegalArgumentException("Unknown AllergyIntoleranceCriticality code '"+codeString+"'");
518        }
519        public Enumeration<AllergyIntoleranceCriticality> fromType(Base code) throws FHIRException {
520          if (code == null || code.isEmpty())
521            return null;
522          String codeString = ((PrimitiveType) code).asStringValue();
523          if (codeString == null || "".equals(codeString))
524            return null;
525        if ("low".equals(codeString))
526          return new Enumeration<AllergyIntoleranceCriticality>(this, AllergyIntoleranceCriticality.LOW);
527        if ("high".equals(codeString))
528          return new Enumeration<AllergyIntoleranceCriticality>(this, AllergyIntoleranceCriticality.HIGH);
529        if ("unable-to-assess".equals(codeString))
530          return new Enumeration<AllergyIntoleranceCriticality>(this, AllergyIntoleranceCriticality.UNABLETOASSESS);
531        throw new FHIRException("Unknown AllergyIntoleranceCriticality code '"+codeString+"'");
532        }
533    public String toCode(AllergyIntoleranceCriticality code) {
534      if (code == AllergyIntoleranceCriticality.LOW)
535        return "low";
536      if (code == AllergyIntoleranceCriticality.HIGH)
537        return "high";
538      if (code == AllergyIntoleranceCriticality.UNABLETOASSESS)
539        return "unable-to-assess";
540      return "?";
541      }
542    public String toSystem(AllergyIntoleranceCriticality code) {
543      return code.getSystem();
544      }
545    }
546
547    public enum AllergyIntoleranceCertainty {
548        /**
549         * There is a low level of clinical certainty that the reaction was caused by the identified Substance.
550         */
551        UNLIKELY, 
552        /**
553         * There is a high level of clinical certainty that the reaction was caused by the identified Substance.
554         */
555        LIKELY, 
556        /**
557         * There is a very high level of clinical certainty that the reaction was due to the identified Substance, which may include clinical evidence by testing or rechallenge.
558         */
559        CONFIRMED, 
560        /**
561         * added to help the parsers
562         */
563        NULL;
564        public static AllergyIntoleranceCertainty fromCode(String codeString) throws FHIRException {
565            if (codeString == null || "".equals(codeString))
566                return null;
567        if ("unlikely".equals(codeString))
568          return UNLIKELY;
569        if ("likely".equals(codeString))
570          return LIKELY;
571        if ("confirmed".equals(codeString))
572          return CONFIRMED;
573        throw new FHIRException("Unknown AllergyIntoleranceCertainty code '"+codeString+"'");
574        }
575        public String toCode() {
576          switch (this) {
577            case UNLIKELY: return "unlikely";
578            case LIKELY: return "likely";
579            case CONFIRMED: return "confirmed";
580            case NULL: return null;
581            default: return "?";
582          }
583        }
584        public String getSystem() {
585          switch (this) {
586            case UNLIKELY: return "http://hl7.org/fhir/reaction-event-certainty";
587            case LIKELY: return "http://hl7.org/fhir/reaction-event-certainty";
588            case CONFIRMED: return "http://hl7.org/fhir/reaction-event-certainty";
589            case NULL: return null;
590            default: return "?";
591          }
592        }
593        public String getDefinition() {
594          switch (this) {
595            case UNLIKELY: return "There is a low level of clinical certainty that the reaction was caused by the identified Substance.";
596            case LIKELY: return "There is a high level of clinical certainty that the reaction was caused by the identified Substance.";
597            case CONFIRMED: return "There is a very high level of clinical certainty that the reaction was due to the identified Substance, which may include clinical evidence by testing or rechallenge.";
598            case NULL: return null;
599            default: return "?";
600          }
601        }
602        public String getDisplay() {
603          switch (this) {
604            case UNLIKELY: return "Unlikely";
605            case LIKELY: return "Likely";
606            case CONFIRMED: return "Confirmed";
607            case NULL: return null;
608            default: return "?";
609          }
610        }
611    }
612
613  public static class AllergyIntoleranceCertaintyEnumFactory implements EnumFactory<AllergyIntoleranceCertainty> {
614    public AllergyIntoleranceCertainty fromCode(String codeString) throws IllegalArgumentException {
615      if (codeString == null || "".equals(codeString))
616            if (codeString == null || "".equals(codeString))
617                return null;
618        if ("unlikely".equals(codeString))
619          return AllergyIntoleranceCertainty.UNLIKELY;
620        if ("likely".equals(codeString))
621          return AllergyIntoleranceCertainty.LIKELY;
622        if ("confirmed".equals(codeString))
623          return AllergyIntoleranceCertainty.CONFIRMED;
624        throw new IllegalArgumentException("Unknown AllergyIntoleranceCertainty code '"+codeString+"'");
625        }
626        public Enumeration<AllergyIntoleranceCertainty> fromType(Base code) throws FHIRException {
627          if (code == null || code.isEmpty())
628            return null;
629          String codeString = ((PrimitiveType) code).asStringValue();
630          if (codeString == null || "".equals(codeString))
631            return null;
632        if ("unlikely".equals(codeString))
633          return new Enumeration<AllergyIntoleranceCertainty>(this, AllergyIntoleranceCertainty.UNLIKELY);
634        if ("likely".equals(codeString))
635          return new Enumeration<AllergyIntoleranceCertainty>(this, AllergyIntoleranceCertainty.LIKELY);
636        if ("confirmed".equals(codeString))
637          return new Enumeration<AllergyIntoleranceCertainty>(this, AllergyIntoleranceCertainty.CONFIRMED);
638        throw new FHIRException("Unknown AllergyIntoleranceCertainty code '"+codeString+"'");
639        }
640    public String toCode(AllergyIntoleranceCertainty code) {
641      if (code == AllergyIntoleranceCertainty.UNLIKELY)
642        return "unlikely";
643      if (code == AllergyIntoleranceCertainty.LIKELY)
644        return "likely";
645      if (code == AllergyIntoleranceCertainty.CONFIRMED)
646        return "confirmed";
647      return "?";
648      }
649    public String toSystem(AllergyIntoleranceCertainty code) {
650      return code.getSystem();
651      }
652    }
653
654    public enum AllergyIntoleranceSeverity {
655        /**
656         * Causes mild physiological effects.
657         */
658        MILD, 
659        /**
660         * Causes moderate physiological effects.
661         */
662        MODERATE, 
663        /**
664         * Causes severe physiological effects.
665         */
666        SEVERE, 
667        /**
668         * added to help the parsers
669         */
670        NULL;
671        public static AllergyIntoleranceSeverity fromCode(String codeString) throws FHIRException {
672            if (codeString == null || "".equals(codeString))
673                return null;
674        if ("mild".equals(codeString))
675          return MILD;
676        if ("moderate".equals(codeString))
677          return MODERATE;
678        if ("severe".equals(codeString))
679          return SEVERE;
680        throw new FHIRException("Unknown AllergyIntoleranceSeverity code '"+codeString+"'");
681        }
682        public String toCode() {
683          switch (this) {
684            case MILD: return "mild";
685            case MODERATE: return "moderate";
686            case SEVERE: return "severe";
687            case NULL: return null;
688            default: return "?";
689          }
690        }
691        public String getSystem() {
692          switch (this) {
693            case MILD: return "http://hl7.org/fhir/reaction-event-severity";
694            case MODERATE: return "http://hl7.org/fhir/reaction-event-severity";
695            case SEVERE: return "http://hl7.org/fhir/reaction-event-severity";
696            case NULL: return null;
697            default: return "?";
698          }
699        }
700        public String getDefinition() {
701          switch (this) {
702            case MILD: return "Causes mild physiological effects.";
703            case MODERATE: return "Causes moderate physiological effects.";
704            case SEVERE: return "Causes severe physiological effects.";
705            case NULL: return null;
706            default: return "?";
707          }
708        }
709        public String getDisplay() {
710          switch (this) {
711            case MILD: return "Mild";
712            case MODERATE: return "Moderate";
713            case SEVERE: return "Severe";
714            case NULL: return null;
715            default: return "?";
716          }
717        }
718    }
719
720  public static class AllergyIntoleranceSeverityEnumFactory implements EnumFactory<AllergyIntoleranceSeverity> {
721    public AllergyIntoleranceSeverity fromCode(String codeString) throws IllegalArgumentException {
722      if (codeString == null || "".equals(codeString))
723            if (codeString == null || "".equals(codeString))
724                return null;
725        if ("mild".equals(codeString))
726          return AllergyIntoleranceSeverity.MILD;
727        if ("moderate".equals(codeString))
728          return AllergyIntoleranceSeverity.MODERATE;
729        if ("severe".equals(codeString))
730          return AllergyIntoleranceSeverity.SEVERE;
731        throw new IllegalArgumentException("Unknown AllergyIntoleranceSeverity code '"+codeString+"'");
732        }
733        public Enumeration<AllergyIntoleranceSeverity> fromType(Base code) throws FHIRException {
734          if (code == null || code.isEmpty())
735            return null;
736          String codeString = ((PrimitiveType) code).asStringValue();
737          if (codeString == null || "".equals(codeString))
738            return null;
739        if ("mild".equals(codeString))
740          return new Enumeration<AllergyIntoleranceSeverity>(this, AllergyIntoleranceSeverity.MILD);
741        if ("moderate".equals(codeString))
742          return new Enumeration<AllergyIntoleranceSeverity>(this, AllergyIntoleranceSeverity.MODERATE);
743        if ("severe".equals(codeString))
744          return new Enumeration<AllergyIntoleranceSeverity>(this, AllergyIntoleranceSeverity.SEVERE);
745        throw new FHIRException("Unknown AllergyIntoleranceSeverity code '"+codeString+"'");
746        }
747    public String toCode(AllergyIntoleranceSeverity code) {
748      if (code == AllergyIntoleranceSeverity.MILD)
749        return "mild";
750      if (code == AllergyIntoleranceSeverity.MODERATE)
751        return "moderate";
752      if (code == AllergyIntoleranceSeverity.SEVERE)
753        return "severe";
754      return "?";
755      }
756    public String toSystem(AllergyIntoleranceSeverity code) {
757      return code.getSystem();
758      }
759    }
760
761    @Block()
762    public static class AllergyIntoleranceReactionComponent extends BackboneElement implements IBaseBackboneElement {
763        /**
764         * Identification of the specific substance considered to be responsible for the Adverse Reaction event. Note: the substance for a specific reaction may be different to the substance identified as the cause of the risk, but must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite substance that includes the identified substance. It must be clinically safe to only process the AllergyIntolerance.substance and ignore the AllergyIntolerance.event.substance.
765         */
766        @Child(name = "substance", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
767        @Description(shortDefinition="Specific substance considered to be responsible for event", formalDefinition="Identification of the specific substance considered to be responsible for the Adverse Reaction event. Note: the substance for a specific reaction may be different to the substance identified as the cause of the risk, but must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite substance that includes the identified substance. It must be clinically safe to only process the AllergyIntolerance.substance and ignore the AllergyIntolerance.event.substance." )
768        protected CodeableConcept substance;
769
770        /**
771         * Statement about the degree of clinical certainty that the specific substance was the cause of the manifestation in this reaction event.
772         */
773        @Child(name = "certainty", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
774        @Description(shortDefinition="unlikely | likely | confirmed - clinical certainty about the specific substance", formalDefinition="Statement about the degree of clinical certainty that the specific substance was the cause of the manifestation in this reaction event." )
775        protected Enumeration<AllergyIntoleranceCertainty> certainty;
776
777        /**
778         * Clinical symptoms and/or signs that are observed or associated with the adverse reaction event.
779         */
780        @Child(name = "manifestation", type = {CodeableConcept.class}, order=3, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
781        @Description(shortDefinition="Clinical symptoms/signs associated with the Event", formalDefinition="Clinical symptoms and/or signs that are observed or associated with the adverse reaction event." )
782        protected List<CodeableConcept> manifestation;
783
784        /**
785         * Text description about the reaction as a whole, including details of the manifestation if required.
786         */
787        @Child(name = "description", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
788        @Description(shortDefinition="Description of the event as a whole", formalDefinition="Text description about the reaction as a whole, including details of the manifestation if required." )
789        protected StringType description;
790
791        /**
792         * Record of the date and/or time of the onset of the Reaction.
793         */
794        @Child(name = "onset", type = {DateTimeType.class}, order=5, min=0, max=1, modifier=false, summary=true)
795        @Description(shortDefinition="Date(/time) when manifestations showed", formalDefinition="Record of the date and/or time of the onset of the Reaction." )
796        protected DateTimeType onset;
797
798        /**
799         * Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations.
800         */
801        @Child(name = "severity", type = {CodeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
802        @Description(shortDefinition="mild | moderate | severe (of event as a whole)", formalDefinition="Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations." )
803        protected Enumeration<AllergyIntoleranceSeverity> severity;
804
805        /**
806         * Identification of the route by which the subject was exposed to the substance.
807         */
808        @Child(name = "exposureRoute", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=true)
809        @Description(shortDefinition="How the subject was exposed to the substance", formalDefinition="Identification of the route by which the subject was exposed to the substance." )
810        protected CodeableConcept exposureRoute;
811
812        /**
813         * Additional text about the adverse reaction event not captured in other fields.
814         */
815        @Child(name = "note", type = {Annotation.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
816        @Description(shortDefinition="Text about event not captured in other fields", formalDefinition="Additional text about the adverse reaction event not captured in other fields." )
817        protected List<Annotation> note;
818
819        private static final long serialVersionUID = -31700461L;
820
821    /**
822     * Constructor
823     */
824      public AllergyIntoleranceReactionComponent() {
825        super();
826      }
827
828        /**
829         * @return {@link #substance} (Identification of the specific substance considered to be responsible for the Adverse Reaction event. Note: the substance for a specific reaction may be different to the substance identified as the cause of the risk, but must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite substance that includes the identified substance. It must be clinically safe to only process the AllergyIntolerance.substance and ignore the AllergyIntolerance.event.substance.)
830         */
831        public CodeableConcept getSubstance() { 
832          if (this.substance == null)
833            if (Configuration.errorOnAutoCreate())
834              throw new Error("Attempt to auto-create AllergyIntoleranceReactionComponent.substance");
835            else if (Configuration.doAutoCreate())
836              this.substance = new CodeableConcept(); // cc
837          return this.substance;
838        }
839
840        public boolean hasSubstance() { 
841          return this.substance != null && !this.substance.isEmpty();
842        }
843
844        /**
845         * @param value {@link #substance} (Identification of the specific substance considered to be responsible for the Adverse Reaction event. Note: the substance for a specific reaction may be different to the substance identified as the cause of the risk, but must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite substance that includes the identified substance. It must be clinically safe to only process the AllergyIntolerance.substance and ignore the AllergyIntolerance.event.substance.)
846         */
847        public AllergyIntoleranceReactionComponent setSubstance(CodeableConcept value) { 
848          this.substance = value;
849          return this;
850        }
851
852        /**
853         * @return {@link #certainty} (Statement about the degree of clinical certainty that the specific substance was the cause of the manifestation in this reaction event.). This is the underlying object with id, value and extensions. The accessor "getCertainty" gives direct access to the value
854         */
855        public Enumeration<AllergyIntoleranceCertainty> getCertaintyElement() { 
856          if (this.certainty == null)
857            if (Configuration.errorOnAutoCreate())
858              throw new Error("Attempt to auto-create AllergyIntoleranceReactionComponent.certainty");
859            else if (Configuration.doAutoCreate())
860              this.certainty = new Enumeration<AllergyIntoleranceCertainty>(new AllergyIntoleranceCertaintyEnumFactory()); // bb
861          return this.certainty;
862        }
863
864        public boolean hasCertaintyElement() { 
865          return this.certainty != null && !this.certainty.isEmpty();
866        }
867
868        public boolean hasCertainty() { 
869          return this.certainty != null && !this.certainty.isEmpty();
870        }
871
872        /**
873         * @param value {@link #certainty} (Statement about the degree of clinical certainty that the specific substance was the cause of the manifestation in this reaction event.). This is the underlying object with id, value and extensions. The accessor "getCertainty" gives direct access to the value
874         */
875        public AllergyIntoleranceReactionComponent setCertaintyElement(Enumeration<AllergyIntoleranceCertainty> value) { 
876          this.certainty = value;
877          return this;
878        }
879
880        /**
881         * @return Statement about the degree of clinical certainty that the specific substance was the cause of the manifestation in this reaction event.
882         */
883        public AllergyIntoleranceCertainty getCertainty() { 
884          return this.certainty == null ? null : this.certainty.getValue();
885        }
886
887        /**
888         * @param value Statement about the degree of clinical certainty that the specific substance was the cause of the manifestation in this reaction event.
889         */
890        public AllergyIntoleranceReactionComponent setCertainty(AllergyIntoleranceCertainty value) { 
891          if (value == null)
892            this.certainty = null;
893          else {
894            if (this.certainty == null)
895              this.certainty = new Enumeration<AllergyIntoleranceCertainty>(new AllergyIntoleranceCertaintyEnumFactory());
896            this.certainty.setValue(value);
897          }
898          return this;
899        }
900
901        /**
902         * @return {@link #manifestation} (Clinical symptoms and/or signs that are observed or associated with the adverse reaction event.)
903         */
904        public List<CodeableConcept> getManifestation() { 
905          if (this.manifestation == null)
906            this.manifestation = new ArrayList<CodeableConcept>();
907          return this.manifestation;
908        }
909
910        public boolean hasManifestation() { 
911          if (this.manifestation == null)
912            return false;
913          for (CodeableConcept item : this.manifestation)
914            if (!item.isEmpty())
915              return true;
916          return false;
917        }
918
919        /**
920         * @return {@link #manifestation} (Clinical symptoms and/or signs that are observed or associated with the adverse reaction event.)
921         */
922    // syntactic sugar
923        public CodeableConcept addManifestation() { //3
924          CodeableConcept t = new CodeableConcept();
925          if (this.manifestation == null)
926            this.manifestation = new ArrayList<CodeableConcept>();
927          this.manifestation.add(t);
928          return t;
929        }
930
931    // syntactic sugar
932        public AllergyIntoleranceReactionComponent addManifestation(CodeableConcept t) { //3
933          if (t == null)
934            return this;
935          if (this.manifestation == null)
936            this.manifestation = new ArrayList<CodeableConcept>();
937          this.manifestation.add(t);
938          return this;
939        }
940
941        /**
942         * @return {@link #description} (Text description about the reaction as a whole, including details of the manifestation if required.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
943         */
944        public StringType getDescriptionElement() { 
945          if (this.description == null)
946            if (Configuration.errorOnAutoCreate())
947              throw new Error("Attempt to auto-create AllergyIntoleranceReactionComponent.description");
948            else if (Configuration.doAutoCreate())
949              this.description = new StringType(); // bb
950          return this.description;
951        }
952
953        public boolean hasDescriptionElement() { 
954          return this.description != null && !this.description.isEmpty();
955        }
956
957        public boolean hasDescription() { 
958          return this.description != null && !this.description.isEmpty();
959        }
960
961        /**
962         * @param value {@link #description} (Text description about the reaction as a whole, including details of the manifestation if required.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
963         */
964        public AllergyIntoleranceReactionComponent setDescriptionElement(StringType value) { 
965          this.description = value;
966          return this;
967        }
968
969        /**
970         * @return Text description about the reaction as a whole, including details of the manifestation if required.
971         */
972        public String getDescription() { 
973          return this.description == null ? null : this.description.getValue();
974        }
975
976        /**
977         * @param value Text description about the reaction as a whole, including details of the manifestation if required.
978         */
979        public AllergyIntoleranceReactionComponent setDescription(String value) { 
980          if (Utilities.noString(value))
981            this.description = null;
982          else {
983            if (this.description == null)
984              this.description = new StringType();
985            this.description.setValue(value);
986          }
987          return this;
988        }
989
990        /**
991         * @return {@link #onset} (Record of the date and/or time of the onset of the Reaction.). This is the underlying object with id, value and extensions. The accessor "getOnset" gives direct access to the value
992         */
993        public DateTimeType getOnsetElement() { 
994          if (this.onset == null)
995            if (Configuration.errorOnAutoCreate())
996              throw new Error("Attempt to auto-create AllergyIntoleranceReactionComponent.onset");
997            else if (Configuration.doAutoCreate())
998              this.onset = new DateTimeType(); // bb
999          return this.onset;
1000        }
1001
1002        public boolean hasOnsetElement() { 
1003          return this.onset != null && !this.onset.isEmpty();
1004        }
1005
1006        public boolean hasOnset() { 
1007          return this.onset != null && !this.onset.isEmpty();
1008        }
1009
1010        /**
1011         * @param value {@link #onset} (Record of the date and/or time of the onset of the Reaction.). This is the underlying object with id, value and extensions. The accessor "getOnset" gives direct access to the value
1012         */
1013        public AllergyIntoleranceReactionComponent setOnsetElement(DateTimeType value) { 
1014          this.onset = value;
1015          return this;
1016        }
1017
1018        /**
1019         * @return Record of the date and/or time of the onset of the Reaction.
1020         */
1021        public Date getOnset() { 
1022          return this.onset == null ? null : this.onset.getValue();
1023        }
1024
1025        /**
1026         * @param value Record of the date and/or time of the onset of the Reaction.
1027         */
1028        public AllergyIntoleranceReactionComponent setOnset(Date value) { 
1029          if (value == null)
1030            this.onset = null;
1031          else {
1032            if (this.onset == null)
1033              this.onset = new DateTimeType();
1034            this.onset.setValue(value);
1035          }
1036          return this;
1037        }
1038
1039        /**
1040         * @return {@link #severity} (Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations.). This is the underlying object with id, value and extensions. The accessor "getSeverity" gives direct access to the value
1041         */
1042        public Enumeration<AllergyIntoleranceSeverity> getSeverityElement() { 
1043          if (this.severity == null)
1044            if (Configuration.errorOnAutoCreate())
1045              throw new Error("Attempt to auto-create AllergyIntoleranceReactionComponent.severity");
1046            else if (Configuration.doAutoCreate())
1047              this.severity = new Enumeration<AllergyIntoleranceSeverity>(new AllergyIntoleranceSeverityEnumFactory()); // bb
1048          return this.severity;
1049        }
1050
1051        public boolean hasSeverityElement() { 
1052          return this.severity != null && !this.severity.isEmpty();
1053        }
1054
1055        public boolean hasSeverity() { 
1056          return this.severity != null && !this.severity.isEmpty();
1057        }
1058
1059        /**
1060         * @param value {@link #severity} (Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations.). This is the underlying object with id, value and extensions. The accessor "getSeverity" gives direct access to the value
1061         */
1062        public AllergyIntoleranceReactionComponent setSeverityElement(Enumeration<AllergyIntoleranceSeverity> value) { 
1063          this.severity = value;
1064          return this;
1065        }
1066
1067        /**
1068         * @return Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations.
1069         */
1070        public AllergyIntoleranceSeverity getSeverity() { 
1071          return this.severity == null ? null : this.severity.getValue();
1072        }
1073
1074        /**
1075         * @param value Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations.
1076         */
1077        public AllergyIntoleranceReactionComponent setSeverity(AllergyIntoleranceSeverity value) { 
1078          if (value == null)
1079            this.severity = null;
1080          else {
1081            if (this.severity == null)
1082              this.severity = new Enumeration<AllergyIntoleranceSeverity>(new AllergyIntoleranceSeverityEnumFactory());
1083            this.severity.setValue(value);
1084          }
1085          return this;
1086        }
1087
1088        /**
1089         * @return {@link #exposureRoute} (Identification of the route by which the subject was exposed to the substance.)
1090         */
1091        public CodeableConcept getExposureRoute() { 
1092          if (this.exposureRoute == null)
1093            if (Configuration.errorOnAutoCreate())
1094              throw new Error("Attempt to auto-create AllergyIntoleranceReactionComponent.exposureRoute");
1095            else if (Configuration.doAutoCreate())
1096              this.exposureRoute = new CodeableConcept(); // cc
1097          return this.exposureRoute;
1098        }
1099
1100        public boolean hasExposureRoute() { 
1101          return this.exposureRoute != null && !this.exposureRoute.isEmpty();
1102        }
1103
1104        /**
1105         * @param value {@link #exposureRoute} (Identification of the route by which the subject was exposed to the substance.)
1106         */
1107        public AllergyIntoleranceReactionComponent setExposureRoute(CodeableConcept value) { 
1108          this.exposureRoute = value;
1109          return this;
1110        }
1111
1112        /**
1113         * @return {@link #note} (Additional text about the adverse reaction event not captured in other fields.)
1114         */
1115        public List<Annotation> getNote() { 
1116          if (this.note == null)
1117            this.note = new ArrayList<Annotation>();
1118          return this.note;
1119        }
1120
1121        public boolean hasNote() { 
1122          if (this.note == null)
1123            return false;
1124          for (Annotation item : this.note)
1125            if (!item.isEmpty())
1126              return true;
1127          return false;
1128        }
1129
1130        /**
1131         * @return {@link #note} (Additional text about the adverse reaction event not captured in other fields.)
1132         */
1133    // syntactic sugar
1134        public Annotation addNote() { //3
1135          Annotation t = new Annotation();
1136          if (this.note == null)
1137            this.note = new ArrayList<Annotation>();
1138          this.note.add(t);
1139          return t;
1140        }
1141
1142    // syntactic sugar
1143        public AllergyIntoleranceReactionComponent addNote(Annotation t) { //3
1144          if (t == null)
1145            return this;
1146          if (this.note == null)
1147            this.note = new ArrayList<Annotation>();
1148          this.note.add(t);
1149          return this;
1150        }
1151
1152        protected void listChildren(List<Property> childrenList) {
1153          super.listChildren(childrenList);
1154          childrenList.add(new Property("substance", "CodeableConcept", "Identification of the specific substance considered to be responsible for the Adverse Reaction event. Note: the substance for a specific reaction may be different to the substance identified as the cause of the risk, but must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite substance that includes the identified substance. It must be clinically safe to only process the AllergyIntolerance.substance and ignore the AllergyIntolerance.event.substance.", 0, java.lang.Integer.MAX_VALUE, substance));
1155          childrenList.add(new Property("certainty", "code", "Statement about the degree of clinical certainty that the specific substance was the cause of the manifestation in this reaction event.", 0, java.lang.Integer.MAX_VALUE, certainty));
1156          childrenList.add(new Property("manifestation", "CodeableConcept", "Clinical symptoms and/or signs that are observed or associated with the adverse reaction event.", 0, java.lang.Integer.MAX_VALUE, manifestation));
1157          childrenList.add(new Property("description", "string", "Text description about the reaction as a whole, including details of the manifestation if required.", 0, java.lang.Integer.MAX_VALUE, description));
1158          childrenList.add(new Property("onset", "dateTime", "Record of the date and/or time of the onset of the Reaction.", 0, java.lang.Integer.MAX_VALUE, onset));
1159          childrenList.add(new Property("severity", "code", "Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations.", 0, java.lang.Integer.MAX_VALUE, severity));
1160          childrenList.add(new Property("exposureRoute", "CodeableConcept", "Identification of the route by which the subject was exposed to the substance.", 0, java.lang.Integer.MAX_VALUE, exposureRoute));
1161          childrenList.add(new Property("note", "Annotation", "Additional text about the adverse reaction event not captured in other fields.", 0, java.lang.Integer.MAX_VALUE, note));
1162        }
1163
1164      @Override
1165      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1166        switch (hash) {
1167        case 530040176: /*substance*/ return this.substance == null ? new Base[0] : new Base[] {this.substance}; // CodeableConcept
1168        case -1404142937: /*certainty*/ return this.certainty == null ? new Base[0] : new Base[] {this.certainty}; // Enumeration<AllergyIntoleranceCertainty>
1169        case 1115984422: /*manifestation*/ return this.manifestation == null ? new Base[0] : this.manifestation.toArray(new Base[this.manifestation.size()]); // CodeableConcept
1170        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1171        case 105901603: /*onset*/ return this.onset == null ? new Base[0] : new Base[] {this.onset}; // DateTimeType
1172        case 1478300413: /*severity*/ return this.severity == null ? new Base[0] : new Base[] {this.severity}; // Enumeration<AllergyIntoleranceSeverity>
1173        case 421286274: /*exposureRoute*/ return this.exposureRoute == null ? new Base[0] : new Base[] {this.exposureRoute}; // CodeableConcept
1174        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
1175        default: return super.getProperty(hash, name, checkValid);
1176        }
1177
1178      }
1179
1180      @Override
1181      public void setProperty(int hash, String name, Base value) throws FHIRException {
1182        switch (hash) {
1183        case 530040176: // substance
1184          this.substance = castToCodeableConcept(value); // CodeableConcept
1185          break;
1186        case -1404142937: // certainty
1187          this.certainty = new AllergyIntoleranceCertaintyEnumFactory().fromType(value); // Enumeration<AllergyIntoleranceCertainty>
1188          break;
1189        case 1115984422: // manifestation
1190          this.getManifestation().add(castToCodeableConcept(value)); // CodeableConcept
1191          break;
1192        case -1724546052: // description
1193          this.description = castToString(value); // StringType
1194          break;
1195        case 105901603: // onset
1196          this.onset = castToDateTime(value); // DateTimeType
1197          break;
1198        case 1478300413: // severity
1199          this.severity = new AllergyIntoleranceSeverityEnumFactory().fromType(value); // Enumeration<AllergyIntoleranceSeverity>
1200          break;
1201        case 421286274: // exposureRoute
1202          this.exposureRoute = castToCodeableConcept(value); // CodeableConcept
1203          break;
1204        case 3387378: // note
1205          this.getNote().add(castToAnnotation(value)); // Annotation
1206          break;
1207        default: super.setProperty(hash, name, value);
1208        }
1209
1210      }
1211
1212      @Override
1213      public void setProperty(String name, Base value) throws FHIRException {
1214        if (name.equals("substance"))
1215          this.substance = castToCodeableConcept(value); // CodeableConcept
1216        else if (name.equals("certainty"))
1217          this.certainty = new AllergyIntoleranceCertaintyEnumFactory().fromType(value); // Enumeration<AllergyIntoleranceCertainty>
1218        else if (name.equals("manifestation"))
1219          this.getManifestation().add(castToCodeableConcept(value));
1220        else if (name.equals("description"))
1221          this.description = castToString(value); // StringType
1222        else if (name.equals("onset"))
1223          this.onset = castToDateTime(value); // DateTimeType
1224        else if (name.equals("severity"))
1225          this.severity = new AllergyIntoleranceSeverityEnumFactory().fromType(value); // Enumeration<AllergyIntoleranceSeverity>
1226        else if (name.equals("exposureRoute"))
1227          this.exposureRoute = castToCodeableConcept(value); // CodeableConcept
1228        else if (name.equals("note"))
1229          this.getNote().add(castToAnnotation(value));
1230        else
1231          super.setProperty(name, value);
1232      }
1233
1234      @Override
1235      public Base makeProperty(int hash, String name) throws FHIRException {
1236        switch (hash) {
1237        case 530040176:  return getSubstance(); // CodeableConcept
1238        case -1404142937: throw new FHIRException("Cannot make property certainty as it is not a complex type"); // Enumeration<AllergyIntoleranceCertainty>
1239        case 1115984422:  return addManifestation(); // CodeableConcept
1240        case -1724546052: throw new FHIRException("Cannot make property description as it is not a complex type"); // StringType
1241        case 105901603: throw new FHIRException("Cannot make property onset as it is not a complex type"); // DateTimeType
1242        case 1478300413: throw new FHIRException("Cannot make property severity as it is not a complex type"); // Enumeration<AllergyIntoleranceSeverity>
1243        case 421286274:  return getExposureRoute(); // CodeableConcept
1244        case 3387378:  return addNote(); // Annotation
1245        default: return super.makeProperty(hash, name);
1246        }
1247
1248      }
1249
1250      @Override
1251      public Base addChild(String name) throws FHIRException {
1252        if (name.equals("substance")) {
1253          this.substance = new CodeableConcept();
1254          return this.substance;
1255        }
1256        else if (name.equals("certainty")) {
1257          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.certainty");
1258        }
1259        else if (name.equals("manifestation")) {
1260          return addManifestation();
1261        }
1262        else if (name.equals("description")) {
1263          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.description");
1264        }
1265        else if (name.equals("onset")) {
1266          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.onset");
1267        }
1268        else if (name.equals("severity")) {
1269          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.severity");
1270        }
1271        else if (name.equals("exposureRoute")) {
1272          this.exposureRoute = new CodeableConcept();
1273          return this.exposureRoute;
1274        }
1275        else if (name.equals("note")) {
1276          return addNote();
1277        }
1278        else
1279          return super.addChild(name);
1280      }
1281
1282      public AllergyIntoleranceReactionComponent copy() {
1283        AllergyIntoleranceReactionComponent dst = new AllergyIntoleranceReactionComponent();
1284        copyValues(dst);
1285        dst.substance = substance == null ? null : substance.copy();
1286        dst.certainty = certainty == null ? null : certainty.copy();
1287        if (manifestation != null) {
1288          dst.manifestation = new ArrayList<CodeableConcept>();
1289          for (CodeableConcept i : manifestation)
1290            dst.manifestation.add(i.copy());
1291        };
1292        dst.description = description == null ? null : description.copy();
1293        dst.onset = onset == null ? null : onset.copy();
1294        dst.severity = severity == null ? null : severity.copy();
1295        dst.exposureRoute = exposureRoute == null ? null : exposureRoute.copy();
1296        if (note != null) {
1297          dst.note = new ArrayList<Annotation>();
1298          for (Annotation i : note)
1299            dst.note.add(i.copy());
1300        };
1301        return dst;
1302      }
1303
1304      @Override
1305      public boolean equalsDeep(Base other) {
1306        if (!super.equalsDeep(other))
1307          return false;
1308        if (!(other instanceof AllergyIntoleranceReactionComponent))
1309          return false;
1310        AllergyIntoleranceReactionComponent o = (AllergyIntoleranceReactionComponent) other;
1311        return compareDeep(substance, o.substance, true) && compareDeep(certainty, o.certainty, true) && compareDeep(manifestation, o.manifestation, true)
1312           && compareDeep(description, o.description, true) && compareDeep(onset, o.onset, true) && compareDeep(severity, o.severity, true)
1313           && compareDeep(exposureRoute, o.exposureRoute, true) && compareDeep(note, o.note, true);
1314      }
1315
1316      @Override
1317      public boolean equalsShallow(Base other) {
1318        if (!super.equalsShallow(other))
1319          return false;
1320        if (!(other instanceof AllergyIntoleranceReactionComponent))
1321          return false;
1322        AllergyIntoleranceReactionComponent o = (AllergyIntoleranceReactionComponent) other;
1323        return compareValues(certainty, o.certainty, true) && compareValues(description, o.description, true)
1324           && compareValues(onset, o.onset, true) && compareValues(severity, o.severity, true);
1325      }
1326
1327      public boolean isEmpty() {
1328        return super.isEmpty() && (substance == null || substance.isEmpty()) && (certainty == null || certainty.isEmpty())
1329           && (manifestation == null || manifestation.isEmpty()) && (description == null || description.isEmpty())
1330           && (onset == null || onset.isEmpty()) && (severity == null || severity.isEmpty()) && (exposureRoute == null || exposureRoute.isEmpty())
1331           && (note == null || note.isEmpty());
1332      }
1333
1334  public String fhirType() {
1335    return "AllergyIntolerance.reaction";
1336
1337  }
1338
1339  }
1340
1341    /**
1342     * This records identifiers associated with this allergy/intolerance concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).
1343     */
1344    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1345    @Description(shortDefinition="External ids for this item", formalDefinition="This records identifiers associated with this allergy/intolerance concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation)." )
1346    protected List<Identifier> identifier;
1347
1348    /**
1349     * Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified Substance.
1350     */
1351    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
1352    @Description(shortDefinition="active | unconfirmed | confirmed | inactive | resolved | refuted | entered-in-error", formalDefinition="Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified Substance." )
1353    protected Enumeration<AllergyIntoleranceStatus> status;
1354
1355    /**
1356     * Identification of the underlying physiological mechanism for the reaction risk.
1357     */
1358    @Child(name = "type", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1359    @Description(shortDefinition="allergy | intolerance - Underlying mechanism (if known)", formalDefinition="Identification of the underlying physiological mechanism for the reaction risk." )
1360    protected Enumeration<AllergyIntoleranceType> type;
1361
1362    /**
1363     * Category of the identified Substance.
1364     */
1365    @Child(name = "category", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1366    @Description(shortDefinition="food | medication | environment | other - Category of Substance", formalDefinition="Category of the identified Substance." )
1367    protected Enumeration<AllergyIntoleranceCategory> category;
1368
1369    /**
1370     * Estimate of the potential clinical harm, or seriousness, of the reaction to the identified Substance.
1371     */
1372    @Child(name = "criticality", type = {CodeType.class}, order=4, min=0, max=1, modifier=false, summary=true)
1373    @Description(shortDefinition="low | high | unable-to-assess", formalDefinition="Estimate of the potential clinical harm, or seriousness, of the reaction to the identified Substance." )
1374    protected Enumeration<AllergyIntoleranceCriticality> criticality;
1375
1376    /**
1377     * Identification of a substance, or a class of substances, that is considered to be responsible for the adverse reaction risk.
1378     */
1379    @Child(name = "substance", type = {CodeableConcept.class}, order=5, min=1, max=1, modifier=false, summary=true)
1380    @Description(shortDefinition="Substance, (or class) considered to be responsible for risk", formalDefinition="Identification of a substance, or a class of substances, that is considered to be responsible for the adverse reaction risk." )
1381    protected CodeableConcept substance;
1382
1383    /**
1384     * The patient who has the allergy or intolerance.
1385     */
1386    @Child(name = "patient", type = {Patient.class}, order=6, min=1, max=1, modifier=false, summary=true)
1387    @Description(shortDefinition="Who the sensitivity is for", formalDefinition="The patient who has the allergy or intolerance." )
1388    protected Reference patient;
1389
1390    /**
1391     * The actual object that is the target of the reference (The patient who has the allergy or intolerance.)
1392     */
1393    protected Patient patientTarget;
1394
1395    /**
1396     * Date when the sensitivity was recorded.
1397     */
1398    @Child(name = "recordedDate", type = {DateTimeType.class}, order=7, min=0, max=1, modifier=false, summary=true)
1399    @Description(shortDefinition="When recorded", formalDefinition="Date when the sensitivity was recorded." )
1400    protected DateTimeType recordedDate;
1401
1402    /**
1403     * Individual who recorded the record and takes responsibility for its content.
1404     */
1405    @Child(name = "recorder", type = {Practitioner.class, Patient.class}, order=8, min=0, max=1, modifier=false, summary=true)
1406    @Description(shortDefinition="Who recorded the sensitivity", formalDefinition="Individual who recorded the record and takes responsibility for its content." )
1407    protected Reference recorder;
1408
1409    /**
1410     * The actual object that is the target of the reference (Individual who recorded the record and takes responsibility for its content.)
1411     */
1412    protected Resource recorderTarget;
1413
1414    /**
1415     * The source of the information about the allergy that is recorded.
1416     */
1417    @Child(name = "reporter", type = {Patient.class, RelatedPerson.class, Practitioner.class}, order=9, min=0, max=1, modifier=false, summary=true)
1418    @Description(shortDefinition="Source of the information about the allergy", formalDefinition="The source of the information about the allergy that is recorded." )
1419    protected Reference reporter;
1420
1421    /**
1422     * The actual object that is the target of the reference (The source of the information about the allergy that is recorded.)
1423     */
1424    protected Resource reporterTarget;
1425
1426    /**
1427     * Record of the date and/or time of the onset of the Allergy or Intolerance.
1428     */
1429    @Child(name = "onset", type = {DateTimeType.class}, order=10, min=0, max=1, modifier=false, summary=true)
1430    @Description(shortDefinition="Date(/time) when manifestations showed", formalDefinition="Record of the date and/or time of the onset of the Allergy or Intolerance." )
1431    protected DateTimeType onset;
1432
1433    /**
1434     * Represents the date and/or time of the last known occurrence of a reaction event.
1435     */
1436    @Child(name = "lastOccurence", type = {DateTimeType.class}, order=11, min=0, max=1, modifier=false, summary=true)
1437    @Description(shortDefinition="Date(/time) of last known occurrence of a reaction", formalDefinition="Represents the date and/or time of the last known occurrence of a reaction event." )
1438    protected DateTimeType lastOccurence;
1439
1440    /**
1441     * Additional narrative about the propensity for the Adverse Reaction, not captured in other fields.
1442     */
1443    @Child(name = "note", type = {Annotation.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1444    @Description(shortDefinition="Additional text not captured in other fields", formalDefinition="Additional narrative about the propensity for the Adverse Reaction, not captured in other fields." )
1445    protected List<Annotation> note;
1446
1447    /**
1448     * Details about each adverse reaction event linked to exposure to the identified Substance.
1449     */
1450    @Child(name = "reaction", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1451    @Description(shortDefinition="Adverse Reaction Events linked to exposure to substance", formalDefinition="Details about each adverse reaction event linked to exposure to the identified Substance." )
1452    protected List<AllergyIntoleranceReactionComponent> reaction;
1453
1454    private static final long serialVersionUID = 278089117L;
1455
1456  /**
1457   * Constructor
1458   */
1459    public AllergyIntolerance() {
1460      super();
1461    }
1462
1463  /**
1464   * Constructor
1465   */
1466    public AllergyIntolerance(CodeableConcept substance, Reference patient) {
1467      super();
1468      this.substance = substance;
1469      this.patient = patient;
1470    }
1471
1472    /**
1473     * @return {@link #identifier} (This records identifiers associated with this allergy/intolerance concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).)
1474     */
1475    public List<Identifier> getIdentifier() { 
1476      if (this.identifier == null)
1477        this.identifier = new ArrayList<Identifier>();
1478      return this.identifier;
1479    }
1480
1481    public boolean hasIdentifier() { 
1482      if (this.identifier == null)
1483        return false;
1484      for (Identifier item : this.identifier)
1485        if (!item.isEmpty())
1486          return true;
1487      return false;
1488    }
1489
1490    /**
1491     * @return {@link #identifier} (This records identifiers associated with this allergy/intolerance concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).)
1492     */
1493    // syntactic sugar
1494    public Identifier addIdentifier() { //3
1495      Identifier t = new Identifier();
1496      if (this.identifier == null)
1497        this.identifier = new ArrayList<Identifier>();
1498      this.identifier.add(t);
1499      return t;
1500    }
1501
1502    // syntactic sugar
1503    public AllergyIntolerance addIdentifier(Identifier t) { //3
1504      if (t == null)
1505        return this;
1506      if (this.identifier == null)
1507        this.identifier = new ArrayList<Identifier>();
1508      this.identifier.add(t);
1509      return this;
1510    }
1511
1512    /**
1513     * @return {@link #status} (Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified Substance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1514     */
1515    public Enumeration<AllergyIntoleranceStatus> getStatusElement() { 
1516      if (this.status == null)
1517        if (Configuration.errorOnAutoCreate())
1518          throw new Error("Attempt to auto-create AllergyIntolerance.status");
1519        else if (Configuration.doAutoCreate())
1520          this.status = new Enumeration<AllergyIntoleranceStatus>(new AllergyIntoleranceStatusEnumFactory()); // bb
1521      return this.status;
1522    }
1523
1524    public boolean hasStatusElement() { 
1525      return this.status != null && !this.status.isEmpty();
1526    }
1527
1528    public boolean hasStatus() { 
1529      return this.status != null && !this.status.isEmpty();
1530    }
1531
1532    /**
1533     * @param value {@link #status} (Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified Substance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1534     */
1535    public AllergyIntolerance setStatusElement(Enumeration<AllergyIntoleranceStatus> value) { 
1536      this.status = value;
1537      return this;
1538    }
1539
1540    /**
1541     * @return Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified Substance.
1542     */
1543    public AllergyIntoleranceStatus getStatus() { 
1544      return this.status == null ? null : this.status.getValue();
1545    }
1546
1547    /**
1548     * @param value Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified Substance.
1549     */
1550    public AllergyIntolerance setStatus(AllergyIntoleranceStatus value) { 
1551      if (value == null)
1552        this.status = null;
1553      else {
1554        if (this.status == null)
1555          this.status = new Enumeration<AllergyIntoleranceStatus>(new AllergyIntoleranceStatusEnumFactory());
1556        this.status.setValue(value);
1557      }
1558      return this;
1559    }
1560
1561    /**
1562     * @return {@link #type} (Identification of the underlying physiological mechanism for the reaction risk.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1563     */
1564    public Enumeration<AllergyIntoleranceType> getTypeElement() { 
1565      if (this.type == null)
1566        if (Configuration.errorOnAutoCreate())
1567          throw new Error("Attempt to auto-create AllergyIntolerance.type");
1568        else if (Configuration.doAutoCreate())
1569          this.type = new Enumeration<AllergyIntoleranceType>(new AllergyIntoleranceTypeEnumFactory()); // bb
1570      return this.type;
1571    }
1572
1573    public boolean hasTypeElement() { 
1574      return this.type != null && !this.type.isEmpty();
1575    }
1576
1577    public boolean hasType() { 
1578      return this.type != null && !this.type.isEmpty();
1579    }
1580
1581    /**
1582     * @param value {@link #type} (Identification of the underlying physiological mechanism for the reaction risk.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1583     */
1584    public AllergyIntolerance setTypeElement(Enumeration<AllergyIntoleranceType> value) { 
1585      this.type = value;
1586      return this;
1587    }
1588
1589    /**
1590     * @return Identification of the underlying physiological mechanism for the reaction risk.
1591     */
1592    public AllergyIntoleranceType getType() { 
1593      return this.type == null ? null : this.type.getValue();
1594    }
1595
1596    /**
1597     * @param value Identification of the underlying physiological mechanism for the reaction risk.
1598     */
1599    public AllergyIntolerance setType(AllergyIntoleranceType value) { 
1600      if (value == null)
1601        this.type = null;
1602      else {
1603        if (this.type == null)
1604          this.type = new Enumeration<AllergyIntoleranceType>(new AllergyIntoleranceTypeEnumFactory());
1605        this.type.setValue(value);
1606      }
1607      return this;
1608    }
1609
1610    /**
1611     * @return {@link #category} (Category of the identified Substance.). This is the underlying object with id, value and extensions. The accessor "getCategory" gives direct access to the value
1612     */
1613    public Enumeration<AllergyIntoleranceCategory> getCategoryElement() { 
1614      if (this.category == null)
1615        if (Configuration.errorOnAutoCreate())
1616          throw new Error("Attempt to auto-create AllergyIntolerance.category");
1617        else if (Configuration.doAutoCreate())
1618          this.category = new Enumeration<AllergyIntoleranceCategory>(new AllergyIntoleranceCategoryEnumFactory()); // bb
1619      return this.category;
1620    }
1621
1622    public boolean hasCategoryElement() { 
1623      return this.category != null && !this.category.isEmpty();
1624    }
1625
1626    public boolean hasCategory() { 
1627      return this.category != null && !this.category.isEmpty();
1628    }
1629
1630    /**
1631     * @param value {@link #category} (Category of the identified Substance.). This is the underlying object with id, value and extensions. The accessor "getCategory" gives direct access to the value
1632     */
1633    public AllergyIntolerance setCategoryElement(Enumeration<AllergyIntoleranceCategory> value) { 
1634      this.category = value;
1635      return this;
1636    }
1637
1638    /**
1639     * @return Category of the identified Substance.
1640     */
1641    public AllergyIntoleranceCategory getCategory() { 
1642      return this.category == null ? null : this.category.getValue();
1643    }
1644
1645    /**
1646     * @param value Category of the identified Substance.
1647     */
1648    public AllergyIntolerance setCategory(AllergyIntoleranceCategory value) { 
1649      if (value == null)
1650        this.category = null;
1651      else {
1652        if (this.category == null)
1653          this.category = new Enumeration<AllergyIntoleranceCategory>(new AllergyIntoleranceCategoryEnumFactory());
1654        this.category.setValue(value);
1655      }
1656      return this;
1657    }
1658
1659    /**
1660     * @return {@link #criticality} (Estimate of the potential clinical harm, or seriousness, of the reaction to the identified Substance.). This is the underlying object with id, value and extensions. The accessor "getCriticality" gives direct access to the value
1661     */
1662    public Enumeration<AllergyIntoleranceCriticality> getCriticalityElement() { 
1663      if (this.criticality == null)
1664        if (Configuration.errorOnAutoCreate())
1665          throw new Error("Attempt to auto-create AllergyIntolerance.criticality");
1666        else if (Configuration.doAutoCreate())
1667          this.criticality = new Enumeration<AllergyIntoleranceCriticality>(new AllergyIntoleranceCriticalityEnumFactory()); // bb
1668      return this.criticality;
1669    }
1670
1671    public boolean hasCriticalityElement() { 
1672      return this.criticality != null && !this.criticality.isEmpty();
1673    }
1674
1675    public boolean hasCriticality() { 
1676      return this.criticality != null && !this.criticality.isEmpty();
1677    }
1678
1679    /**
1680     * @param value {@link #criticality} (Estimate of the potential clinical harm, or seriousness, of the reaction to the identified Substance.). This is the underlying object with id, value and extensions. The accessor "getCriticality" gives direct access to the value
1681     */
1682    public AllergyIntolerance setCriticalityElement(Enumeration<AllergyIntoleranceCriticality> value) { 
1683      this.criticality = value;
1684      return this;
1685    }
1686
1687    /**
1688     * @return Estimate of the potential clinical harm, or seriousness, of the reaction to the identified Substance.
1689     */
1690    public AllergyIntoleranceCriticality getCriticality() { 
1691      return this.criticality == null ? null : this.criticality.getValue();
1692    }
1693
1694    /**
1695     * @param value Estimate of the potential clinical harm, or seriousness, of the reaction to the identified Substance.
1696     */
1697    public AllergyIntolerance setCriticality(AllergyIntoleranceCriticality value) { 
1698      if (value == null)
1699        this.criticality = null;
1700      else {
1701        if (this.criticality == null)
1702          this.criticality = new Enumeration<AllergyIntoleranceCriticality>(new AllergyIntoleranceCriticalityEnumFactory());
1703        this.criticality.setValue(value);
1704      }
1705      return this;
1706    }
1707
1708    /**
1709     * @return {@link #substance} (Identification of a substance, or a class of substances, that is considered to be responsible for the adverse reaction risk.)
1710     */
1711    public CodeableConcept getSubstance() { 
1712      if (this.substance == null)
1713        if (Configuration.errorOnAutoCreate())
1714          throw new Error("Attempt to auto-create AllergyIntolerance.substance");
1715        else if (Configuration.doAutoCreate())
1716          this.substance = new CodeableConcept(); // cc
1717      return this.substance;
1718    }
1719
1720    public boolean hasSubstance() { 
1721      return this.substance != null && !this.substance.isEmpty();
1722    }
1723
1724    /**
1725     * @param value {@link #substance} (Identification of a substance, or a class of substances, that is considered to be responsible for the adverse reaction risk.)
1726     */
1727    public AllergyIntolerance setSubstance(CodeableConcept value) { 
1728      this.substance = value;
1729      return this;
1730    }
1731
1732    /**
1733     * @return {@link #patient} (The patient who has the allergy or intolerance.)
1734     */
1735    public Reference getPatient() { 
1736      if (this.patient == null)
1737        if (Configuration.errorOnAutoCreate())
1738          throw new Error("Attempt to auto-create AllergyIntolerance.patient");
1739        else if (Configuration.doAutoCreate())
1740          this.patient = new Reference(); // cc
1741      return this.patient;
1742    }
1743
1744    public boolean hasPatient() { 
1745      return this.patient != null && !this.patient.isEmpty();
1746    }
1747
1748    /**
1749     * @param value {@link #patient} (The patient who has the allergy or intolerance.)
1750     */
1751    public AllergyIntolerance setPatient(Reference value) { 
1752      this.patient = value;
1753      return this;
1754    }
1755
1756    /**
1757     * @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 who has the allergy or intolerance.)
1758     */
1759    public Patient getPatientTarget() { 
1760      if (this.patientTarget == null)
1761        if (Configuration.errorOnAutoCreate())
1762          throw new Error("Attempt to auto-create AllergyIntolerance.patient");
1763        else if (Configuration.doAutoCreate())
1764          this.patientTarget = new Patient(); // aa
1765      return this.patientTarget;
1766    }
1767
1768    /**
1769     * @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 who has the allergy or intolerance.)
1770     */
1771    public AllergyIntolerance setPatientTarget(Patient value) { 
1772      this.patientTarget = value;
1773      return this;
1774    }
1775
1776    /**
1777     * @return {@link #recordedDate} (Date when the sensitivity was recorded.). This is the underlying object with id, value and extensions. The accessor "getRecordedDate" gives direct access to the value
1778     */
1779    public DateTimeType getRecordedDateElement() { 
1780      if (this.recordedDate == null)
1781        if (Configuration.errorOnAutoCreate())
1782          throw new Error("Attempt to auto-create AllergyIntolerance.recordedDate");
1783        else if (Configuration.doAutoCreate())
1784          this.recordedDate = new DateTimeType(); // bb
1785      return this.recordedDate;
1786    }
1787
1788    public boolean hasRecordedDateElement() { 
1789      return this.recordedDate != null && !this.recordedDate.isEmpty();
1790    }
1791
1792    public boolean hasRecordedDate() { 
1793      return this.recordedDate != null && !this.recordedDate.isEmpty();
1794    }
1795
1796    /**
1797     * @param value {@link #recordedDate} (Date when the sensitivity was recorded.). This is the underlying object with id, value and extensions. The accessor "getRecordedDate" gives direct access to the value
1798     */
1799    public AllergyIntolerance setRecordedDateElement(DateTimeType value) { 
1800      this.recordedDate = value;
1801      return this;
1802    }
1803
1804    /**
1805     * @return Date when the sensitivity was recorded.
1806     */
1807    public Date getRecordedDate() { 
1808      return this.recordedDate == null ? null : this.recordedDate.getValue();
1809    }
1810
1811    /**
1812     * @param value Date when the sensitivity was recorded.
1813     */
1814    public AllergyIntolerance setRecordedDate(Date value) { 
1815      if (value == null)
1816        this.recordedDate = null;
1817      else {
1818        if (this.recordedDate == null)
1819          this.recordedDate = new DateTimeType();
1820        this.recordedDate.setValue(value);
1821      }
1822      return this;
1823    }
1824
1825    /**
1826     * @return {@link #recorder} (Individual who recorded the record and takes responsibility for its content.)
1827     */
1828    public Reference getRecorder() { 
1829      if (this.recorder == null)
1830        if (Configuration.errorOnAutoCreate())
1831          throw new Error("Attempt to auto-create AllergyIntolerance.recorder");
1832        else if (Configuration.doAutoCreate())
1833          this.recorder = new Reference(); // cc
1834      return this.recorder;
1835    }
1836
1837    public boolean hasRecorder() { 
1838      return this.recorder != null && !this.recorder.isEmpty();
1839    }
1840
1841    /**
1842     * @param value {@link #recorder} (Individual who recorded the record and takes responsibility for its content.)
1843     */
1844    public AllergyIntolerance setRecorder(Reference value) { 
1845      this.recorder = value;
1846      return this;
1847    }
1848
1849    /**
1850     * @return {@link #recorder} 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. (Individual who recorded the record and takes responsibility for its content.)
1851     */
1852    public Resource getRecorderTarget() { 
1853      return this.recorderTarget;
1854    }
1855
1856    /**
1857     * @param value {@link #recorder} 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. (Individual who recorded the record and takes responsibility for its content.)
1858     */
1859    public AllergyIntolerance setRecorderTarget(Resource value) { 
1860      this.recorderTarget = value;
1861      return this;
1862    }
1863
1864    /**
1865     * @return {@link #reporter} (The source of the information about the allergy that is recorded.)
1866     */
1867    public Reference getReporter() { 
1868      if (this.reporter == null)
1869        if (Configuration.errorOnAutoCreate())
1870          throw new Error("Attempt to auto-create AllergyIntolerance.reporter");
1871        else if (Configuration.doAutoCreate())
1872          this.reporter = new Reference(); // cc
1873      return this.reporter;
1874    }
1875
1876    public boolean hasReporter() { 
1877      return this.reporter != null && !this.reporter.isEmpty();
1878    }
1879
1880    /**
1881     * @param value {@link #reporter} (The source of the information about the allergy that is recorded.)
1882     */
1883    public AllergyIntolerance setReporter(Reference value) { 
1884      this.reporter = value;
1885      return this;
1886    }
1887
1888    /**
1889     * @return {@link #reporter} 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 source of the information about the allergy that is recorded.)
1890     */
1891    public Resource getReporterTarget() { 
1892      return this.reporterTarget;
1893    }
1894
1895    /**
1896     * @param value {@link #reporter} 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 source of the information about the allergy that is recorded.)
1897     */
1898    public AllergyIntolerance setReporterTarget(Resource value) { 
1899      this.reporterTarget = value;
1900      return this;
1901    }
1902
1903    /**
1904     * @return {@link #onset} (Record of the date and/or time of the onset of the Allergy or Intolerance.). This is the underlying object with id, value and extensions. The accessor "getOnset" gives direct access to the value
1905     */
1906    public DateTimeType getOnsetElement() { 
1907      if (this.onset == null)
1908        if (Configuration.errorOnAutoCreate())
1909          throw new Error("Attempt to auto-create AllergyIntolerance.onset");
1910        else if (Configuration.doAutoCreate())
1911          this.onset = new DateTimeType(); // bb
1912      return this.onset;
1913    }
1914
1915    public boolean hasOnsetElement() { 
1916      return this.onset != null && !this.onset.isEmpty();
1917    }
1918
1919    public boolean hasOnset() { 
1920      return this.onset != null && !this.onset.isEmpty();
1921    }
1922
1923    /**
1924     * @param value {@link #onset} (Record of the date and/or time of the onset of the Allergy or Intolerance.). This is the underlying object with id, value and extensions. The accessor "getOnset" gives direct access to the value
1925     */
1926    public AllergyIntolerance setOnsetElement(DateTimeType value) { 
1927      this.onset = value;
1928      return this;
1929    }
1930
1931    /**
1932     * @return Record of the date and/or time of the onset of the Allergy or Intolerance.
1933     */
1934    public Date getOnset() { 
1935      return this.onset == null ? null : this.onset.getValue();
1936    }
1937
1938    /**
1939     * @param value Record of the date and/or time of the onset of the Allergy or Intolerance.
1940     */
1941    public AllergyIntolerance setOnset(Date value) { 
1942      if (value == null)
1943        this.onset = null;
1944      else {
1945        if (this.onset == null)
1946          this.onset = new DateTimeType();
1947        this.onset.setValue(value);
1948      }
1949      return this;
1950    }
1951
1952    /**
1953     * @return {@link #lastOccurence} (Represents the date and/or time of the last known occurrence of a reaction event.). This is the underlying object with id, value and extensions. The accessor "getLastOccurence" gives direct access to the value
1954     */
1955    public DateTimeType getLastOccurenceElement() { 
1956      if (this.lastOccurence == null)
1957        if (Configuration.errorOnAutoCreate())
1958          throw new Error("Attempt to auto-create AllergyIntolerance.lastOccurence");
1959        else if (Configuration.doAutoCreate())
1960          this.lastOccurence = new DateTimeType(); // bb
1961      return this.lastOccurence;
1962    }
1963
1964    public boolean hasLastOccurenceElement() { 
1965      return this.lastOccurence != null && !this.lastOccurence.isEmpty();
1966    }
1967
1968    public boolean hasLastOccurence() { 
1969      return this.lastOccurence != null && !this.lastOccurence.isEmpty();
1970    }
1971
1972    /**
1973     * @param value {@link #lastOccurence} (Represents the date and/or time of the last known occurrence of a reaction event.). This is the underlying object with id, value and extensions. The accessor "getLastOccurence" gives direct access to the value
1974     */
1975    public AllergyIntolerance setLastOccurenceElement(DateTimeType value) { 
1976      this.lastOccurence = value;
1977      return this;
1978    }
1979
1980    /**
1981     * @return Represents the date and/or time of the last known occurrence of a reaction event.
1982     */
1983    public Date getLastOccurence() { 
1984      return this.lastOccurence == null ? null : this.lastOccurence.getValue();
1985    }
1986
1987    /**
1988     * @param value Represents the date and/or time of the last known occurrence of a reaction event.
1989     */
1990    public AllergyIntolerance setLastOccurence(Date value) { 
1991      if (value == null)
1992        this.lastOccurence = null;
1993      else {
1994        if (this.lastOccurence == null)
1995          this.lastOccurence = new DateTimeType();
1996        this.lastOccurence.setValue(value);
1997      }
1998      return this;
1999    }
2000
2001    /**
2002     * @return {@link #note} (Additional narrative about the propensity for the Adverse Reaction, not captured in other fields.)
2003     */
2004    public List<Annotation> getNote() { 
2005      if (this.note == null)
2006        this.note = new ArrayList<Annotation>();
2007      return this.note;
2008    }
2009
2010    public boolean hasNote() { 
2011      if (this.note == null)
2012        return false;
2013      for (Annotation item : this.note)
2014        if (!item.isEmpty())
2015          return true;
2016      return false;
2017    }
2018
2019    /**
2020     * @return {@link #note} (Additional narrative about the propensity for the Adverse Reaction, not captured in other fields.)
2021     */
2022    // syntactic sugar
2023    public Annotation addNote() { //3
2024      Annotation t = new Annotation();
2025      if (this.note == null)
2026        this.note = new ArrayList<Annotation>();
2027      this.note.add(t);
2028      return t;
2029    }
2030
2031    // syntactic sugar
2032    public AllergyIntolerance addNote(Annotation t) { //3
2033      if (t == null)
2034        return this;
2035      if (this.note == null)
2036        this.note = new ArrayList<Annotation>();
2037      this.note.add(t);
2038      return this;
2039    }
2040
2041    /**
2042     * @return {@link #reaction} (Details about each adverse reaction event linked to exposure to the identified Substance.)
2043     */
2044    public List<AllergyIntoleranceReactionComponent> getReaction() { 
2045      if (this.reaction == null)
2046        this.reaction = new ArrayList<AllergyIntoleranceReactionComponent>();
2047      return this.reaction;
2048    }
2049
2050    public boolean hasReaction() { 
2051      if (this.reaction == null)
2052        return false;
2053      for (AllergyIntoleranceReactionComponent item : this.reaction)
2054        if (!item.isEmpty())
2055          return true;
2056      return false;
2057    }
2058
2059    /**
2060     * @return {@link #reaction} (Details about each adverse reaction event linked to exposure to the identified Substance.)
2061     */
2062    // syntactic sugar
2063    public AllergyIntoleranceReactionComponent addReaction() { //3
2064      AllergyIntoleranceReactionComponent t = new AllergyIntoleranceReactionComponent();
2065      if (this.reaction == null)
2066        this.reaction = new ArrayList<AllergyIntoleranceReactionComponent>();
2067      this.reaction.add(t);
2068      return t;
2069    }
2070
2071    // syntactic sugar
2072    public AllergyIntolerance addReaction(AllergyIntoleranceReactionComponent t) { //3
2073      if (t == null)
2074        return this;
2075      if (this.reaction == null)
2076        this.reaction = new ArrayList<AllergyIntoleranceReactionComponent>();
2077      this.reaction.add(t);
2078      return this;
2079    }
2080
2081      protected void listChildren(List<Property> childrenList) {
2082        super.listChildren(childrenList);
2083        childrenList.add(new Property("identifier", "Identifier", "This records identifiers associated with this allergy/intolerance concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).", 0, java.lang.Integer.MAX_VALUE, identifier));
2084        childrenList.add(new Property("status", "code", "Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified Substance.", 0, java.lang.Integer.MAX_VALUE, status));
2085        childrenList.add(new Property("type", "code", "Identification of the underlying physiological mechanism for the reaction risk.", 0, java.lang.Integer.MAX_VALUE, type));
2086        childrenList.add(new Property("category", "code", "Category of the identified Substance.", 0, java.lang.Integer.MAX_VALUE, category));
2087        childrenList.add(new Property("criticality", "code", "Estimate of the potential clinical harm, or seriousness, of the reaction to the identified Substance.", 0, java.lang.Integer.MAX_VALUE, criticality));
2088        childrenList.add(new Property("substance", "CodeableConcept", "Identification of a substance, or a class of substances, that is considered to be responsible for the adverse reaction risk.", 0, java.lang.Integer.MAX_VALUE, substance));
2089        childrenList.add(new Property("patient", "Reference(Patient)", "The patient who has the allergy or intolerance.", 0, java.lang.Integer.MAX_VALUE, patient));
2090        childrenList.add(new Property("recordedDate", "dateTime", "Date when the sensitivity was recorded.", 0, java.lang.Integer.MAX_VALUE, recordedDate));
2091        childrenList.add(new Property("recorder", "Reference(Practitioner|Patient)", "Individual who recorded the record and takes responsibility for its content.", 0, java.lang.Integer.MAX_VALUE, recorder));
2092        childrenList.add(new Property("reporter", "Reference(Patient|RelatedPerson|Practitioner)", "The source of the information about the allergy that is recorded.", 0, java.lang.Integer.MAX_VALUE, reporter));
2093        childrenList.add(new Property("onset", "dateTime", "Record of the date and/or time of the onset of the Allergy or Intolerance.", 0, java.lang.Integer.MAX_VALUE, onset));
2094        childrenList.add(new Property("lastOccurence", "dateTime", "Represents the date and/or time of the last known occurrence of a reaction event.", 0, java.lang.Integer.MAX_VALUE, lastOccurence));
2095        childrenList.add(new Property("note", "Annotation", "Additional narrative about the propensity for the Adverse Reaction, not captured in other fields.", 0, java.lang.Integer.MAX_VALUE, note));
2096        childrenList.add(new Property("reaction", "", "Details about each adverse reaction event linked to exposure to the identified Substance.", 0, java.lang.Integer.MAX_VALUE, reaction));
2097      }
2098
2099      @Override
2100      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2101        switch (hash) {
2102        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2103        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<AllergyIntoleranceStatus>
2104        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<AllergyIntoleranceType>
2105        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // Enumeration<AllergyIntoleranceCategory>
2106        case -1608054609: /*criticality*/ return this.criticality == null ? new Base[0] : new Base[] {this.criticality}; // Enumeration<AllergyIntoleranceCriticality>
2107        case 530040176: /*substance*/ return this.substance == null ? new Base[0] : new Base[] {this.substance}; // CodeableConcept
2108        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
2109        case -1952893826: /*recordedDate*/ return this.recordedDate == null ? new Base[0] : new Base[] {this.recordedDate}; // DateTimeType
2110        case -799233858: /*recorder*/ return this.recorder == null ? new Base[0] : new Base[] {this.recorder}; // Reference
2111        case -427039519: /*reporter*/ return this.reporter == null ? new Base[0] : new Base[] {this.reporter}; // Reference
2112        case 105901603: /*onset*/ return this.onset == null ? new Base[0] : new Base[] {this.onset}; // DateTimeType
2113        case 1307739841: /*lastOccurence*/ return this.lastOccurence == null ? new Base[0] : new Base[] {this.lastOccurence}; // DateTimeType
2114        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2115        case -867509719: /*reaction*/ return this.reaction == null ? new Base[0] : this.reaction.toArray(new Base[this.reaction.size()]); // AllergyIntoleranceReactionComponent
2116        default: return super.getProperty(hash, name, checkValid);
2117        }
2118
2119      }
2120
2121      @Override
2122      public void setProperty(int hash, String name, Base value) throws FHIRException {
2123        switch (hash) {
2124        case -1618432855: // identifier
2125          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2126          break;
2127        case -892481550: // status
2128          this.status = new AllergyIntoleranceStatusEnumFactory().fromType(value); // Enumeration<AllergyIntoleranceStatus>
2129          break;
2130        case 3575610: // type
2131          this.type = new AllergyIntoleranceTypeEnumFactory().fromType(value); // Enumeration<AllergyIntoleranceType>
2132          break;
2133        case 50511102: // category
2134          this.category = new AllergyIntoleranceCategoryEnumFactory().fromType(value); // Enumeration<AllergyIntoleranceCategory>
2135          break;
2136        case -1608054609: // criticality
2137          this.criticality = new AllergyIntoleranceCriticalityEnumFactory().fromType(value); // Enumeration<AllergyIntoleranceCriticality>
2138          break;
2139        case 530040176: // substance
2140          this.substance = castToCodeableConcept(value); // CodeableConcept
2141          break;
2142        case -791418107: // patient
2143          this.patient = castToReference(value); // Reference
2144          break;
2145        case -1952893826: // recordedDate
2146          this.recordedDate = castToDateTime(value); // DateTimeType
2147          break;
2148        case -799233858: // recorder
2149          this.recorder = castToReference(value); // Reference
2150          break;
2151        case -427039519: // reporter
2152          this.reporter = castToReference(value); // Reference
2153          break;
2154        case 105901603: // onset
2155          this.onset = castToDateTime(value); // DateTimeType
2156          break;
2157        case 1307739841: // lastOccurence
2158          this.lastOccurence = castToDateTime(value); // DateTimeType
2159          break;
2160        case 3387378: // note
2161          this.getNote().add(castToAnnotation(value)); // Annotation
2162          break;
2163        case -867509719: // reaction
2164          this.getReaction().add((AllergyIntoleranceReactionComponent) value); // AllergyIntoleranceReactionComponent
2165          break;
2166        default: super.setProperty(hash, name, value);
2167        }
2168
2169      }
2170
2171      @Override
2172      public void setProperty(String name, Base value) throws FHIRException {
2173        if (name.equals("identifier"))
2174          this.getIdentifier().add(castToIdentifier(value));
2175        else if (name.equals("status"))
2176          this.status = new AllergyIntoleranceStatusEnumFactory().fromType(value); // Enumeration<AllergyIntoleranceStatus>
2177        else if (name.equals("type"))
2178          this.type = new AllergyIntoleranceTypeEnumFactory().fromType(value); // Enumeration<AllergyIntoleranceType>
2179        else if (name.equals("category"))
2180          this.category = new AllergyIntoleranceCategoryEnumFactory().fromType(value); // Enumeration<AllergyIntoleranceCategory>
2181        else if (name.equals("criticality"))
2182          this.criticality = new AllergyIntoleranceCriticalityEnumFactory().fromType(value); // Enumeration<AllergyIntoleranceCriticality>
2183        else if (name.equals("substance"))
2184          this.substance = castToCodeableConcept(value); // CodeableConcept
2185        else if (name.equals("patient"))
2186          this.patient = castToReference(value); // Reference
2187        else if (name.equals("recordedDate"))
2188          this.recordedDate = castToDateTime(value); // DateTimeType
2189        else if (name.equals("recorder"))
2190          this.recorder = castToReference(value); // Reference
2191        else if (name.equals("reporter"))
2192          this.reporter = castToReference(value); // Reference
2193        else if (name.equals("onset"))
2194          this.onset = castToDateTime(value); // DateTimeType
2195        else if (name.equals("lastOccurence"))
2196          this.lastOccurence = castToDateTime(value); // DateTimeType
2197        else if (name.equals("note"))
2198          this.getNote().add(castToAnnotation(value));
2199        else if (name.equals("reaction"))
2200          this.getReaction().add((AllergyIntoleranceReactionComponent) value);
2201        else
2202          super.setProperty(name, value);
2203      }
2204
2205      @Override
2206      public Base makeProperty(int hash, String name) throws FHIRException {
2207        switch (hash) {
2208        case -1618432855:  return addIdentifier(); // Identifier
2209        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<AllergyIntoleranceStatus>
2210        case 3575610: throw new FHIRException("Cannot make property type as it is not a complex type"); // Enumeration<AllergyIntoleranceType>
2211        case 50511102: throw new FHIRException("Cannot make property category as it is not a complex type"); // Enumeration<AllergyIntoleranceCategory>
2212        case -1608054609: throw new FHIRException("Cannot make property criticality as it is not a complex type"); // Enumeration<AllergyIntoleranceCriticality>
2213        case 530040176:  return getSubstance(); // CodeableConcept
2214        case -791418107:  return getPatient(); // Reference
2215        case -1952893826: throw new FHIRException("Cannot make property recordedDate as it is not a complex type"); // DateTimeType
2216        case -799233858:  return getRecorder(); // Reference
2217        case -427039519:  return getReporter(); // Reference
2218        case 105901603: throw new FHIRException("Cannot make property onset as it is not a complex type"); // DateTimeType
2219        case 1307739841: throw new FHIRException("Cannot make property lastOccurence as it is not a complex type"); // DateTimeType
2220        case 3387378:  return addNote(); // Annotation
2221        case -867509719:  return addReaction(); // AllergyIntoleranceReactionComponent
2222        default: return super.makeProperty(hash, name);
2223        }
2224
2225      }
2226
2227      @Override
2228      public Base addChild(String name) throws FHIRException {
2229        if (name.equals("identifier")) {
2230          return addIdentifier();
2231        }
2232        else if (name.equals("status")) {
2233          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.status");
2234        }
2235        else if (name.equals("type")) {
2236          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.type");
2237        }
2238        else if (name.equals("category")) {
2239          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.category");
2240        }
2241        else if (name.equals("criticality")) {
2242          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.criticality");
2243        }
2244        else if (name.equals("substance")) {
2245          this.substance = new CodeableConcept();
2246          return this.substance;
2247        }
2248        else if (name.equals("patient")) {
2249          this.patient = new Reference();
2250          return this.patient;
2251        }
2252        else if (name.equals("recordedDate")) {
2253          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.recordedDate");
2254        }
2255        else if (name.equals("recorder")) {
2256          this.recorder = new Reference();
2257          return this.recorder;
2258        }
2259        else if (name.equals("reporter")) {
2260          this.reporter = new Reference();
2261          return this.reporter;
2262        }
2263        else if (name.equals("onset")) {
2264          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.onset");
2265        }
2266        else if (name.equals("lastOccurence")) {
2267          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.lastOccurence");
2268        }
2269        else if (name.equals("note")) {
2270          return addNote();
2271        }
2272        else if (name.equals("reaction")) {
2273          return addReaction();
2274        }
2275        else
2276          return super.addChild(name);
2277      }
2278
2279  public String fhirType() {
2280    return "AllergyIntolerance";
2281
2282  }
2283
2284      public AllergyIntolerance copy() {
2285        AllergyIntolerance dst = new AllergyIntolerance();
2286        copyValues(dst);
2287        if (identifier != null) {
2288          dst.identifier = new ArrayList<Identifier>();
2289          for (Identifier i : identifier)
2290            dst.identifier.add(i.copy());
2291        };
2292        dst.status = status == null ? null : status.copy();
2293        dst.type = type == null ? null : type.copy();
2294        dst.category = category == null ? null : category.copy();
2295        dst.criticality = criticality == null ? null : criticality.copy();
2296        dst.substance = substance == null ? null : substance.copy();
2297        dst.patient = patient == null ? null : patient.copy();
2298        dst.recordedDate = recordedDate == null ? null : recordedDate.copy();
2299        dst.recorder = recorder == null ? null : recorder.copy();
2300        dst.reporter = reporter == null ? null : reporter.copy();
2301        dst.onset = onset == null ? null : onset.copy();
2302        dst.lastOccurence = lastOccurence == null ? null : lastOccurence.copy();
2303        if (note != null) {
2304          dst.note = new ArrayList<Annotation>();
2305          for (Annotation i : note)
2306            dst.note.add(i.copy());
2307        };
2308        if (reaction != null) {
2309          dst.reaction = new ArrayList<AllergyIntoleranceReactionComponent>();
2310          for (AllergyIntoleranceReactionComponent i : reaction)
2311            dst.reaction.add(i.copy());
2312        };
2313        return dst;
2314      }
2315
2316      protected AllergyIntolerance typedCopy() {
2317        return copy();
2318      }
2319
2320      @Override
2321      public boolean equalsDeep(Base other) {
2322        if (!super.equalsDeep(other))
2323          return false;
2324        if (!(other instanceof AllergyIntolerance))
2325          return false;
2326        AllergyIntolerance o = (AllergyIntolerance) other;
2327        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
2328           && compareDeep(category, o.category, true) && compareDeep(criticality, o.criticality, true) && compareDeep(substance, o.substance, true)
2329           && compareDeep(patient, o.patient, true) && compareDeep(recordedDate, o.recordedDate, true) && compareDeep(recorder, o.recorder, true)
2330           && compareDeep(reporter, o.reporter, true) && compareDeep(onset, o.onset, true) && compareDeep(lastOccurence, o.lastOccurence, true)
2331           && compareDeep(note, o.note, true) && compareDeep(reaction, o.reaction, true);
2332      }
2333
2334      @Override
2335      public boolean equalsShallow(Base other) {
2336        if (!super.equalsShallow(other))
2337          return false;
2338        if (!(other instanceof AllergyIntolerance))
2339          return false;
2340        AllergyIntolerance o = (AllergyIntolerance) other;
2341        return compareValues(status, o.status, true) && compareValues(type, o.type, true) && compareValues(category, o.category, true)
2342           && compareValues(criticality, o.criticality, true) && compareValues(recordedDate, o.recordedDate, true)
2343           && compareValues(onset, o.onset, true) && compareValues(lastOccurence, o.lastOccurence, true);
2344      }
2345
2346      public boolean isEmpty() {
2347        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty())
2348           && (type == null || type.isEmpty()) && (category == null || category.isEmpty()) && (criticality == null || criticality.isEmpty())
2349           && (substance == null || substance.isEmpty()) && (patient == null || patient.isEmpty()) && (recordedDate == null || recordedDate.isEmpty())
2350           && (recorder == null || recorder.isEmpty()) && (reporter == null || reporter.isEmpty()) && (onset == null || onset.isEmpty())
2351           && (lastOccurence == null || lastOccurence.isEmpty()) && (note == null || note.isEmpty())
2352           && (reaction == null || reaction.isEmpty());
2353      }
2354
2355  @Override
2356  public ResourceType getResourceType() {
2357    return ResourceType.AllergyIntolerance;
2358   }
2359
2360 /**
2361   * Search parameter: <b>status</b>
2362   * <p>
2363   * Description: <b>active | unconfirmed | confirmed | inactive | resolved | refuted | entered-in-error</b><br>
2364   * Type: <b>token</b><br>
2365   * Path: <b>AllergyIntolerance.status</b><br>
2366   * </p>
2367   */
2368  @SearchParamDefinition(name="status", path="AllergyIntolerance.status", description="active | unconfirmed | confirmed | inactive | resolved | refuted | entered-in-error", type="token" )
2369  public static final String SP_STATUS = "status";
2370 /**
2371   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2372   * <p>
2373   * Description: <b>active | unconfirmed | confirmed | inactive | resolved | refuted | entered-in-error</b><br>
2374   * Type: <b>token</b><br>
2375   * Path: <b>AllergyIntolerance.status</b><br>
2376   * </p>
2377   */
2378  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2379
2380 /**
2381   * Search parameter: <b>onset</b>
2382   * <p>
2383   * Description: <b>Date(/time) when manifestations showed</b><br>
2384   * Type: <b>date</b><br>
2385   * Path: <b>AllergyIntolerance.reaction.onset</b><br>
2386   * </p>
2387   */
2388  @SearchParamDefinition(name="onset", path="AllergyIntolerance.reaction.onset", description="Date(/time) when manifestations showed", type="date" )
2389  public static final String SP_ONSET = "onset";
2390 /**
2391   * <b>Fluent Client</b> search parameter constant for <b>onset</b>
2392   * <p>
2393   * Description: <b>Date(/time) when manifestations showed</b><br>
2394   * Type: <b>date</b><br>
2395   * Path: <b>AllergyIntolerance.reaction.onset</b><br>
2396   * </p>
2397   */
2398  public static final ca.uhn.fhir.rest.gclient.DateClientParam ONSET = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_ONSET);
2399
2400 /**
2401   * Search parameter: <b>last-date</b>
2402   * <p>
2403   * Description: <b>Date(/time) of last known occurrence of a reaction</b><br>
2404   * Type: <b>date</b><br>
2405   * Path: <b>AllergyIntolerance.lastOccurence</b><br>
2406   * </p>
2407   */
2408  @SearchParamDefinition(name="last-date", path="AllergyIntolerance.lastOccurence", description="Date(/time) of last known occurrence of a reaction", type="date" )
2409  public static final String SP_LAST_DATE = "last-date";
2410 /**
2411   * <b>Fluent Client</b> search parameter constant for <b>last-date</b>
2412   * <p>
2413   * Description: <b>Date(/time) of last known occurrence of a reaction</b><br>
2414   * Type: <b>date</b><br>
2415   * Path: <b>AllergyIntolerance.lastOccurence</b><br>
2416   * </p>
2417   */
2418  public static final ca.uhn.fhir.rest.gclient.DateClientParam LAST_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_LAST_DATE);
2419
2420 /**
2421   * Search parameter: <b>severity</b>
2422   * <p>
2423   * Description: <b>mild | moderate | severe (of event as a whole)</b><br>
2424   * Type: <b>token</b><br>
2425   * Path: <b>AllergyIntolerance.reaction.severity</b><br>
2426   * </p>
2427   */
2428  @SearchParamDefinition(name="severity", path="AllergyIntolerance.reaction.severity", description="mild | moderate | severe (of event as a whole)", type="token" )
2429  public static final String SP_SEVERITY = "severity";
2430 /**
2431   * <b>Fluent Client</b> search parameter constant for <b>severity</b>
2432   * <p>
2433   * Description: <b>mild | moderate | severe (of event as a whole)</b><br>
2434   * Type: <b>token</b><br>
2435   * Path: <b>AllergyIntolerance.reaction.severity</b><br>
2436   * </p>
2437   */
2438  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SEVERITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SEVERITY);
2439
2440 /**
2441   * Search parameter: <b>type</b>
2442   * <p>
2443   * Description: <b>allergy | intolerance - Underlying mechanism (if known)</b><br>
2444   * Type: <b>token</b><br>
2445   * Path: <b>AllergyIntolerance.type</b><br>
2446   * </p>
2447   */
2448  @SearchParamDefinition(name="type", path="AllergyIntolerance.type", description="allergy | intolerance - Underlying mechanism (if known)", type="token" )
2449  public static final String SP_TYPE = "type";
2450 /**
2451   * <b>Fluent Client</b> search parameter constant for <b>type</b>
2452   * <p>
2453   * Description: <b>allergy | intolerance - Underlying mechanism (if known)</b><br>
2454   * Type: <b>token</b><br>
2455   * Path: <b>AllergyIntolerance.type</b><br>
2456   * </p>
2457   */
2458  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
2459
2460 /**
2461   * Search parameter: <b>date</b>
2462   * <p>
2463   * Description: <b>When recorded</b><br>
2464   * Type: <b>date</b><br>
2465   * Path: <b>AllergyIntolerance.recordedDate</b><br>
2466   * </p>
2467   */
2468  @SearchParamDefinition(name="date", path="AllergyIntolerance.recordedDate", description="When recorded", type="date" )
2469  public static final String SP_DATE = "date";
2470 /**
2471   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2472   * <p>
2473   * Description: <b>When recorded</b><br>
2474   * Type: <b>date</b><br>
2475   * Path: <b>AllergyIntolerance.recordedDate</b><br>
2476   * </p>
2477   */
2478  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
2479
2480 /**
2481   * Search parameter: <b>reporter</b>
2482   * <p>
2483   * Description: <b>Source of the information about the allergy</b><br>
2484   * Type: <b>reference</b><br>
2485   * Path: <b>AllergyIntolerance.reporter</b><br>
2486   * </p>
2487   */
2488  @SearchParamDefinition(name="reporter", path="AllergyIntolerance.reporter", description="Source of the information about the allergy", type="reference" )
2489  public static final String SP_REPORTER = "reporter";
2490 /**
2491   * <b>Fluent Client</b> search parameter constant for <b>reporter</b>
2492   * <p>
2493   * Description: <b>Source of the information about the allergy</b><br>
2494   * Type: <b>reference</b><br>
2495   * Path: <b>AllergyIntolerance.reporter</b><br>
2496   * </p>
2497   */
2498  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REPORTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REPORTER);
2499
2500/**
2501   * Constant for fluent queries to be used to add include statements. Specifies
2502   * the path value of "<b>AllergyIntolerance:reporter</b>".
2503   */
2504  public static final ca.uhn.fhir.model.api.Include INCLUDE_REPORTER = new ca.uhn.fhir.model.api.Include("AllergyIntolerance:reporter").toLocked();
2505
2506 /**
2507   * Search parameter: <b>substance</b>
2508   * <p>
2509   * Description: <b>Substance, (or class) considered to be responsible for risk</b><br>
2510   * Type: <b>token</b><br>
2511   * Path: <b>AllergyIntolerance.substance, AllergyIntolerance.reaction.substance</b><br>
2512   * </p>
2513   */
2514  @SearchParamDefinition(name="substance", path="AllergyIntolerance.substance | AllergyIntolerance.reaction.substance", description="Substance, (or class) considered to be responsible for risk", type="token" )
2515  public static final String SP_SUBSTANCE = "substance";
2516 /**
2517   * <b>Fluent Client</b> search parameter constant for <b>substance</b>
2518   * <p>
2519   * Description: <b>Substance, (or class) considered to be responsible for risk</b><br>
2520   * Type: <b>token</b><br>
2521   * Path: <b>AllergyIntolerance.substance, AllergyIntolerance.reaction.substance</b><br>
2522   * </p>
2523   */
2524  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SUBSTANCE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SUBSTANCE);
2525
2526 /**
2527   * Search parameter: <b>criticality</b>
2528   * <p>
2529   * Description: <b>low | high | unable-to-assess</b><br>
2530   * Type: <b>token</b><br>
2531   * Path: <b>AllergyIntolerance.criticality</b><br>
2532   * </p>
2533   */
2534  @SearchParamDefinition(name="criticality", path="AllergyIntolerance.criticality", description="low | high | unable-to-assess", type="token" )
2535  public static final String SP_CRITICALITY = "criticality";
2536 /**
2537   * <b>Fluent Client</b> search parameter constant for <b>criticality</b>
2538   * <p>
2539   * Description: <b>low | high | unable-to-assess</b><br>
2540   * Type: <b>token</b><br>
2541   * Path: <b>AllergyIntolerance.criticality</b><br>
2542   * </p>
2543   */
2544  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CRITICALITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CRITICALITY);
2545
2546 /**
2547   * Search parameter: <b>category</b>
2548   * <p>
2549   * Description: <b>food | medication | environment | other - Category of Substance</b><br>
2550   * Type: <b>token</b><br>
2551   * Path: <b>AllergyIntolerance.category</b><br>
2552   * </p>
2553   */
2554  @SearchParamDefinition(name="category", path="AllergyIntolerance.category", description="food | medication | environment | other - Category of Substance", type="token" )
2555  public static final String SP_CATEGORY = "category";
2556 /**
2557   * <b>Fluent Client</b> search parameter constant for <b>category</b>
2558   * <p>
2559   * Description: <b>food | medication | environment | other - Category of Substance</b><br>
2560   * Type: <b>token</b><br>
2561   * Path: <b>AllergyIntolerance.category</b><br>
2562   * </p>
2563   */
2564  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
2565
2566 /**
2567   * Search parameter: <b>patient</b>
2568   * <p>
2569   * Description: <b>Who the sensitivity is for</b><br>
2570   * Type: <b>reference</b><br>
2571   * Path: <b>AllergyIntolerance.patient</b><br>
2572   * </p>
2573   */
2574  @SearchParamDefinition(name="patient", path="AllergyIntolerance.patient", description="Who the sensitivity is for", type="reference" )
2575  public static final String SP_PATIENT = "patient";
2576 /**
2577   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2578   * <p>
2579   * Description: <b>Who the sensitivity is for</b><br>
2580   * Type: <b>reference</b><br>
2581   * Path: <b>AllergyIntolerance.patient</b><br>
2582   * </p>
2583   */
2584  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2585
2586/**
2587   * Constant for fluent queries to be used to add include statements. Specifies
2588   * the path value of "<b>AllergyIntolerance:patient</b>".
2589   */
2590  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("AllergyIntolerance:patient").toLocked();
2591
2592 /**
2593   * Search parameter: <b>recorder</b>
2594   * <p>
2595   * Description: <b>Who recorded the sensitivity</b><br>
2596   * Type: <b>reference</b><br>
2597   * Path: <b>AllergyIntolerance.recorder</b><br>
2598   * </p>
2599   */
2600  @SearchParamDefinition(name="recorder", path="AllergyIntolerance.recorder", description="Who recorded the sensitivity", type="reference" )
2601  public static final String SP_RECORDER = "recorder";
2602 /**
2603   * <b>Fluent Client</b> search parameter constant for <b>recorder</b>
2604   * <p>
2605   * Description: <b>Who recorded the sensitivity</b><br>
2606   * Type: <b>reference</b><br>
2607   * Path: <b>AllergyIntolerance.recorder</b><br>
2608   * </p>
2609   */
2610  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RECORDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RECORDER);
2611
2612/**
2613   * Constant for fluent queries to be used to add include statements. Specifies
2614   * the path value of "<b>AllergyIntolerance:recorder</b>".
2615   */
2616  public static final ca.uhn.fhir.model.api.Include INCLUDE_RECORDER = new ca.uhn.fhir.model.api.Include("AllergyIntolerance:recorder").toLocked();
2617
2618 /**
2619   * Search parameter: <b>route</b>
2620   * <p>
2621   * Description: <b>How the subject was exposed to the substance</b><br>
2622   * Type: <b>token</b><br>
2623   * Path: <b>AllergyIntolerance.reaction.exposureRoute</b><br>
2624   * </p>
2625   */
2626  @SearchParamDefinition(name="route", path="AllergyIntolerance.reaction.exposureRoute", description="How the subject was exposed to the substance", type="token" )
2627  public static final String SP_ROUTE = "route";
2628 /**
2629   * <b>Fluent Client</b> search parameter constant for <b>route</b>
2630   * <p>
2631   * Description: <b>How the subject was exposed to the substance</b><br>
2632   * Type: <b>token</b><br>
2633   * Path: <b>AllergyIntolerance.reaction.exposureRoute</b><br>
2634   * </p>
2635   */
2636  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ROUTE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ROUTE);
2637
2638 /**
2639   * Search parameter: <b>identifier</b>
2640   * <p>
2641   * Description: <b>External ids for this item</b><br>
2642   * Type: <b>token</b><br>
2643   * Path: <b>AllergyIntolerance.identifier</b><br>
2644   * </p>
2645   */
2646  @SearchParamDefinition(name="identifier", path="AllergyIntolerance.identifier", description="External ids for this item", type="token" )
2647  public static final String SP_IDENTIFIER = "identifier";
2648 /**
2649   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2650   * <p>
2651   * Description: <b>External ids for this item</b><br>
2652   * Type: <b>token</b><br>
2653   * Path: <b>AllergyIntolerance.identifier</b><br>
2654   * </p>
2655   */
2656  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2657
2658 /**
2659   * Search parameter: <b>manifestation</b>
2660   * <p>
2661   * Description: <b>Clinical symptoms/signs associated with the Event</b><br>
2662   * Type: <b>token</b><br>
2663   * Path: <b>AllergyIntolerance.reaction.manifestation</b><br>
2664   * </p>
2665   */
2666  @SearchParamDefinition(name="manifestation", path="AllergyIntolerance.reaction.manifestation", description="Clinical symptoms/signs associated with the Event", type="token" )
2667  public static final String SP_MANIFESTATION = "manifestation";
2668 /**
2669   * <b>Fluent Client</b> search parameter constant for <b>manifestation</b>
2670   * <p>
2671   * Description: <b>Clinical symptoms/signs associated with the Event</b><br>
2672   * Type: <b>token</b><br>
2673   * Path: <b>AllergyIntolerance.reaction.manifestation</b><br>
2674   * </p>
2675   */
2676  public static final ca.uhn.fhir.rest.gclient.TokenClientParam MANIFESTATION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_MANIFESTATION);
2677
2678
2679}