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