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