001package org.hl7.fhir.dstu3.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x
035import java.util.ArrayList;
036import java.util.List;
037
038import org.hl7.fhir.exceptions.FHIRException;
039
040import ca.uhn.fhir.model.api.annotation.Child;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044/**
045 * Prospective warnings of potential issues when providing care to the patient.
046 */
047@ResourceDef(name="Flag", profile="http://hl7.org/fhir/Profile/Flag")
048public class Flag extends DomainResource {
049
050    public enum FlagStatus {
051        /**
052         * A current flag that should be displayed to a user. A system may use the category to determine which roles should view the flag.
053         */
054        ACTIVE, 
055        /**
056         * The flag does not need to be displayed any more.
057         */
058        INACTIVE, 
059        /**
060         * The flag was added in error, and should no longer be displayed.
061         */
062        ENTEREDINERROR, 
063        /**
064         * added to help the parsers with the generic types
065         */
066        NULL;
067        public static FlagStatus fromCode(String codeString) throws FHIRException {
068            if (codeString == null || "".equals(codeString))
069                return null;
070        if ("active".equals(codeString))
071          return ACTIVE;
072        if ("inactive".equals(codeString))
073          return INACTIVE;
074        if ("entered-in-error".equals(codeString))
075          return ENTEREDINERROR;
076        if (Configuration.isAcceptInvalidEnums())
077          return null;
078        else
079          throw new FHIRException("Unknown FlagStatus code '"+codeString+"'");
080        }
081        public String toCode() {
082          switch (this) {
083            case ACTIVE: return "active";
084            case INACTIVE: return "inactive";
085            case ENTEREDINERROR: return "entered-in-error";
086            case NULL: return null;
087            default: return "?";
088          }
089        }
090        public String getSystem() {
091          switch (this) {
092            case ACTIVE: return "http://hl7.org/fhir/flag-status";
093            case INACTIVE: return "http://hl7.org/fhir/flag-status";
094            case ENTEREDINERROR: return "http://hl7.org/fhir/flag-status";
095            case NULL: return null;
096            default: return "?";
097          }
098        }
099        public String getDefinition() {
100          switch (this) {
101            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.";
102            case INACTIVE: return "The flag does not need to be displayed any more.";
103            case ENTEREDINERROR: return "The flag was added in error, and should no longer be displayed.";
104            case NULL: return null;
105            default: return "?";
106          }
107        }
108        public String getDisplay() {
109          switch (this) {
110            case ACTIVE: return "Active";
111            case INACTIVE: return "Inactive";
112            case ENTEREDINERROR: return "Entered in Error";
113            case NULL: return null;
114            default: return "?";
115          }
116        }
117    }
118
119  public static class FlagStatusEnumFactory implements EnumFactory<FlagStatus> {
120    public FlagStatus fromCode(String codeString) throws IllegalArgumentException {
121      if (codeString == null || "".equals(codeString))
122            if (codeString == null || "".equals(codeString))
123                return null;
124        if ("active".equals(codeString))
125          return FlagStatus.ACTIVE;
126        if ("inactive".equals(codeString))
127          return FlagStatus.INACTIVE;
128        if ("entered-in-error".equals(codeString))
129          return FlagStatus.ENTEREDINERROR;
130        throw new IllegalArgumentException("Unknown FlagStatus code '"+codeString+"'");
131        }
132        public Enumeration<FlagStatus> fromType(Base code) throws FHIRException {
133          if (code == null)
134            return null;
135          if (code.isEmpty())
136            return new Enumeration<FlagStatus>(this);
137          String codeString = ((PrimitiveType) code).asStringValue();
138          if (codeString == null || "".equals(codeString))
139            return null;
140        if ("active".equals(codeString))
141          return new Enumeration<FlagStatus>(this, FlagStatus.ACTIVE);
142        if ("inactive".equals(codeString))
143          return new Enumeration<FlagStatus>(this, FlagStatus.INACTIVE);
144        if ("entered-in-error".equals(codeString))
145          return new Enumeration<FlagStatus>(this, FlagStatus.ENTEREDINERROR);
146        throw new FHIRException("Unknown FlagStatus code '"+codeString+"'");
147        }
148    public String toCode(FlagStatus code) {
149      if (code == FlagStatus.ACTIVE)
150        return "active";
151      if (code == FlagStatus.INACTIVE)
152        return "inactive";
153      if (code == FlagStatus.ENTEREDINERROR)
154        return "entered-in-error";
155      return "?";
156      }
157    public String toSystem(FlagStatus code) {
158      return code.getSystem();
159      }
160    }
161
162    /**
163     * Identifier assigned to the flag for external use (outside the FHIR environment).
164     */
165    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
166    @Description(shortDefinition="Business identifier", formalDefinition="Identifier assigned to the flag for external use (outside the FHIR environment)." )
167    protected List<Identifier> identifier;
168
169    /**
170     * Supports basic workflow.
171     */
172    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
173    @Description(shortDefinition="active | inactive | entered-in-error", formalDefinition="Supports basic workflow." )
174    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/flag-status")
175    protected Enumeration<FlagStatus> status;
176
177    /**
178     * 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.
179     */
180    @Child(name = "category", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
181    @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." )
182    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/flag-category")
183    protected CodeableConcept category;
184
185    /**
186     * The coded value or textual component of the flag to display to the user.
187     */
188    @Child(name = "code", type = {CodeableConcept.class}, order=3, min=1, max=1, modifier=false, summary=true)
189    @Description(shortDefinition="Coded or textual message to display to user", formalDefinition="The coded value or textual component of the flag to display to the user." )
190    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/flag-code")
191    protected CodeableConcept code;
192
193    /**
194     * The patient, location, group , organization , or practitioner, etc. this is about record this flag is associated with.
195     */
196    @Child(name = "subject", type = {Patient.class, Location.class, Group.class, Organization.class, Practitioner.class, PlanDefinition.class, Medication.class, Procedure.class}, order=4, min=1, max=1, modifier=false, summary=true)
197    @Description(shortDefinition="Who/What is flag about?", formalDefinition="The patient, location, group , organization , or practitioner, etc. this is about record this flag is associated with." )
198    protected Reference subject;
199
200    /**
201     * The actual object that is the target of the reference (The patient, location, group , organization , or practitioner, etc. this is about record this flag is associated with.)
202     */
203    protected Resource subjectTarget;
204
205    /**
206     * 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.
207     */
208    @Child(name = "period", type = {Period.class}, order=5, min=0, max=1, modifier=false, summary=true)
209    @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." )
210    protected Period period;
211
212    /**
213     * This alert is only relevant during the encounter.
214     */
215    @Child(name = "encounter", type = {Encounter.class}, order=6, min=0, max=1, modifier=false, summary=true)
216    @Description(shortDefinition="Alert relevant during encounter", formalDefinition="This alert is only relevant during the encounter." )
217    protected Reference encounter;
218
219    /**
220     * The actual object that is the target of the reference (This alert is only relevant during the encounter.)
221     */
222    protected Encounter encounterTarget;
223
224    /**
225     * The person, organization or device that created the flag.
226     */
227    @Child(name = "author", type = {Device.class, Organization.class, Patient.class, Practitioner.class}, order=7, min=0, max=1, modifier=false, summary=true)
228    @Description(shortDefinition="Flag creator", formalDefinition="The person, organization or device that created the flag." )
229    protected Reference author;
230
231    /**
232     * The actual object that is the target of the reference (The person, organization or device that created the flag.)
233     */
234    protected Resource authorTarget;
235
236    private static final long serialVersionUID = -619061399L;
237
238  /**
239   * Constructor
240   */
241    public Flag() {
242      super();
243    }
244
245  /**
246   * Constructor
247   */
248    public Flag(Enumeration<FlagStatus> status, CodeableConcept code, Reference subject) {
249      super();
250      this.status = status;
251      this.code = code;
252      this.subject = subject;
253    }
254
255    /**
256     * @return {@link #identifier} (Identifier assigned to the flag for external use (outside the FHIR environment).)
257     */
258    public List<Identifier> getIdentifier() { 
259      if (this.identifier == null)
260        this.identifier = new ArrayList<Identifier>();
261      return this.identifier;
262    }
263
264    /**
265     * @return Returns a reference to <code>this</code> for easy method chaining
266     */
267    public Flag setIdentifier(List<Identifier> theIdentifier) { 
268      this.identifier = theIdentifier;
269      return this;
270    }
271
272    public boolean hasIdentifier() { 
273      if (this.identifier == null)
274        return false;
275      for (Identifier item : this.identifier)
276        if (!item.isEmpty())
277          return true;
278      return false;
279    }
280
281    public Identifier addIdentifier() { //3
282      Identifier t = new Identifier();
283      if (this.identifier == null)
284        this.identifier = new ArrayList<Identifier>();
285      this.identifier.add(t);
286      return t;
287    }
288
289    public Flag addIdentifier(Identifier t) { //3
290      if (t == null)
291        return this;
292      if (this.identifier == null)
293        this.identifier = new ArrayList<Identifier>();
294      this.identifier.add(t);
295      return this;
296    }
297
298    /**
299     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
300     */
301    public Identifier getIdentifierFirstRep() { 
302      if (getIdentifier().isEmpty()) {
303        addIdentifier();
304      }
305      return getIdentifier().get(0);
306    }
307
308    /**
309     * @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
310     */
311    public Enumeration<FlagStatus> getStatusElement() { 
312      if (this.status == null)
313        if (Configuration.errorOnAutoCreate())
314          throw new Error("Attempt to auto-create Flag.status");
315        else if (Configuration.doAutoCreate())
316          this.status = new Enumeration<FlagStatus>(new FlagStatusEnumFactory()); // bb
317      return this.status;
318    }
319
320    public boolean hasStatusElement() { 
321      return this.status != null && !this.status.isEmpty();
322    }
323
324    public boolean hasStatus() { 
325      return this.status != null && !this.status.isEmpty();
326    }
327
328    /**
329     * @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
330     */
331    public Flag setStatusElement(Enumeration<FlagStatus> value) { 
332      this.status = value;
333      return this;
334    }
335
336    /**
337     * @return Supports basic workflow.
338     */
339    public FlagStatus getStatus() { 
340      return this.status == null ? null : this.status.getValue();
341    }
342
343    /**
344     * @param value Supports basic workflow.
345     */
346    public Flag setStatus(FlagStatus value) { 
347        if (this.status == null)
348          this.status = new Enumeration<FlagStatus>(new FlagStatusEnumFactory());
349        this.status.setValue(value);
350      return this;
351    }
352
353    /**
354     * @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.)
355     */
356    public CodeableConcept getCategory() { 
357      if (this.category == null)
358        if (Configuration.errorOnAutoCreate())
359          throw new Error("Attempt to auto-create Flag.category");
360        else if (Configuration.doAutoCreate())
361          this.category = new CodeableConcept(); // cc
362      return this.category;
363    }
364
365    public boolean hasCategory() { 
366      return this.category != null && !this.category.isEmpty();
367    }
368
369    /**
370     * @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.)
371     */
372    public Flag setCategory(CodeableConcept value)  { 
373      this.category = value;
374      return this;
375    }
376
377    /**
378     * @return {@link #code} (The coded value or textual component of the flag to display to the user.)
379     */
380    public CodeableConcept getCode() { 
381      if (this.code == null)
382        if (Configuration.errorOnAutoCreate())
383          throw new Error("Attempt to auto-create Flag.code");
384        else if (Configuration.doAutoCreate())
385          this.code = new CodeableConcept(); // cc
386      return this.code;
387    }
388
389    public boolean hasCode() { 
390      return this.code != null && !this.code.isEmpty();
391    }
392
393    /**
394     * @param value {@link #code} (The coded value or textual component of the flag to display to the user.)
395     */
396    public Flag setCode(CodeableConcept value)  { 
397      this.code = value;
398      return this;
399    }
400
401    /**
402     * @return {@link #subject} (The patient, location, group , organization , or practitioner, etc. this is about record this flag is associated with.)
403     */
404    public Reference getSubject() { 
405      if (this.subject == null)
406        if (Configuration.errorOnAutoCreate())
407          throw new Error("Attempt to auto-create Flag.subject");
408        else if (Configuration.doAutoCreate())
409          this.subject = new Reference(); // cc
410      return this.subject;
411    }
412
413    public boolean hasSubject() { 
414      return this.subject != null && !this.subject.isEmpty();
415    }
416
417    /**
418     * @param value {@link #subject} (The patient, location, group , organization , or practitioner, etc. this is about record this flag is associated with.)
419     */
420    public Flag setSubject(Reference value)  { 
421      this.subject = value;
422      return this;
423    }
424
425    /**
426     * @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, etc. this is about record this flag is associated with.)
427     */
428    public Resource getSubjectTarget() { 
429      return this.subjectTarget;
430    }
431
432    /**
433     * @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, etc. this is about record this flag is associated with.)
434     */
435    public Flag setSubjectTarget(Resource value) { 
436      this.subjectTarget = value;
437      return this;
438    }
439
440    /**
441     * @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.)
442     */
443    public Period getPeriod() { 
444      if (this.period == null)
445        if (Configuration.errorOnAutoCreate())
446          throw new Error("Attempt to auto-create Flag.period");
447        else if (Configuration.doAutoCreate())
448          this.period = new Period(); // cc
449      return this.period;
450    }
451
452    public boolean hasPeriod() { 
453      return this.period != null && !this.period.isEmpty();
454    }
455
456    /**
457     * @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.)
458     */
459    public Flag setPeriod(Period value)  { 
460      this.period = value;
461      return this;
462    }
463
464    /**
465     * @return {@link #encounter} (This alert is only relevant during the encounter.)
466     */
467    public Reference getEncounter() { 
468      if (this.encounter == null)
469        if (Configuration.errorOnAutoCreate())
470          throw new Error("Attempt to auto-create Flag.encounter");
471        else if (Configuration.doAutoCreate())
472          this.encounter = new Reference(); // cc
473      return this.encounter;
474    }
475
476    public boolean hasEncounter() { 
477      return this.encounter != null && !this.encounter.isEmpty();
478    }
479
480    /**
481     * @param value {@link #encounter} (This alert is only relevant during the encounter.)
482     */
483    public Flag setEncounter(Reference value)  { 
484      this.encounter = value;
485      return this;
486    }
487
488    /**
489     * @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.)
490     */
491    public Encounter getEncounterTarget() { 
492      if (this.encounterTarget == null)
493        if (Configuration.errorOnAutoCreate())
494          throw new Error("Attempt to auto-create Flag.encounter");
495        else if (Configuration.doAutoCreate())
496          this.encounterTarget = new Encounter(); // aa
497      return this.encounterTarget;
498    }
499
500    /**
501     * @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.)
502     */
503    public Flag setEncounterTarget(Encounter value) { 
504      this.encounterTarget = value;
505      return this;
506    }
507
508    /**
509     * @return {@link #author} (The person, organization or device that created the flag.)
510     */
511    public Reference getAuthor() { 
512      if (this.author == null)
513        if (Configuration.errorOnAutoCreate())
514          throw new Error("Attempt to auto-create Flag.author");
515        else if (Configuration.doAutoCreate())
516          this.author = new Reference(); // cc
517      return this.author;
518    }
519
520    public boolean hasAuthor() { 
521      return this.author != null && !this.author.isEmpty();
522    }
523
524    /**
525     * @param value {@link #author} (The person, organization or device that created the flag.)
526     */
527    public Flag setAuthor(Reference value)  { 
528      this.author = value;
529      return this;
530    }
531
532    /**
533     * @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.)
534     */
535    public Resource getAuthorTarget() { 
536      return this.authorTarget;
537    }
538
539    /**
540     * @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.)
541     */
542    public Flag setAuthorTarget(Resource value) { 
543      this.authorTarget = value;
544      return this;
545    }
546
547      protected void listChildren(List<Property> children) {
548        super.listChildren(children);
549        children.add(new Property("identifier", "Identifier", "Identifier assigned to the flag for external use (outside the FHIR environment).", 0, java.lang.Integer.MAX_VALUE, identifier));
550        children.add(new Property("status", "code", "Supports basic workflow.", 0, 1, status));
551        children.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, 1, category));
552        children.add(new Property("code", "CodeableConcept", "The coded value or textual component of the flag to display to the user.", 0, 1, code));
553        children.add(new Property("subject", "Reference(Patient|Location|Group|Organization|Practitioner|PlanDefinition|Medication|Procedure)", "The patient, location, group , organization , or practitioner, etc. this is about record this flag is associated with.", 0, 1, subject));
554        children.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, 1, period));
555        children.add(new Property("encounter", "Reference(Encounter)", "This alert is only relevant during the encounter.", 0, 1, encounter));
556        children.add(new Property("author", "Reference(Device|Organization|Patient|Practitioner)", "The person, organization or device that created the flag.", 0, 1, author));
557      }
558
559      @Override
560      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
561        switch (_hash) {
562        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifier assigned to the flag for external use (outside the FHIR environment).", 0, java.lang.Integer.MAX_VALUE, identifier);
563        case -892481550: /*status*/  return new Property("status", "code", "Supports basic workflow.", 0, 1, status);
564        case 50511102: /*category*/  return 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, 1, category);
565        case 3059181: /*code*/  return new Property("code", "CodeableConcept", "The coded value or textual component of the flag to display to the user.", 0, 1, code);
566        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Location|Group|Organization|Practitioner|PlanDefinition|Medication|Procedure)", "The patient, location, group , organization , or practitioner, etc. this is about record this flag is associated with.", 0, 1, subject);
567        case -991726143: /*period*/  return 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, 1, period);
568        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "This alert is only relevant during the encounter.", 0, 1, encounter);
569        case -1406328437: /*author*/  return new Property("author", "Reference(Device|Organization|Patient|Practitioner)", "The person, organization or device that created the flag.", 0, 1, author);
570        default: return super.getNamedProperty(_hash, _name, _checkValid);
571        }
572
573      }
574
575      @Override
576      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
577        switch (hash) {
578        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
579        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<FlagStatus>
580        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
581        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
582        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
583        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
584        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
585        case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference
586        default: return super.getProperty(hash, name, checkValid);
587        }
588
589      }
590
591      @Override
592      public Base setProperty(int hash, String name, Base value) throws FHIRException {
593        switch (hash) {
594        case -1618432855: // identifier
595          this.getIdentifier().add(castToIdentifier(value)); // Identifier
596          return value;
597        case -892481550: // status
598          value = new FlagStatusEnumFactory().fromType(castToCode(value));
599          this.status = (Enumeration) value; // Enumeration<FlagStatus>
600          return value;
601        case 50511102: // category
602          this.category = castToCodeableConcept(value); // CodeableConcept
603          return value;
604        case 3059181: // code
605          this.code = castToCodeableConcept(value); // CodeableConcept
606          return value;
607        case -1867885268: // subject
608          this.subject = castToReference(value); // Reference
609          return value;
610        case -991726143: // period
611          this.period = castToPeriod(value); // Period
612          return value;
613        case 1524132147: // encounter
614          this.encounter = castToReference(value); // Reference
615          return value;
616        case -1406328437: // author
617          this.author = castToReference(value); // Reference
618          return value;
619        default: return super.setProperty(hash, name, value);
620        }
621
622      }
623
624      @Override
625      public Base setProperty(String name, Base value) throws FHIRException {
626        if (name.equals("identifier")) {
627          this.getIdentifier().add(castToIdentifier(value));
628        } else if (name.equals("status")) {
629          value = new FlagStatusEnumFactory().fromType(castToCode(value));
630          this.status = (Enumeration) value; // Enumeration<FlagStatus>
631        } else if (name.equals("category")) {
632          this.category = castToCodeableConcept(value); // CodeableConcept
633        } else if (name.equals("code")) {
634          this.code = castToCodeableConcept(value); // CodeableConcept
635        } else if (name.equals("subject")) {
636          this.subject = castToReference(value); // Reference
637        } else if (name.equals("period")) {
638          this.period = castToPeriod(value); // Period
639        } else if (name.equals("encounter")) {
640          this.encounter = castToReference(value); // Reference
641        } else if (name.equals("author")) {
642          this.author = castToReference(value); // Reference
643        } else
644          return super.setProperty(name, value);
645        return value;
646      }
647
648      @Override
649      public Base makeProperty(int hash, String name) throws FHIRException {
650        switch (hash) {
651        case -1618432855:  return addIdentifier(); 
652        case -892481550:  return getStatusElement();
653        case 50511102:  return getCategory(); 
654        case 3059181:  return getCode(); 
655        case -1867885268:  return getSubject(); 
656        case -991726143:  return getPeriod(); 
657        case 1524132147:  return getEncounter(); 
658        case -1406328437:  return getAuthor(); 
659        default: return super.makeProperty(hash, name);
660        }
661
662      }
663
664      @Override
665      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
666        switch (hash) {
667        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
668        case -892481550: /*status*/ return new String[] {"code"};
669        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
670        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
671        case -1867885268: /*subject*/ return new String[] {"Reference"};
672        case -991726143: /*period*/ return new String[] {"Period"};
673        case 1524132147: /*encounter*/ return new String[] {"Reference"};
674        case -1406328437: /*author*/ return new String[] {"Reference"};
675        default: return super.getTypesForProperty(hash, name);
676        }
677
678      }
679
680      @Override
681      public Base addChild(String name) throws FHIRException {
682        if (name.equals("identifier")) {
683          return addIdentifier();
684        }
685        else if (name.equals("status")) {
686          throw new FHIRException("Cannot call addChild on a primitive type Flag.status");
687        }
688        else if (name.equals("category")) {
689          this.category = new CodeableConcept();
690          return this.category;
691        }
692        else if (name.equals("code")) {
693          this.code = new CodeableConcept();
694          return this.code;
695        }
696        else if (name.equals("subject")) {
697          this.subject = new Reference();
698          return this.subject;
699        }
700        else if (name.equals("period")) {
701          this.period = new Period();
702          return this.period;
703        }
704        else if (name.equals("encounter")) {
705          this.encounter = new Reference();
706          return this.encounter;
707        }
708        else if (name.equals("author")) {
709          this.author = new Reference();
710          return this.author;
711        }
712        else
713          return super.addChild(name);
714      }
715
716  public String fhirType() {
717    return "Flag";
718
719  }
720
721      public Flag copy() {
722        Flag dst = new Flag();
723        copyValues(dst);
724        if (identifier != null) {
725          dst.identifier = new ArrayList<Identifier>();
726          for (Identifier i : identifier)
727            dst.identifier.add(i.copy());
728        };
729        dst.status = status == null ? null : status.copy();
730        dst.category = category == null ? null : category.copy();
731        dst.code = code == null ? null : code.copy();
732        dst.subject = subject == null ? null : subject.copy();
733        dst.period = period == null ? null : period.copy();
734        dst.encounter = encounter == null ? null : encounter.copy();
735        dst.author = author == null ? null : author.copy();
736        return dst;
737      }
738
739      protected Flag typedCopy() {
740        return copy();
741      }
742
743      @Override
744      public boolean equalsDeep(Base other_) {
745        if (!super.equalsDeep(other_))
746          return false;
747        if (!(other_ instanceof Flag))
748          return false;
749        Flag o = (Flag) other_;
750        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(category, o.category, true)
751           && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true) && compareDeep(period, o.period, true)
752           && compareDeep(encounter, o.encounter, true) && compareDeep(author, o.author, true);
753      }
754
755      @Override
756      public boolean equalsShallow(Base other_) {
757        if (!super.equalsShallow(other_))
758          return false;
759        if (!(other_ instanceof Flag))
760          return false;
761        Flag o = (Flag) other_;
762        return compareValues(status, o.status, true);
763      }
764
765      public boolean isEmpty() {
766        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, category
767          , code, subject, period, encounter, author);
768      }
769
770  @Override
771  public ResourceType getResourceType() {
772    return ResourceType.Flag;
773   }
774
775 /**
776   * Search parameter: <b>date</b>
777   * <p>
778   * Description: <b>Time period when flag is active</b><br>
779   * Type: <b>date</b><br>
780   * Path: <b>Flag.period</b><br>
781   * </p>
782   */
783  @SearchParamDefinition(name="date", path="Flag.period", description="Time period when flag is active", type="date" )
784  public static final String SP_DATE = "date";
785 /**
786   * <b>Fluent Client</b> search parameter constant for <b>date</b>
787   * <p>
788   * Description: <b>Time period when flag is active</b><br>
789   * Type: <b>date</b><br>
790   * Path: <b>Flag.period</b><br>
791   * </p>
792   */
793  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
794
795 /**
796   * Search parameter: <b>identifier</b>
797   * <p>
798   * Description: <b>Business identifier</b><br>
799   * Type: <b>token</b><br>
800   * Path: <b>Flag.identifier</b><br>
801   * </p>
802   */
803  @SearchParamDefinition(name="identifier", path="Flag.identifier", description="Business identifier", type="token" )
804  public static final String SP_IDENTIFIER = "identifier";
805 /**
806   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
807   * <p>
808   * Description: <b>Business identifier</b><br>
809   * Type: <b>token</b><br>
810   * Path: <b>Flag.identifier</b><br>
811   * </p>
812   */
813  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
814
815 /**
816   * Search parameter: <b>subject</b>
817   * <p>
818   * Description: <b>The identity of a subject to list flags for</b><br>
819   * Type: <b>reference</b><br>
820   * Path: <b>Flag.subject</b><br>
821   * </p>
822   */
823  @SearchParamDefinition(name="subject", path="Flag.subject", description="The identity of a subject to list flags for", type="reference", target={Group.class, Location.class, Medication.class, Organization.class, Patient.class, PlanDefinition.class, Practitioner.class, Procedure.class } )
824  public static final String SP_SUBJECT = "subject";
825 /**
826   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
827   * <p>
828   * Description: <b>The identity of a subject to list flags for</b><br>
829   * Type: <b>reference</b><br>
830   * Path: <b>Flag.subject</b><br>
831   * </p>
832   */
833  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
834
835/**
836   * Constant for fluent queries to be used to add include statements. Specifies
837   * the path value of "<b>Flag:subject</b>".
838   */
839  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Flag:subject").toLocked();
840
841 /**
842   * Search parameter: <b>patient</b>
843   * <p>
844   * Description: <b>The identity of a subject to list flags for</b><br>
845   * Type: <b>reference</b><br>
846   * Path: <b>Flag.subject</b><br>
847   * </p>
848   */
849  @SearchParamDefinition(name="patient", path="Flag.subject", description="The identity of a subject to list flags for", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
850  public static final String SP_PATIENT = "patient";
851 /**
852   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
853   * <p>
854   * Description: <b>The identity of a subject to list flags for</b><br>
855   * Type: <b>reference</b><br>
856   * Path: <b>Flag.subject</b><br>
857   * </p>
858   */
859  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
860
861/**
862   * Constant for fluent queries to be used to add include statements. Specifies
863   * the path value of "<b>Flag:patient</b>".
864   */
865  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Flag:patient").toLocked();
866
867 /**
868   * Search parameter: <b>author</b>
869   * <p>
870   * Description: <b>Flag creator</b><br>
871   * Type: <b>reference</b><br>
872   * Path: <b>Flag.author</b><br>
873   * </p>
874   */
875  @SearchParamDefinition(name="author", path="Flag.author", description="Flag creator", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Device.class, Organization.class, Patient.class, Practitioner.class } )
876  public static final String SP_AUTHOR = "author";
877 /**
878   * <b>Fluent Client</b> search parameter constant for <b>author</b>
879   * <p>
880   * Description: <b>Flag creator</b><br>
881   * Type: <b>reference</b><br>
882   * Path: <b>Flag.author</b><br>
883   * </p>
884   */
885  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHOR);
886
887/**
888   * Constant for fluent queries to be used to add include statements. Specifies
889   * the path value of "<b>Flag:author</b>".
890   */
891  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include("Flag:author").toLocked();
892
893 /**
894   * Search parameter: <b>encounter</b>
895   * <p>
896   * Description: <b>Alert relevant during encounter</b><br>
897   * Type: <b>reference</b><br>
898   * Path: <b>Flag.encounter</b><br>
899   * </p>
900   */
901  @SearchParamDefinition(name="encounter", path="Flag.encounter", description="Alert relevant during encounter", type="reference", target={Encounter.class } )
902  public static final String SP_ENCOUNTER = "encounter";
903 /**
904   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
905   * <p>
906   * Description: <b>Alert relevant during encounter</b><br>
907   * Type: <b>reference</b><br>
908   * Path: <b>Flag.encounter</b><br>
909   * </p>
910   */
911  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
912
913/**
914   * Constant for fluent queries to be used to add include statements. Specifies
915   * the path value of "<b>Flag:encounter</b>".
916   */
917  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("Flag:encounter").toLocked();
918
919
920}