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