001package org.hl7.fhir.dstu2.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.dstu2
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023
024/*
025  Copyright (c) 2011+, HL7, Inc.
026  All rights reserved.
027  
028  Redistribution and use in source and binary forms, with or without modification, 
029  are permitted provided that the following conditions are met:
030  
031   * Redistributions of source code must retain the above copyright notice, this 
032     list of conditions and the following disclaimer.
033   * Redistributions in binary form must reproduce the above copyright notice, 
034     this list of conditions and the following disclaimer in the documentation 
035     and/or other materials provided with the distribution.
036   * Neither the name of HL7 nor the names of its contributors may be used to 
037     endorse or promote products derived from this software without specific 
038     prior written permission.
039  
040  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
041  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
042  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
043  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
044  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
045  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
046  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
047  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
048  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
049  POSSIBILITY OF SUCH DAMAGE.
050  
051*/
052
053// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
054import java.util.ArrayList;
055import java.util.List;
056
057import ca.uhn.fhir.model.api.annotation.Child;
058import ca.uhn.fhir.model.api.annotation.Description;
059import ca.uhn.fhir.model.api.annotation.ResourceDef;
060import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
061import org.hl7.fhir.exceptions.FHIRException;
062/**
063 * Prospective warnings of potential issues when providing care to the patient.
064 */
065@ResourceDef(name="Flag", profile="http://hl7.org/fhir/Profile/Flag")
066public class Flag extends DomainResource {
067
068    public enum FlagStatus {
069        /**
070         * A current flag that should be displayed to a user. A system may use the category to determine which roles should view the flag.
071         */
072        ACTIVE, 
073        /**
074         * The flag does not need to be displayed any more.
075         */
076        INACTIVE, 
077        /**
078         * The flag was added in error, and should no longer be displayed.
079         */
080        ENTEREDINERROR, 
081        /**
082         * added to help the parsers
083         */
084        NULL;
085        public static FlagStatus fromCode(String codeString) throws FHIRException {
086            if (codeString == null || "".equals(codeString))
087                return null;
088        if ("active".equals(codeString))
089          return ACTIVE;
090        if ("inactive".equals(codeString))
091          return INACTIVE;
092        if ("entered-in-error".equals(codeString))
093          return ENTEREDINERROR;
094        throw new FHIRException("Unknown FlagStatus code '"+codeString+"'");
095        }
096        public String toCode() {
097          switch (this) {
098            case ACTIVE: return "active";
099            case INACTIVE: return "inactive";
100            case ENTEREDINERROR: return "entered-in-error";
101            default: return "?";
102          }
103        }
104        public String getSystem() {
105          switch (this) {
106            case ACTIVE: return "http://hl7.org/fhir/flag-status";
107            case INACTIVE: return "http://hl7.org/fhir/flag-status";
108            case ENTEREDINERROR: return "http://hl7.org/fhir/flag-status";
109            default: return "?";
110          }
111        }
112        public String getDefinition() {
113          switch (this) {
114            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.";
115            case INACTIVE: return "The flag does not need to be displayed any more.";
116            case ENTEREDINERROR: return "The flag was added in error, and should no longer be displayed.";
117            default: return "?";
118          }
119        }
120        public String getDisplay() {
121          switch (this) {
122            case ACTIVE: return "Active";
123            case INACTIVE: return "Inactive";
124            case ENTEREDINERROR: return "Entered in Error";
125            default: return "?";
126          }
127        }
128    }
129
130  public static class FlagStatusEnumFactory implements EnumFactory<FlagStatus> {
131    public FlagStatus fromCode(String codeString) throws IllegalArgumentException {
132      if (codeString == null || "".equals(codeString))
133            if (codeString == null || "".equals(codeString))
134                return null;
135        if ("active".equals(codeString))
136          return FlagStatus.ACTIVE;
137        if ("inactive".equals(codeString))
138          return FlagStatus.INACTIVE;
139        if ("entered-in-error".equals(codeString))
140          return FlagStatus.ENTEREDINERROR;
141        throw new IllegalArgumentException("Unknown FlagStatus code '"+codeString+"'");
142        }
143        public Enumeration<FlagStatus> fromType(Base code) throws FHIRException {
144          if (code == null || code.isEmpty())
145            return null;
146          String codeString = ((PrimitiveType) code).asStringValue();
147          if (codeString == null || "".equals(codeString))
148            return null;
149        if ("active".equals(codeString))
150          return new Enumeration<FlagStatus>(this, FlagStatus.ACTIVE);
151        if ("inactive".equals(codeString))
152          return new Enumeration<FlagStatus>(this, FlagStatus.INACTIVE);
153        if ("entered-in-error".equals(codeString))
154          return new Enumeration<FlagStatus>(this, FlagStatus.ENTEREDINERROR);
155        throw new FHIRException("Unknown FlagStatus code '"+codeString+"'");
156        }
157    public String toCode(FlagStatus code) {
158      if (code == FlagStatus.ACTIVE)
159        return "active";
160      if (code == FlagStatus.INACTIVE)
161        return "inactive";
162      if (code == FlagStatus.ENTEREDINERROR)
163        return "entered-in-error";
164      return "?";
165      }
166    }
167
168    /**
169     * Identifier assigned to the flag for external use (outside the FHIR environment).
170     */
171    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
172    @Description(shortDefinition="Business identifier", formalDefinition="Identifier assigned to the flag for external use (outside the FHIR environment)." )
173    protected List<Identifier> identifier;
174
175    /**
176     * 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.
177     */
178    @Child(name = "category", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
179    @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." )
180    protected CodeableConcept category;
181
182    /**
183     * Supports basic workflow.
184     */
185    @Child(name = "status", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true)
186    @Description(shortDefinition="active | inactive | entered-in-error", formalDefinition="Supports basic workflow." )
187    protected Enumeration<FlagStatus> status;
188
189    /**
190     * 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.
191     */
192    @Child(name = "period", type = {Period.class}, order=3, min=0, max=1, modifier=false, summary=true)
193    @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." )
194    protected Period period;
195
196    /**
197     * The patient, location, group , organization , or practitioner this is about record this flag is associated with.
198     */
199    @Child(name = "subject", type = {Patient.class, Location.class, Group.class, Organization.class, Practitioner.class}, order=4, min=1, max=1, modifier=false, summary=true)
200    @Description(shortDefinition="Who/What is flag about?", formalDefinition="The patient, location, group , organization , or practitioner this is about record this flag is associated with." )
201    protected Reference subject;
202
203    /**
204     * 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.)
205     */
206    protected Resource subjectTarget;
207
208    /**
209     * This alert is only relevant during the encounter.
210     */
211    @Child(name = "encounter", type = {Encounter.class}, order=5, min=0, max=1, modifier=false, summary=true)
212    @Description(shortDefinition="Alert relevant during encounter", formalDefinition="This alert is only relevant during the encounter." )
213    protected Reference encounter;
214
215    /**
216     * The actual object that is the target of the reference (This alert is only relevant during the encounter.)
217     */
218    protected Encounter encounterTarget;
219
220    /**
221     * The person, organization or device that created the flag.
222     */
223    @Child(name = "author", type = {Device.class, Organization.class, Patient.class, Practitioner.class}, order=6, min=0, max=1, modifier=false, summary=true)
224    @Description(shortDefinition="Flag creator", formalDefinition="The person, organization or device that created the flag." )
225    protected Reference author;
226
227    /**
228     * The actual object that is the target of the reference (The person, organization or device that created the flag.)
229     */
230    protected Resource authorTarget;
231
232    /**
233     * The coded value or textual component of the flag to display to the user.
234     */
235    @Child(name = "code", type = {CodeableConcept.class}, order=7, min=1, max=1, modifier=false, summary=true)
236    @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." )
237    protected CodeableConcept code;
238
239    private static final long serialVersionUID = 701147751L;
240
241  /*
242   * Constructor
243   */
244    public Flag() {
245      super();
246    }
247
248  /*
249   * Constructor
250   */
251    public Flag(Enumeration<FlagStatus> status, Reference subject, CodeableConcept code) {
252      super();
253      this.status = status;
254      this.subject = subject;
255      this.code = code;
256    }
257
258    /**
259     * @return {@link #identifier} (Identifier assigned to the flag for external use (outside the FHIR environment).)
260     */
261    public List<Identifier> getIdentifier() { 
262      if (this.identifier == null)
263        this.identifier = new ArrayList<Identifier>();
264      return this.identifier;
265    }
266
267    public boolean hasIdentifier() { 
268      if (this.identifier == null)
269        return false;
270      for (Identifier item : this.identifier)
271        if (!item.isEmpty())
272          return true;
273      return false;
274    }
275
276    /**
277     * @return {@link #identifier} (Identifier assigned to the flag for external use (outside the FHIR environment).)
278     */
279    // syntactic sugar
280    public Identifier addIdentifier() { //3
281      Identifier t = new Identifier();
282      if (this.identifier == null)
283        this.identifier = new ArrayList<Identifier>();
284      this.identifier.add(t);
285      return t;
286    }
287
288    // syntactic sugar
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 {@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.)
300     */
301    public CodeableConcept getCategory() { 
302      if (this.category == null)
303        if (Configuration.errorOnAutoCreate())
304          throw new Error("Attempt to auto-create Flag.category");
305        else if (Configuration.doAutoCreate())
306          this.category = new CodeableConcept(); // cc
307      return this.category;
308    }
309
310    public boolean hasCategory() { 
311      return this.category != null && !this.category.isEmpty();
312    }
313
314    /**
315     * @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.)
316     */
317    public Flag setCategory(CodeableConcept value) { 
318      this.category = value;
319      return this;
320    }
321
322    /**
323     * @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
324     */
325    public Enumeration<FlagStatus> getStatusElement() { 
326      if (this.status == null)
327        if (Configuration.errorOnAutoCreate())
328          throw new Error("Attempt to auto-create Flag.status");
329        else if (Configuration.doAutoCreate())
330          this.status = new Enumeration<FlagStatus>(new FlagStatusEnumFactory()); // bb
331      return this.status;
332    }
333
334    public boolean hasStatusElement() { 
335      return this.status != null && !this.status.isEmpty();
336    }
337
338    public boolean hasStatus() { 
339      return this.status != null && !this.status.isEmpty();
340    }
341
342    /**
343     * @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
344     */
345    public Flag setStatusElement(Enumeration<FlagStatus> value) { 
346      this.status = value;
347      return this;
348    }
349
350    /**
351     * @return Supports basic workflow.
352     */
353    public FlagStatus getStatus() { 
354      return this.status == null ? null : this.status.getValue();
355    }
356
357    /**
358     * @param value Supports basic workflow.
359     */
360    public Flag setStatus(FlagStatus value) { 
361        if (this.status == null)
362          this.status = new Enumeration<FlagStatus>(new FlagStatusEnumFactory());
363        this.status.setValue(value);
364      return this;
365    }
366
367    /**
368     * @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.)
369     */
370    public Period getPeriod() { 
371      if (this.period == null)
372        if (Configuration.errorOnAutoCreate())
373          throw new Error("Attempt to auto-create Flag.period");
374        else if (Configuration.doAutoCreate())
375          this.period = new Period(); // cc
376      return this.period;
377    }
378
379    public boolean hasPeriod() { 
380      return this.period != null && !this.period.isEmpty();
381    }
382
383    /**
384     * @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.)
385     */
386    public Flag setPeriod(Period value) { 
387      this.period = value;
388      return this;
389    }
390
391    /**
392     * @return {@link #subject} (The patient, location, group , organization , or practitioner this is about record this flag is associated with.)
393     */
394    public Reference getSubject() { 
395      if (this.subject == null)
396        if (Configuration.errorOnAutoCreate())
397          throw new Error("Attempt to auto-create Flag.subject");
398        else if (Configuration.doAutoCreate())
399          this.subject = new Reference(); // cc
400      return this.subject;
401    }
402
403    public boolean hasSubject() { 
404      return this.subject != null && !this.subject.isEmpty();
405    }
406
407    /**
408     * @param value {@link #subject} (The patient, location, group , organization , or practitioner this is about record this flag is associated with.)
409     */
410    public Flag setSubject(Reference value) { 
411      this.subject = value;
412      return this;
413    }
414
415    /**
416     * @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.)
417     */
418    public Resource getSubjectTarget() { 
419      return this.subjectTarget;
420    }
421
422    /**
423     * @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.)
424     */
425    public Flag setSubjectTarget(Resource value) { 
426      this.subjectTarget = value;
427      return this;
428    }
429
430    /**
431     * @return {@link #encounter} (This alert is only relevant during the encounter.)
432     */
433    public Reference getEncounter() { 
434      if (this.encounter == null)
435        if (Configuration.errorOnAutoCreate())
436          throw new Error("Attempt to auto-create Flag.encounter");
437        else if (Configuration.doAutoCreate())
438          this.encounter = new Reference(); // cc
439      return this.encounter;
440    }
441
442    public boolean hasEncounter() { 
443      return this.encounter != null && !this.encounter.isEmpty();
444    }
445
446    /**
447     * @param value {@link #encounter} (This alert is only relevant during the encounter.)
448     */
449    public Flag setEncounter(Reference value) { 
450      this.encounter = value;
451      return this;
452    }
453
454    /**
455     * @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.)
456     */
457    public Encounter getEncounterTarget() { 
458      if (this.encounterTarget == null)
459        if (Configuration.errorOnAutoCreate())
460          throw new Error("Attempt to auto-create Flag.encounter");
461        else if (Configuration.doAutoCreate())
462          this.encounterTarget = new Encounter(); // aa
463      return this.encounterTarget;
464    }
465
466    /**
467     * @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.)
468     */
469    public Flag setEncounterTarget(Encounter value) { 
470      this.encounterTarget = value;
471      return this;
472    }
473
474    /**
475     * @return {@link #author} (The person, organization or device that created the flag.)
476     */
477    public Reference getAuthor() { 
478      if (this.author == null)
479        if (Configuration.errorOnAutoCreate())
480          throw new Error("Attempt to auto-create Flag.author");
481        else if (Configuration.doAutoCreate())
482          this.author = new Reference(); // cc
483      return this.author;
484    }
485
486    public boolean hasAuthor() { 
487      return this.author != null && !this.author.isEmpty();
488    }
489
490    /**
491     * @param value {@link #author} (The person, organization or device that created the flag.)
492     */
493    public Flag setAuthor(Reference value) { 
494      this.author = value;
495      return this;
496    }
497
498    /**
499     * @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.)
500     */
501    public Resource getAuthorTarget() { 
502      return this.authorTarget;
503    }
504
505    /**
506     * @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.)
507     */
508    public Flag setAuthorTarget(Resource value) { 
509      this.authorTarget = value;
510      return this;
511    }
512
513    /**
514     * @return {@link #code} (The coded value or textual component of the flag to display to the user.)
515     */
516    public CodeableConcept getCode() { 
517      if (this.code == null)
518        if (Configuration.errorOnAutoCreate())
519          throw new Error("Attempt to auto-create Flag.code");
520        else if (Configuration.doAutoCreate())
521          this.code = new CodeableConcept(); // cc
522      return this.code;
523    }
524
525    public boolean hasCode() { 
526      return this.code != null && !this.code.isEmpty();
527    }
528
529    /**
530     * @param value {@link #code} (The coded value or textual component of the flag to display to the user.)
531     */
532    public Flag setCode(CodeableConcept value) { 
533      this.code = value;
534      return this;
535    }
536
537      protected void listChildren(List<Property> childrenList) {
538        super.listChildren(childrenList);
539        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));
540        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));
541        childrenList.add(new Property("status", "code", "Supports basic workflow.", 0, java.lang.Integer.MAX_VALUE, status));
542        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));
543        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));
544        childrenList.add(new Property("encounter", "Reference(Encounter)", "This alert is only relevant during the encounter.", 0, java.lang.Integer.MAX_VALUE, encounter));
545        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));
546        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));
547      }
548
549      @Override
550      public void setProperty(String name, Base value) throws FHIRException {
551        if (name.equals("identifier"))
552          this.getIdentifier().add(castToIdentifier(value));
553        else if (name.equals("category"))
554          this.category = castToCodeableConcept(value); // CodeableConcept
555        else if (name.equals("status"))
556          this.status = new FlagStatusEnumFactory().fromType(value); // Enumeration<FlagStatus>
557        else if (name.equals("period"))
558          this.period = castToPeriod(value); // Period
559        else if (name.equals("subject"))
560          this.subject = castToReference(value); // Reference
561        else if (name.equals("encounter"))
562          this.encounter = castToReference(value); // Reference
563        else if (name.equals("author"))
564          this.author = castToReference(value); // Reference
565        else if (name.equals("code"))
566          this.code = castToCodeableConcept(value); // CodeableConcept
567        else
568          super.setProperty(name, value);
569      }
570
571      @Override
572      public Base addChild(String name) throws FHIRException {
573        if (name.equals("identifier")) {
574          return addIdentifier();
575        }
576        else if (name.equals("category")) {
577          this.category = new CodeableConcept();
578          return this.category;
579        }
580        else if (name.equals("status")) {
581          throw new FHIRException("Cannot call addChild on a primitive type Flag.status");
582        }
583        else if (name.equals("period")) {
584          this.period = new Period();
585          return this.period;
586        }
587        else if (name.equals("subject")) {
588          this.subject = new Reference();
589          return this.subject;
590        }
591        else if (name.equals("encounter")) {
592          this.encounter = new Reference();
593          return this.encounter;
594        }
595        else if (name.equals("author")) {
596          this.author = new Reference();
597          return this.author;
598        }
599        else if (name.equals("code")) {
600          this.code = new CodeableConcept();
601          return this.code;
602        }
603        else
604          return super.addChild(name);
605      }
606
607  public String fhirType() {
608    return "Flag";
609
610  }
611
612      public Flag copy() {
613        Flag dst = new Flag();
614        copyValues(dst);
615        if (identifier != null) {
616          dst.identifier = new ArrayList<Identifier>();
617          for (Identifier i : identifier)
618            dst.identifier.add(i.copy());
619        };
620        dst.category = category == null ? null : category.copy();
621        dst.status = status == null ? null : status.copy();
622        dst.period = period == null ? null : period.copy();
623        dst.subject = subject == null ? null : subject.copy();
624        dst.encounter = encounter == null ? null : encounter.copy();
625        dst.author = author == null ? null : author.copy();
626        dst.code = code == null ? null : code.copy();
627        return dst;
628      }
629
630      protected Flag typedCopy() {
631        return copy();
632      }
633
634      @Override
635      public boolean equalsDeep(Base other) {
636        if (!super.equalsDeep(other))
637          return false;
638        if (!(other instanceof Flag))
639          return false;
640        Flag o = (Flag) other;
641        return compareDeep(identifier, o.identifier, true) && compareDeep(category, o.category, true) && compareDeep(status, o.status, true)
642           && compareDeep(period, o.period, true) && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true)
643           && compareDeep(author, o.author, true) && compareDeep(code, o.code, true);
644      }
645
646      @Override
647      public boolean equalsShallow(Base other) {
648        if (!super.equalsShallow(other))
649          return false;
650        if (!(other instanceof Flag))
651          return false;
652        Flag o = (Flag) other;
653        return compareValues(status, o.status, true);
654      }
655
656      public boolean isEmpty() {
657        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (category == null || category.isEmpty())
658           && (status == null || status.isEmpty()) && (period == null || period.isEmpty()) && (subject == null || subject.isEmpty())
659           && (encounter == null || encounter.isEmpty()) && (author == null || author.isEmpty()) && (code == null || code.isEmpty())
660          ;
661      }
662
663  @Override
664  public ResourceType getResourceType() {
665    return ResourceType.Flag;
666   }
667
668  @SearchParamDefinition(name="date", path="Flag.period", description="Time period when flag is active", type="date" )
669  public static final String SP_DATE = "date";
670  @SearchParamDefinition(name="subject", path="Flag.subject", description="The identity of a subject to list flags for", type="reference" )
671  public static final String SP_SUBJECT = "subject";
672  @SearchParamDefinition(name="patient", path="Flag.subject", description="The identity of a subject to list flags for", type="reference" )
673  public static final String SP_PATIENT = "patient";
674  @SearchParamDefinition(name="author", path="Flag.author", description="Flag creator", type="reference" )
675  public static final String SP_AUTHOR = "author";
676  @SearchParamDefinition(name="encounter", path="Flag.encounter", description="Alert relevant during encounter", type="reference" )
677  public static final String SP_ENCOUNTER = "encounter";
678
679}
680