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