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.List;
038
039import org.hl7.fhir.exceptions.FHIRException;
040
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.ResourceDef;
044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
045/**
046 * Prospective warnings of potential issues when providing care to the patient.
047 */
048@ResourceDef(name="Flag", profile="http://hl7.org/fhir/Profile/Flag")
049public class Flag extends DomainResource {
050
051    public enum FlagStatus {
052        /**
053         * A current flag that should be displayed to a user. A system may use the category to determine which roles should view the flag.
054         */
055        ACTIVE, 
056        /**
057         * The flag does not need to be displayed any more.
058         */
059        INACTIVE, 
060        /**
061         * The flag was added in error, and should no longer be displayed.
062         */
063        ENTEREDINERROR, 
064        /**
065         * added to help the parsers
066         */
067        NULL;
068        public static FlagStatus fromCode(String codeString) throws FHIRException {
069            if (codeString == null || "".equals(codeString))
070                return null;
071        if ("active".equals(codeString))
072          return ACTIVE;
073        if ("inactive".equals(codeString))
074          return INACTIVE;
075        if ("entered-in-error".equals(codeString))
076          return ENTEREDINERROR;
077        throw new FHIRException("Unknown FlagStatus code '"+codeString+"'");
078        }
079        public String toCode() {
080          switch (this) {
081            case ACTIVE: return "active";
082            case INACTIVE: return "inactive";
083            case ENTEREDINERROR: return "entered-in-error";
084            case NULL: return null;
085            default: return "?";
086          }
087        }
088        public String getSystem() {
089          switch (this) {
090            case ACTIVE: return "http://hl7.org/fhir/flag-status";
091            case INACTIVE: return "http://hl7.org/fhir/flag-status";
092            case ENTEREDINERROR: return "http://hl7.org/fhir/flag-status";
093            case NULL: return null;
094            default: return "?";
095          }
096        }
097        public String getDefinition() {
098          switch (this) {
099            case ACTIVE: return "A current flag that should be displayed to a user. A system may use the category to determine which roles should view the flag.";
100            case INACTIVE: return "The flag does not need to be displayed any more.";
101            case ENTEREDINERROR: return "The flag was added in error, and should no longer be displayed.";
102            case NULL: return null;
103            default: return "?";
104          }
105        }
106        public String getDisplay() {
107          switch (this) {
108            case ACTIVE: return "Active";
109            case INACTIVE: return "Inactive";
110            case ENTEREDINERROR: return "Entered in Error";
111            case NULL: return null;
112            default: return "?";
113          }
114        }
115    }
116
117  public static class FlagStatusEnumFactory implements EnumFactory<FlagStatus> {
118    public FlagStatus fromCode(String codeString) throws IllegalArgumentException {
119      if (codeString == null || "".equals(codeString))
120            if (codeString == null || "".equals(codeString))
121                return null;
122        if ("active".equals(codeString))
123          return FlagStatus.ACTIVE;
124        if ("inactive".equals(codeString))
125          return FlagStatus.INACTIVE;
126        if ("entered-in-error".equals(codeString))
127          return FlagStatus.ENTEREDINERROR;
128        throw new IllegalArgumentException("Unknown FlagStatus code '"+codeString+"'");
129        }
130        public Enumeration<FlagStatus> fromType(Base code) throws FHIRException {
131          if (code == null || code.isEmpty())
132            return null;
133          String codeString = ((PrimitiveType) code).asStringValue();
134          if (codeString == null || "".equals(codeString))
135            return null;
136        if ("active".equals(codeString))
137          return new Enumeration<FlagStatus>(this, FlagStatus.ACTIVE);
138        if ("inactive".equals(codeString))
139          return new Enumeration<FlagStatus>(this, FlagStatus.INACTIVE);
140        if ("entered-in-error".equals(codeString))
141          return new Enumeration<FlagStatus>(this, FlagStatus.ENTEREDINERROR);
142        throw new FHIRException("Unknown FlagStatus code '"+codeString+"'");
143        }
144    public String toCode(FlagStatus code) {
145      if (code == FlagStatus.ACTIVE)
146        return "active";
147      if (code == FlagStatus.INACTIVE)
148        return "inactive";
149      if (code == FlagStatus.ENTEREDINERROR)
150        return "entered-in-error";
151      return "?";
152      }
153    public String toSystem(FlagStatus code) {
154      return code.getSystem();
155      }
156    }
157
158    /**
159     * Identifier assigned to the flag for external use (outside the FHIR environment).
160     */
161    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
162    @Description(shortDefinition="Business identifier", formalDefinition="Identifier assigned to the flag for external use (outside the FHIR environment)." )
163    protected List<Identifier> identifier;
164
165    /**
166     * Allows an flag to be divided into different categories like clinical, administrative etc. Intended to be used as a means of filtering which flags are displayed to particular user or in a given context.
167     */
168    @Child(name = "category", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
169    @Description(shortDefinition="Clinical, administrative, etc.", formalDefinition="Allows an flag to be divided into different categories like clinical, administrative etc. Intended to be used as a means of filtering which flags are displayed to particular user or in a given context." )
170    protected CodeableConcept category;
171
172    /**
173     * Supports basic workflow.
174     */
175    @Child(name = "status", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true)
176    @Description(shortDefinition="active | inactive | entered-in-error", formalDefinition="Supports basic workflow." )
177    protected Enumeration<FlagStatus> status;
178
179    /**
180     * The period of time from the activation of the flag to inactivation of the flag. If the flag is active, the end of the period should be unspecified.
181     */
182    @Child(name = "period", type = {Period.class}, order=3, min=0, max=1, modifier=false, summary=true)
183    @Description(shortDefinition="Time period when flag is active", formalDefinition="The period of time from the activation of the flag to inactivation of the flag. If the flag is active, the end of the period should be unspecified." )
184    protected Period period;
185
186    /**
187     * The patient, location, group , organization , or practitioner this is about record this flag is associated with.
188     */
189    @Child(name = "subject", type = {Patient.class, Location.class, Group.class, Organization.class, Practitioner.class}, order=4, min=1, max=1, modifier=false, summary=true)
190    @Description(shortDefinition="Who/What is flag about?", formalDefinition="The patient, location, group , organization , or practitioner this is about record this flag is associated with." )
191    protected Reference subject;
192
193    /**
194     * The actual object that is the target of the reference (The patient, location, group , organization , or practitioner this is about record this flag is associated with.)
195     */
196    protected Resource subjectTarget;
197
198    /**
199     * This alert is only relevant during the encounter.
200     */
201    @Child(name = "encounter", type = {Encounter.class}, order=5, min=0, max=1, modifier=false, summary=true)
202    @Description(shortDefinition="Alert relevant during encounter", formalDefinition="This alert is only relevant during the encounter." )
203    protected Reference encounter;
204
205    /**
206     * The actual object that is the target of the reference (This alert is only relevant during the encounter.)
207     */
208    protected Encounter encounterTarget;
209
210    /**
211     * The person, organization or device that created the flag.
212     */
213    @Child(name = "author", type = {Device.class, Organization.class, Patient.class, Practitioner.class}, order=6, min=0, max=1, modifier=false, summary=true)
214    @Description(shortDefinition="Flag creator", formalDefinition="The person, organization or device that created the flag." )
215    protected Reference author;
216
217    /**
218     * The actual object that is the target of the reference (The person, organization or device that created the flag.)
219     */
220    protected Resource authorTarget;
221
222    /**
223     * The coded value or textual component of the flag to display to the user.
224     */
225    @Child(name = "code", type = {CodeableConcept.class}, order=7, min=1, max=1, modifier=false, summary=true)
226    @Description(shortDefinition="Partially deaf, Requires easy open caps, No permanent address, etc.", formalDefinition="The coded value or textual component of the flag to display to the user." )
227    protected CodeableConcept code;
228
229    private static final long serialVersionUID = 701147751L;
230
231  /**
232   * Constructor
233   */
234    public Flag() {
235      super();
236    }
237
238  /**
239   * Constructor
240   */
241    public Flag(Enumeration<FlagStatus> status, Reference subject, CodeableConcept code) {
242      super();
243      this.status = status;
244      this.subject = subject;
245      this.code = code;
246    }
247
248    /**
249     * @return {@link #identifier} (Identifier assigned to the flag for external use (outside the FHIR environment).)
250     */
251    public List<Identifier> getIdentifier() { 
252      if (this.identifier == null)
253        this.identifier = new ArrayList<Identifier>();
254      return this.identifier;
255    }
256
257    public boolean hasIdentifier() { 
258      if (this.identifier == null)
259        return false;
260      for (Identifier item : this.identifier)
261        if (!item.isEmpty())
262          return true;
263      return false;
264    }
265
266    /**
267     * @return {@link #identifier} (Identifier assigned to the flag for external use (outside the FHIR environment).)
268     */
269    // syntactic sugar
270    public Identifier addIdentifier() { //3
271      Identifier t = new Identifier();
272      if (this.identifier == null)
273        this.identifier = new ArrayList<Identifier>();
274      this.identifier.add(t);
275      return t;
276    }
277
278    // syntactic sugar
279    public Flag addIdentifier(Identifier t) { //3
280      if (t == null)
281        return this;
282      if (this.identifier == null)
283        this.identifier = new ArrayList<Identifier>();
284      this.identifier.add(t);
285      return this;
286    }
287
288    /**
289     * @return {@link #category} (Allows an flag to be divided into different categories like clinical, administrative etc. Intended to be used as a means of filtering which flags are displayed to particular user or in a given context.)
290     */
291    public CodeableConcept getCategory() { 
292      if (this.category == null)
293        if (Configuration.errorOnAutoCreate())
294          throw new Error("Attempt to auto-create Flag.category");
295        else if (Configuration.doAutoCreate())
296          this.category = new CodeableConcept(); // cc
297      return this.category;
298    }
299
300    public boolean hasCategory() { 
301      return this.category != null && !this.category.isEmpty();
302    }
303
304    /**
305     * @param value {@link #category} (Allows an flag to be divided into different categories like clinical, administrative etc. Intended to be used as a means of filtering which flags are displayed to particular user or in a given context.)
306     */
307    public Flag setCategory(CodeableConcept value) { 
308      this.category = value;
309      return this;
310    }
311
312    /**
313     * @return {@link #status} (Supports basic workflow.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
314     */
315    public Enumeration<FlagStatus> getStatusElement() { 
316      if (this.status == null)
317        if (Configuration.errorOnAutoCreate())
318          throw new Error("Attempt to auto-create Flag.status");
319        else if (Configuration.doAutoCreate())
320          this.status = new Enumeration<FlagStatus>(new FlagStatusEnumFactory()); // bb
321      return this.status;
322    }
323
324    public boolean hasStatusElement() { 
325      return this.status != null && !this.status.isEmpty();
326    }
327
328    public boolean hasStatus() { 
329      return this.status != null && !this.status.isEmpty();
330    }
331
332    /**
333     * @param value {@link #status} (Supports basic workflow.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
334     */
335    public Flag setStatusElement(Enumeration<FlagStatus> value) { 
336      this.status = value;
337      return this;
338    }
339
340    /**
341     * @return Supports basic workflow.
342     */
343    public FlagStatus getStatus() { 
344      return this.status == null ? null : this.status.getValue();
345    }
346
347    /**
348     * @param value Supports basic workflow.
349     */
350    public Flag setStatus(FlagStatus value) { 
351        if (this.status == null)
352          this.status = new Enumeration<FlagStatus>(new FlagStatusEnumFactory());
353        this.status.setValue(value);
354      return this;
355    }
356
357    /**
358     * @return {@link #period} (The period of time from the activation of the flag to inactivation of the flag. If the flag is active, the end of the period should be unspecified.)
359     */
360    public Period getPeriod() { 
361      if (this.period == null)
362        if (Configuration.errorOnAutoCreate())
363          throw new Error("Attempt to auto-create Flag.period");
364        else if (Configuration.doAutoCreate())
365          this.period = new Period(); // cc
366      return this.period;
367    }
368
369    public boolean hasPeriod() { 
370      return this.period != null && !this.period.isEmpty();
371    }
372
373    /**
374     * @param value {@link #period} (The period of time from the activation of the flag to inactivation of the flag. If the flag is active, the end of the period should be unspecified.)
375     */
376    public Flag setPeriod(Period value) { 
377      this.period = value;
378      return this;
379    }
380
381    /**
382     * @return {@link #subject} (The patient, location, group , organization , or practitioner this is about record this flag is associated with.)
383     */
384    public Reference getSubject() { 
385      if (this.subject == null)
386        if (Configuration.errorOnAutoCreate())
387          throw new Error("Attempt to auto-create Flag.subject");
388        else if (Configuration.doAutoCreate())
389          this.subject = new Reference(); // cc
390      return this.subject;
391    }
392
393    public boolean hasSubject() { 
394      return this.subject != null && !this.subject.isEmpty();
395    }
396
397    /**
398     * @param value {@link #subject} (The patient, location, group , organization , or practitioner this is about record this flag is associated with.)
399     */
400    public Flag setSubject(Reference value) { 
401      this.subject = value;
402      return this;
403    }
404
405    /**
406     * @return {@link #subject} 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, location, group , organization , or practitioner this is about record this flag is associated with.)
407     */
408    public Resource getSubjectTarget() { 
409      return this.subjectTarget;
410    }
411
412    /**
413     * @param value {@link #subject} 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, location, group , organization , or practitioner this is about record this flag is associated with.)
414     */
415    public Flag setSubjectTarget(Resource value) { 
416      this.subjectTarget = value;
417      return this;
418    }
419
420    /**
421     * @return {@link #encounter} (This alert is only relevant during the encounter.)
422     */
423    public Reference getEncounter() { 
424      if (this.encounter == null)
425        if (Configuration.errorOnAutoCreate())
426          throw new Error("Attempt to auto-create Flag.encounter");
427        else if (Configuration.doAutoCreate())
428          this.encounter = new Reference(); // cc
429      return this.encounter;
430    }
431
432    public boolean hasEncounter() { 
433      return this.encounter != null && !this.encounter.isEmpty();
434    }
435
436    /**
437     * @param value {@link #encounter} (This alert is only relevant during the encounter.)
438     */
439    public Flag setEncounter(Reference value) { 
440      this.encounter = value;
441      return this;
442    }
443
444    /**
445     * @return {@link #encounter} 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. (This alert is only relevant during the encounter.)
446     */
447    public Encounter getEncounterTarget() { 
448      if (this.encounterTarget == null)
449        if (Configuration.errorOnAutoCreate())
450          throw new Error("Attempt to auto-create Flag.encounter");
451        else if (Configuration.doAutoCreate())
452          this.encounterTarget = new Encounter(); // aa
453      return this.encounterTarget;
454    }
455
456    /**
457     * @param value {@link #encounter} 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. (This alert is only relevant during the encounter.)
458     */
459    public Flag setEncounterTarget(Encounter value) { 
460      this.encounterTarget = value;
461      return this;
462    }
463
464    /**
465     * @return {@link #author} (The person, organization or device that created the flag.)
466     */
467    public Reference getAuthor() { 
468      if (this.author == null)
469        if (Configuration.errorOnAutoCreate())
470          throw new Error("Attempt to auto-create Flag.author");
471        else if (Configuration.doAutoCreate())
472          this.author = new Reference(); // cc
473      return this.author;
474    }
475
476    public boolean hasAuthor() { 
477      return this.author != null && !this.author.isEmpty();
478    }
479
480    /**
481     * @param value {@link #author} (The person, organization or device that created the flag.)
482     */
483    public Flag setAuthor(Reference value) { 
484      this.author = value;
485      return this;
486    }
487
488    /**
489     * @return {@link #author} 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 person, organization or device that created the flag.)
490     */
491    public Resource getAuthorTarget() { 
492      return this.authorTarget;
493    }
494
495    /**
496     * @param value {@link #author} 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 person, organization or device that created the flag.)
497     */
498    public Flag setAuthorTarget(Resource value) { 
499      this.authorTarget = value;
500      return this;
501    }
502
503    /**
504     * @return {@link #code} (The coded value or textual component of the flag to display to the user.)
505     */
506    public CodeableConcept getCode() { 
507      if (this.code == null)
508        if (Configuration.errorOnAutoCreate())
509          throw new Error("Attempt to auto-create Flag.code");
510        else if (Configuration.doAutoCreate())
511          this.code = new CodeableConcept(); // cc
512      return this.code;
513    }
514
515    public boolean hasCode() { 
516      return this.code != null && !this.code.isEmpty();
517    }
518
519    /**
520     * @param value {@link #code} (The coded value or textual component of the flag to display to the user.)
521     */
522    public Flag setCode(CodeableConcept value) { 
523      this.code = value;
524      return this;
525    }
526
527      protected void listChildren(List<Property> childrenList) {
528        super.listChildren(childrenList);
529        childrenList.add(new Property("identifier", "Identifier", "Identifier assigned to the flag for external use (outside the FHIR environment).", 0, java.lang.Integer.MAX_VALUE, identifier));
530        childrenList.add(new Property("category", "CodeableConcept", "Allows an flag to be divided into different categories like clinical, administrative etc. Intended to be used as a means of filtering which flags are displayed to particular user or in a given context.", 0, java.lang.Integer.MAX_VALUE, category));
531        childrenList.add(new Property("status", "code", "Supports basic workflow.", 0, java.lang.Integer.MAX_VALUE, status));
532        childrenList.add(new Property("period", "Period", "The period of time from the activation of the flag to inactivation of the flag. If the flag is active, the end of the period should be unspecified.", 0, java.lang.Integer.MAX_VALUE, period));
533        childrenList.add(new Property("subject", "Reference(Patient|Location|Group|Organization|Practitioner)", "The patient, location, group , organization , or practitioner this is about record this flag is associated with.", 0, java.lang.Integer.MAX_VALUE, subject));
534        childrenList.add(new Property("encounter", "Reference(Encounter)", "This alert is only relevant during the encounter.", 0, java.lang.Integer.MAX_VALUE, encounter));
535        childrenList.add(new Property("author", "Reference(Device|Organization|Patient|Practitioner)", "The person, organization or device that created the flag.", 0, java.lang.Integer.MAX_VALUE, author));
536        childrenList.add(new Property("code", "CodeableConcept", "The coded value or textual component of the flag to display to the user.", 0, java.lang.Integer.MAX_VALUE, code));
537      }
538
539      @Override
540      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
541        switch (hash) {
542        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
543        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
544        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<FlagStatus>
545        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
546        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
547        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
548        case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference
549        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
550        default: return super.getProperty(hash, name, checkValid);
551        }
552
553      }
554
555      @Override
556      public void setProperty(int hash, String name, Base value) throws FHIRException {
557        switch (hash) {
558        case -1618432855: // identifier
559          this.getIdentifier().add(castToIdentifier(value)); // Identifier
560          break;
561        case 50511102: // category
562          this.category = castToCodeableConcept(value); // CodeableConcept
563          break;
564        case -892481550: // status
565          this.status = new FlagStatusEnumFactory().fromType(value); // Enumeration<FlagStatus>
566          break;
567        case -991726143: // period
568          this.period = castToPeriod(value); // Period
569          break;
570        case -1867885268: // subject
571          this.subject = castToReference(value); // Reference
572          break;
573        case 1524132147: // encounter
574          this.encounter = castToReference(value); // Reference
575          break;
576        case -1406328437: // author
577          this.author = castToReference(value); // Reference
578          break;
579        case 3059181: // code
580          this.code = castToCodeableConcept(value); // CodeableConcept
581          break;
582        default: super.setProperty(hash, name, value);
583        }
584
585      }
586
587      @Override
588      public void setProperty(String name, Base value) throws FHIRException {
589        if (name.equals("identifier"))
590          this.getIdentifier().add(castToIdentifier(value));
591        else if (name.equals("category"))
592          this.category = castToCodeableConcept(value); // CodeableConcept
593        else if (name.equals("status"))
594          this.status = new FlagStatusEnumFactory().fromType(value); // Enumeration<FlagStatus>
595        else if (name.equals("period"))
596          this.period = castToPeriod(value); // Period
597        else if (name.equals("subject"))
598          this.subject = castToReference(value); // Reference
599        else if (name.equals("encounter"))
600          this.encounter = castToReference(value); // Reference
601        else if (name.equals("author"))
602          this.author = castToReference(value); // Reference
603        else if (name.equals("code"))
604          this.code = castToCodeableConcept(value); // CodeableConcept
605        else
606          super.setProperty(name, value);
607      }
608
609      @Override
610      public Base makeProperty(int hash, String name) throws FHIRException {
611        switch (hash) {
612        case -1618432855:  return addIdentifier(); // Identifier
613        case 50511102:  return getCategory(); // CodeableConcept
614        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<FlagStatus>
615        case -991726143:  return getPeriod(); // Period
616        case -1867885268:  return getSubject(); // Reference
617        case 1524132147:  return getEncounter(); // Reference
618        case -1406328437:  return getAuthor(); // Reference
619        case 3059181:  return getCode(); // CodeableConcept
620        default: return super.makeProperty(hash, name);
621        }
622
623      }
624
625      @Override
626      public Base addChild(String name) throws FHIRException {
627        if (name.equals("identifier")) {
628          return addIdentifier();
629        }
630        else if (name.equals("category")) {
631          this.category = new CodeableConcept();
632          return this.category;
633        }
634        else if (name.equals("status")) {
635          throw new FHIRException("Cannot call addChild on a primitive type Flag.status");
636        }
637        else if (name.equals("period")) {
638          this.period = new Period();
639          return this.period;
640        }
641        else if (name.equals("subject")) {
642          this.subject = new Reference();
643          return this.subject;
644        }
645        else if (name.equals("encounter")) {
646          this.encounter = new Reference();
647          return this.encounter;
648        }
649        else if (name.equals("author")) {
650          this.author = new Reference();
651          return this.author;
652        }
653        else if (name.equals("code")) {
654          this.code = new CodeableConcept();
655          return this.code;
656        }
657        else
658          return super.addChild(name);
659      }
660
661  public String fhirType() {
662    return "Flag";
663
664  }
665
666      public Flag copy() {
667        Flag dst = new Flag();
668        copyValues(dst);
669        if (identifier != null) {
670          dst.identifier = new ArrayList<Identifier>();
671          for (Identifier i : identifier)
672            dst.identifier.add(i.copy());
673        };
674        dst.category = category == null ? null : category.copy();
675        dst.status = status == null ? null : status.copy();
676        dst.period = period == null ? null : period.copy();
677        dst.subject = subject == null ? null : subject.copy();
678        dst.encounter = encounter == null ? null : encounter.copy();
679        dst.author = author == null ? null : author.copy();
680        dst.code = code == null ? null : code.copy();
681        return dst;
682      }
683
684      protected Flag typedCopy() {
685        return copy();
686      }
687
688      @Override
689      public boolean equalsDeep(Base other) {
690        if (!super.equalsDeep(other))
691          return false;
692        if (!(other instanceof Flag))
693          return false;
694        Flag o = (Flag) other;
695        return compareDeep(identifier, o.identifier, true) && compareDeep(category, o.category, true) && compareDeep(status, o.status, true)
696           && compareDeep(period, o.period, true) && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true)
697           && compareDeep(author, o.author, true) && compareDeep(code, o.code, true);
698      }
699
700      @Override
701      public boolean equalsShallow(Base other) {
702        if (!super.equalsShallow(other))
703          return false;
704        if (!(other instanceof Flag))
705          return false;
706        Flag o = (Flag) other;
707        return compareValues(status, o.status, true);
708      }
709
710      public boolean isEmpty() {
711        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (category == null || category.isEmpty())
712           && (status == null || status.isEmpty()) && (period == null || period.isEmpty()) && (subject == null || subject.isEmpty())
713           && (encounter == null || encounter.isEmpty()) && (author == null || author.isEmpty()) && (code == null || code.isEmpty())
714          ;
715      }
716
717  @Override
718  public ResourceType getResourceType() {
719    return ResourceType.Flag;
720   }
721
722 /**
723   * Search parameter: <b>author</b>
724   * <p>
725   * Description: <b>Flag creator</b><br>
726   * Type: <b>reference</b><br>
727   * Path: <b>Flag.author</b><br>
728   * </p>
729   */
730  @SearchParamDefinition(name="author", path="Flag.author", description="Flag creator", type="reference" )
731  public static final String SP_AUTHOR = "author";
732 /**
733   * <b>Fluent Client</b> search parameter constant for <b>author</b>
734   * <p>
735   * Description: <b>Flag creator</b><br>
736   * Type: <b>reference</b><br>
737   * Path: <b>Flag.author</b><br>
738   * </p>
739   */
740  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHOR);
741
742/**
743   * Constant for fluent queries to be used to add include statements. Specifies
744   * the path value of "<b>Flag:author</b>".
745   */
746  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include("Flag:author").toLocked();
747
748 /**
749   * Search parameter: <b>patient</b>
750   * <p>
751   * Description: <b>The identity of a subject to list flags for</b><br>
752   * Type: <b>reference</b><br>
753   * Path: <b>Flag.subject</b><br>
754   * </p>
755   */
756  @SearchParamDefinition(name="patient", path="Flag.subject", description="The identity of a subject to list flags for", type="reference" )
757  public static final String SP_PATIENT = "patient";
758 /**
759   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
760   * <p>
761   * Description: <b>The identity of a subject to list flags for</b><br>
762   * Type: <b>reference</b><br>
763   * Path: <b>Flag.subject</b><br>
764   * </p>
765   */
766  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
767
768/**
769   * Constant for fluent queries to be used to add include statements. Specifies
770   * the path value of "<b>Flag:patient</b>".
771   */
772  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Flag:patient").toLocked();
773
774 /**
775   * Search parameter: <b>subject</b>
776   * <p>
777   * Description: <b>The identity of a subject to list flags for</b><br>
778   * Type: <b>reference</b><br>
779   * Path: <b>Flag.subject</b><br>
780   * </p>
781   */
782  @SearchParamDefinition(name="subject", path="Flag.subject", description="The identity of a subject to list flags for", type="reference" )
783  public static final String SP_SUBJECT = "subject";
784 /**
785   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
786   * <p>
787   * Description: <b>The identity of a subject to list flags for</b><br>
788   * Type: <b>reference</b><br>
789   * Path: <b>Flag.subject</b><br>
790   * </p>
791   */
792  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
793
794/**
795   * Constant for fluent queries to be used to add include statements. Specifies
796   * the path value of "<b>Flag:subject</b>".
797   */
798  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Flag:subject").toLocked();
799
800 /**
801   * Search parameter: <b>encounter</b>
802   * <p>
803   * Description: <b>Alert relevant during encounter</b><br>
804   * Type: <b>reference</b><br>
805   * Path: <b>Flag.encounter</b><br>
806   * </p>
807   */
808  @SearchParamDefinition(name="encounter", path="Flag.encounter", description="Alert relevant during encounter", type="reference" )
809  public static final String SP_ENCOUNTER = "encounter";
810 /**
811   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
812   * <p>
813   * Description: <b>Alert relevant during encounter</b><br>
814   * Type: <b>reference</b><br>
815   * Path: <b>Flag.encounter</b><br>
816   * </p>
817   */
818  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
819
820/**
821   * Constant for fluent queries to be used to add include statements. Specifies
822   * the path value of "<b>Flag:encounter</b>".
823   */
824  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("Flag:encounter").toLocked();
825
826 /**
827   * Search parameter: <b>date</b>
828   * <p>
829   * Description: <b>Time period when flag is active</b><br>
830   * Type: <b>date</b><br>
831   * Path: <b>Flag.period</b><br>
832   * </p>
833   */
834  @SearchParamDefinition(name="date", path="Flag.period", description="Time period when flag is active", type="date" )
835  public static final String SP_DATE = "date";
836 /**
837   * <b>Fluent Client</b> search parameter constant for <b>date</b>
838   * <p>
839   * Description: <b>Time period when flag is active</b><br>
840   * Type: <b>date</b><br>
841   * Path: <b>Flag.period</b><br>
842   * </p>
843   */
844  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
845
846
847}