001package org.hl7.fhir.dstu2.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 033import java.util.ArrayList; 034import java.util.List; 035 036import ca.uhn.fhir.model.api.annotation.Child; 037import ca.uhn.fhir.model.api.annotation.Description; 038import ca.uhn.fhir.model.api.annotation.ResourceDef; 039import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 040import org.hl7.fhir.exceptions.FHIRException; 041 042/** 043 * Prospective warnings of potential issues when providing care to the patient. 044 */ 045@ResourceDef(name = "Flag", profile = "http://hl7.org/fhir/Profile/Flag") 046public class Flag extends DomainResource { 047 048 public enum FlagStatus { 049 /** 050 * A current flag that should be displayed to a user. A system may use the 051 * category to determine which roles should view the flag. 052 */ 053 ACTIVE, 054 /** 055 * The flag does not need to be displayed any more. 056 */ 057 INACTIVE, 058 /** 059 * The flag was added in error, and should no longer be displayed. 060 */ 061 ENTEREDINERROR, 062 /** 063 * added to help the parsers 064 */ 065 NULL; 066 067 public static FlagStatus fromCode(String codeString) throws FHIRException { 068 if (codeString == null || "".equals(codeString)) 069 return null; 070 if ("active".equals(codeString)) 071 return ACTIVE; 072 if ("inactive".equals(codeString)) 073 return INACTIVE; 074 if ("entered-in-error".equals(codeString)) 075 return ENTEREDINERROR; 076 throw new FHIRException("Unknown FlagStatus code '" + codeString + "'"); 077 } 078 079 public String toCode() { 080 switch (this) { 081 case ACTIVE: 082 return "active"; 083 case INACTIVE: 084 return "inactive"; 085 case ENTEREDINERROR: 086 return "entered-in-error"; 087 case NULL: 088 return null; 089 default: 090 return "?"; 091 } 092 } 093 094 public String getSystem() { 095 switch (this) { 096 case ACTIVE: 097 return "http://hl7.org/fhir/flag-status"; 098 case INACTIVE: 099 return "http://hl7.org/fhir/flag-status"; 100 case ENTEREDINERROR: 101 return "http://hl7.org/fhir/flag-status"; 102 case NULL: 103 return null; 104 default: 105 return "?"; 106 } 107 } 108 109 public String getDefinition() { 110 switch (this) { 111 case ACTIVE: 112 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."; 113 case INACTIVE: 114 return "The flag does not need to be displayed any more."; 115 case ENTEREDINERROR: 116 return "The flag was added in error, and should no longer be displayed."; 117 case NULL: 118 return null; 119 default: 120 return "?"; 121 } 122 } 123 124 public String getDisplay() { 125 switch (this) { 126 case ACTIVE: 127 return "Active"; 128 case INACTIVE: 129 return "Inactive"; 130 case ENTEREDINERROR: 131 return "Entered in Error"; 132 case NULL: 133 return null; 134 default: 135 return "?"; 136 } 137 } 138 } 139 140 public static class FlagStatusEnumFactory implements EnumFactory<FlagStatus> { 141 public FlagStatus fromCode(String codeString) throws IllegalArgumentException { 142 if (codeString == null || "".equals(codeString)) 143 if (codeString == null || "".equals(codeString)) 144 return null; 145 if ("active".equals(codeString)) 146 return FlagStatus.ACTIVE; 147 if ("inactive".equals(codeString)) 148 return FlagStatus.INACTIVE; 149 if ("entered-in-error".equals(codeString)) 150 return FlagStatus.ENTEREDINERROR; 151 throw new IllegalArgumentException("Unknown FlagStatus code '" + codeString + "'"); 152 } 153 154 public Enumeration<FlagStatus> fromType(Base code) throws FHIRException { 155 if (code == null || code.isEmpty()) 156 return null; 157 String codeString = ((PrimitiveType) code).asStringValue(); 158 if (codeString == null || "".equals(codeString)) 159 return null; 160 if ("active".equals(codeString)) 161 return new Enumeration<FlagStatus>(this, FlagStatus.ACTIVE); 162 if ("inactive".equals(codeString)) 163 return new Enumeration<FlagStatus>(this, FlagStatus.INACTIVE); 164 if ("entered-in-error".equals(codeString)) 165 return new Enumeration<FlagStatus>(this, FlagStatus.ENTEREDINERROR); 166 throw new FHIRException("Unknown FlagStatus code '" + codeString + "'"); 167 } 168 169 public String toCode(FlagStatus code) { 170 if (code == FlagStatus.ACTIVE) 171 return "active"; 172 if (code == FlagStatus.INACTIVE) 173 return "inactive"; 174 if (code == FlagStatus.ENTEREDINERROR) 175 return "entered-in-error"; 176 return "?"; 177 } 178 } 179 180 /** 181 * Identifier assigned to the flag for external use (outside the FHIR 182 * environment). 183 */ 184 @Child(name = "identifier", type = { 185 Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 186 @Description(shortDefinition = "Business identifier", formalDefinition = "Identifier assigned to the flag for external use (outside the FHIR environment).") 187 protected List<Identifier> identifier; 188 189 /** 190 * Allows an flag to be divided into different categories like clinical, 191 * administrative etc. Intended to be used as a means of filtering which flags 192 * are displayed to particular user or in a given context. 193 */ 194 @Child(name = "category", type = { 195 CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = true) 196 @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.") 197 protected CodeableConcept category; 198 199 /** 200 * Supports basic workflow. 201 */ 202 @Child(name = "status", type = { CodeType.class }, order = 2, min = 1, max = 1, modifier = true, summary = true) 203 @Description(shortDefinition = "active | inactive | entered-in-error", formalDefinition = "Supports basic workflow.") 204 protected Enumeration<FlagStatus> status; 205 206 /** 207 * The period of time from the activation of the flag to inactivation of the 208 * flag. If the flag is active, the end of the period should be unspecified. 209 */ 210 @Child(name = "period", type = { Period.class }, order = 3, min = 0, max = 1, modifier = false, summary = true) 211 @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.") 212 protected Period period; 213 214 /** 215 * The patient, location, group , organization , or practitioner this is about 216 * record this flag is associated with. 217 */ 218 @Child(name = "subject", type = { Patient.class, Location.class, Group.class, Organization.class, 219 Practitioner.class }, order = 4, min = 1, max = 1, modifier = false, summary = true) 220 @Description(shortDefinition = "Who/What is flag about?", formalDefinition = "The patient, location, group , organization , or practitioner this is about record this flag is associated with.") 221 protected Reference subject; 222 223 /** 224 * The actual object that is the target of the reference (The patient, location, 225 * group , organization , or practitioner this is about record this flag is 226 * associated with.) 227 */ 228 protected Resource subjectTarget; 229 230 /** 231 * This alert is only relevant during the encounter. 232 */ 233 @Child(name = "encounter", type = { Encounter.class }, order = 5, min = 0, max = 1, modifier = false, summary = true) 234 @Description(shortDefinition = "Alert relevant during encounter", formalDefinition = "This alert is only relevant during the encounter.") 235 protected Reference encounter; 236 237 /** 238 * The actual object that is the target of the reference (This alert is only 239 * relevant during the encounter.) 240 */ 241 protected Encounter encounterTarget; 242 243 /** 244 * The person, organization or device that created the flag. 245 */ 246 @Child(name = "author", type = { Device.class, Organization.class, Patient.class, 247 Practitioner.class }, order = 6, min = 0, max = 1, modifier = false, summary = true) 248 @Description(shortDefinition = "Flag creator", formalDefinition = "The person, organization or device that created the flag.") 249 protected Reference author; 250 251 /** 252 * The actual object that is the target of the reference (The person, 253 * organization or device that created the flag.) 254 */ 255 protected Resource authorTarget; 256 257 /** 258 * The coded value or textual component of the flag to display to the user. 259 */ 260 @Child(name = "code", type = { CodeableConcept.class }, order = 7, min = 1, max = 1, modifier = false, summary = true) 261 @Description(shortDefinition = "Partially deaf, Requires easy open caps, No permanent address, etc.", formalDefinition = "The coded value or textual component of the flag to display to the user.") 262 protected CodeableConcept code; 263 264 private static final long serialVersionUID = 701147751L; 265 266 /* 267 * Constructor 268 */ 269 public Flag() { 270 super(); 271 } 272 273 /* 274 * Constructor 275 */ 276 public Flag(Enumeration<FlagStatus> status, Reference subject, CodeableConcept code) { 277 super(); 278 this.status = status; 279 this.subject = subject; 280 this.code = code; 281 } 282 283 /** 284 * @return {@link #identifier} (Identifier assigned to the flag for external use 285 * (outside the FHIR environment).) 286 */ 287 public List<Identifier> getIdentifier() { 288 if (this.identifier == null) 289 this.identifier = new ArrayList<Identifier>(); 290 return this.identifier; 291 } 292 293 public boolean hasIdentifier() { 294 if (this.identifier == null) 295 return false; 296 for (Identifier item : this.identifier) 297 if (!item.isEmpty()) 298 return true; 299 return false; 300 } 301 302 /** 303 * @return {@link #identifier} (Identifier assigned to the flag for external use 304 * (outside the FHIR environment).) 305 */ 306 // syntactic sugar 307 public Identifier addIdentifier() { // 3 308 Identifier t = new Identifier(); 309 if (this.identifier == null) 310 this.identifier = new ArrayList<Identifier>(); 311 this.identifier.add(t); 312 return t; 313 } 314 315 // syntactic sugar 316 public Flag addIdentifier(Identifier t) { // 3 317 if (t == null) 318 return this; 319 if (this.identifier == null) 320 this.identifier = new ArrayList<Identifier>(); 321 this.identifier.add(t); 322 return this; 323 } 324 325 /** 326 * @return {@link #category} (Allows an flag to be divided into different 327 * categories like clinical, administrative etc. Intended to be used as 328 * a means of filtering which flags are displayed to particular user or 329 * in a given context.) 330 */ 331 public CodeableConcept getCategory() { 332 if (this.category == null) 333 if (Configuration.errorOnAutoCreate()) 334 throw new Error("Attempt to auto-create Flag.category"); 335 else if (Configuration.doAutoCreate()) 336 this.category = new CodeableConcept(); // cc 337 return this.category; 338 } 339 340 public boolean hasCategory() { 341 return this.category != null && !this.category.isEmpty(); 342 } 343 344 /** 345 * @param value {@link #category} (Allows an flag to be divided into different 346 * categories like clinical, administrative etc. Intended to be 347 * used as a means of filtering which flags are displayed to 348 * particular user or in a given context.) 349 */ 350 public Flag setCategory(CodeableConcept value) { 351 this.category = value; 352 return this; 353 } 354 355 /** 356 * @return {@link #status} (Supports basic workflow.). This is the underlying 357 * object with id, value and extensions. The accessor "getStatus" gives 358 * direct access to the value 359 */ 360 public Enumeration<FlagStatus> getStatusElement() { 361 if (this.status == null) 362 if (Configuration.errorOnAutoCreate()) 363 throw new Error("Attempt to auto-create Flag.status"); 364 else if (Configuration.doAutoCreate()) 365 this.status = new Enumeration<FlagStatus>(new FlagStatusEnumFactory()); // bb 366 return this.status; 367 } 368 369 public boolean hasStatusElement() { 370 return this.status != null && !this.status.isEmpty(); 371 } 372 373 public boolean hasStatus() { 374 return this.status != null && !this.status.isEmpty(); 375 } 376 377 /** 378 * @param value {@link #status} (Supports basic workflow.). This is the 379 * underlying object with id, value and extensions. The accessor 380 * "getStatus" gives direct access to the value 381 */ 382 public Flag setStatusElement(Enumeration<FlagStatus> value) { 383 this.status = value; 384 return this; 385 } 386 387 /** 388 * @return Supports basic workflow. 389 */ 390 public FlagStatus getStatus() { 391 return this.status == null ? null : this.status.getValue(); 392 } 393 394 /** 395 * @param value Supports basic workflow. 396 */ 397 public Flag setStatus(FlagStatus value) { 398 if (this.status == null) 399 this.status = new Enumeration<FlagStatus>(new FlagStatusEnumFactory()); 400 this.status.setValue(value); 401 return this; 402 } 403 404 /** 405 * @return {@link #period} (The period of time from the activation of the flag 406 * to inactivation of the flag. If the flag is active, the end of the 407 * period should be unspecified.) 408 */ 409 public Period getPeriod() { 410 if (this.period == null) 411 if (Configuration.errorOnAutoCreate()) 412 throw new Error("Attempt to auto-create Flag.period"); 413 else if (Configuration.doAutoCreate()) 414 this.period = new Period(); // cc 415 return this.period; 416 } 417 418 public boolean hasPeriod() { 419 return this.period != null && !this.period.isEmpty(); 420 } 421 422 /** 423 * @param value {@link #period} (The period of time from the activation of the 424 * flag to inactivation of the flag. If the flag is active, the end 425 * of the period should be unspecified.) 426 */ 427 public Flag setPeriod(Period value) { 428 this.period = value; 429 return this; 430 } 431 432 /** 433 * @return {@link #subject} (The patient, location, group , organization , or 434 * practitioner this is about record this flag is associated with.) 435 */ 436 public Reference getSubject() { 437 if (this.subject == null) 438 if (Configuration.errorOnAutoCreate()) 439 throw new Error("Attempt to auto-create Flag.subject"); 440 else if (Configuration.doAutoCreate()) 441 this.subject = new Reference(); // cc 442 return this.subject; 443 } 444 445 public boolean hasSubject() { 446 return this.subject != null && !this.subject.isEmpty(); 447 } 448 449 /** 450 * @param value {@link #subject} (The patient, location, group , organization , 451 * or practitioner this is about record this flag is associated 452 * with.) 453 */ 454 public Flag setSubject(Reference value) { 455 this.subject = value; 456 return this; 457 } 458 459 /** 460 * @return {@link #subject} The actual object that is the target of the 461 * reference. The reference library doesn't populate this, but you can 462 * use it to hold the resource if you resolve it. (The patient, 463 * location, group , organization , or practitioner this is about record 464 * this flag is associated with.) 465 */ 466 public Resource getSubjectTarget() { 467 return this.subjectTarget; 468 } 469 470 /** 471 * @param value {@link #subject} The actual object that is the target of the 472 * reference. The reference library doesn't use these, but you can 473 * use it to hold the resource if you resolve it. (The patient, 474 * location, group , organization , or practitioner this is about 475 * record this flag is associated with.) 476 */ 477 public Flag setSubjectTarget(Resource value) { 478 this.subjectTarget = value; 479 return this; 480 } 481 482 /** 483 * @return {@link #encounter} (This alert is only relevant during the 484 * encounter.) 485 */ 486 public Reference getEncounter() { 487 if (this.encounter == null) 488 if (Configuration.errorOnAutoCreate()) 489 throw new Error("Attempt to auto-create Flag.encounter"); 490 else if (Configuration.doAutoCreate()) 491 this.encounter = new Reference(); // cc 492 return this.encounter; 493 } 494 495 public boolean hasEncounter() { 496 return this.encounter != null && !this.encounter.isEmpty(); 497 } 498 499 /** 500 * @param value {@link #encounter} (This alert is only relevant during the 501 * encounter.) 502 */ 503 public Flag setEncounter(Reference value) { 504 this.encounter = value; 505 return this; 506 } 507 508 /** 509 * @return {@link #encounter} The actual object that is the target of the 510 * reference. The reference library doesn't populate this, but you can 511 * use it to hold the resource if you resolve it. (This alert is only 512 * relevant during the encounter.) 513 */ 514 public Encounter getEncounterTarget() { 515 if (this.encounterTarget == null) 516 if (Configuration.errorOnAutoCreate()) 517 throw new Error("Attempt to auto-create Flag.encounter"); 518 else if (Configuration.doAutoCreate()) 519 this.encounterTarget = new Encounter(); // aa 520 return this.encounterTarget; 521 } 522 523 /** 524 * @param value {@link #encounter} The actual object that is the target of the 525 * reference. The reference library doesn't use these, but you can 526 * use it to hold the resource if you resolve it. (This alert is 527 * only relevant during the encounter.) 528 */ 529 public Flag setEncounterTarget(Encounter value) { 530 this.encounterTarget = value; 531 return this; 532 } 533 534 /** 535 * @return {@link #author} (The person, organization or device that created the 536 * flag.) 537 */ 538 public Reference getAuthor() { 539 if (this.author == null) 540 if (Configuration.errorOnAutoCreate()) 541 throw new Error("Attempt to auto-create Flag.author"); 542 else if (Configuration.doAutoCreate()) 543 this.author = new Reference(); // cc 544 return this.author; 545 } 546 547 public boolean hasAuthor() { 548 return this.author != null && !this.author.isEmpty(); 549 } 550 551 /** 552 * @param value {@link #author} (The person, organization or device that created 553 * the flag.) 554 */ 555 public Flag setAuthor(Reference value) { 556 this.author = value; 557 return this; 558 } 559 560 /** 561 * @return {@link #author} The actual object that is the target of the 562 * reference. The reference library doesn't populate this, but you can 563 * use it to hold the resource if you resolve it. (The person, 564 * organization or device that created the flag.) 565 */ 566 public Resource getAuthorTarget() { 567 return this.authorTarget; 568 } 569 570 /** 571 * @param value {@link #author} The actual object that is the target of the 572 * reference. The reference library doesn't use these, but you can 573 * use it to hold the resource if you resolve it. (The person, 574 * organization or device that created the flag.) 575 */ 576 public Flag setAuthorTarget(Resource value) { 577 this.authorTarget = value; 578 return this; 579 } 580 581 /** 582 * @return {@link #code} (The coded value or textual component of the flag to 583 * display to the user.) 584 */ 585 public CodeableConcept getCode() { 586 if (this.code == null) 587 if (Configuration.errorOnAutoCreate()) 588 throw new Error("Attempt to auto-create Flag.code"); 589 else if (Configuration.doAutoCreate()) 590 this.code = new CodeableConcept(); // cc 591 return this.code; 592 } 593 594 public boolean hasCode() { 595 return this.code != null && !this.code.isEmpty(); 596 } 597 598 /** 599 * @param value {@link #code} (The coded value or textual component of the flag 600 * to display to the user.) 601 */ 602 public Flag setCode(CodeableConcept value) { 603 this.code = value; 604 return this; 605 } 606 607 protected void listChildren(List<Property> childrenList) { 608 super.listChildren(childrenList); 609 childrenList.add(new Property("identifier", "Identifier", 610 "Identifier assigned to the flag for external use (outside the FHIR environment).", 0, 611 java.lang.Integer.MAX_VALUE, identifier)); 612 childrenList.add(new Property("category", "CodeableConcept", 613 "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.", 614 0, java.lang.Integer.MAX_VALUE, category)); 615 childrenList 616 .add(new Property("status", "code", "Supports basic workflow.", 0, java.lang.Integer.MAX_VALUE, status)); 617 childrenList.add(new Property("period", "Period", 618 "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.", 619 0, java.lang.Integer.MAX_VALUE, period)); 620 childrenList.add(new Property("subject", "Reference(Patient|Location|Group|Organization|Practitioner)", 621 "The patient, location, group , organization , or practitioner this is about record this flag is associated with.", 622 0, java.lang.Integer.MAX_VALUE, subject)); 623 childrenList.add(new Property("encounter", "Reference(Encounter)", 624 "This alert is only relevant during the encounter.", 0, java.lang.Integer.MAX_VALUE, encounter)); 625 childrenList.add(new Property("author", "Reference(Device|Organization|Patient|Practitioner)", 626 "The person, organization or device that created the flag.", 0, java.lang.Integer.MAX_VALUE, author)); 627 childrenList.add(new Property("code", "CodeableConcept", 628 "The coded value or textual component of the flag to display to the user.", 0, java.lang.Integer.MAX_VALUE, 629 code)); 630 } 631 632 @Override 633 public void setProperty(String name, Base value) throws FHIRException { 634 if (name.equals("identifier")) 635 this.getIdentifier().add(castToIdentifier(value)); 636 else if (name.equals("category")) 637 this.category = castToCodeableConcept(value); // CodeableConcept 638 else if (name.equals("status")) 639 this.status = new FlagStatusEnumFactory().fromType(value); // Enumeration<FlagStatus> 640 else if (name.equals("period")) 641 this.period = castToPeriod(value); // Period 642 else if (name.equals("subject")) 643 this.subject = castToReference(value); // Reference 644 else if (name.equals("encounter")) 645 this.encounter = castToReference(value); // Reference 646 else if (name.equals("author")) 647 this.author = castToReference(value); // Reference 648 else if (name.equals("code")) 649 this.code = castToCodeableConcept(value); // CodeableConcept 650 else 651 super.setProperty(name, value); 652 } 653 654 @Override 655 public Base addChild(String name) throws FHIRException { 656 if (name.equals("identifier")) { 657 return addIdentifier(); 658 } else if (name.equals("category")) { 659 this.category = new CodeableConcept(); 660 return this.category; 661 } else if (name.equals("status")) { 662 throw new FHIRException("Cannot call addChild on a singleton property Flag.status"); 663 } else if (name.equals("period")) { 664 this.period = new Period(); 665 return this.period; 666 } else if (name.equals("subject")) { 667 this.subject = new Reference(); 668 return this.subject; 669 } else if (name.equals("encounter")) { 670 this.encounter = new Reference(); 671 return this.encounter; 672 } else if (name.equals("author")) { 673 this.author = new Reference(); 674 return this.author; 675 } else if (name.equals("code")) { 676 this.code = new CodeableConcept(); 677 return this.code; 678 } else 679 return super.addChild(name); 680 } 681 682 public String fhirType() { 683 return "Flag"; 684 685 } 686 687 public Flag copy() { 688 Flag dst = new Flag(); 689 copyValues(dst); 690 if (identifier != null) { 691 dst.identifier = new ArrayList<Identifier>(); 692 for (Identifier i : identifier) 693 dst.identifier.add(i.copy()); 694 } 695 ; 696 dst.category = category == null ? null : category.copy(); 697 dst.status = status == null ? null : status.copy(); 698 dst.period = period == null ? null : period.copy(); 699 dst.subject = subject == null ? null : subject.copy(); 700 dst.encounter = encounter == null ? null : encounter.copy(); 701 dst.author = author == null ? null : author.copy(); 702 dst.code = code == null ? null : code.copy(); 703 return dst; 704 } 705 706 protected Flag typedCopy() { 707 return copy(); 708 } 709 710 @Override 711 public boolean equalsDeep(Base other) { 712 if (!super.equalsDeep(other)) 713 return false; 714 if (!(other instanceof Flag)) 715 return false; 716 Flag o = (Flag) other; 717 return compareDeep(identifier, o.identifier, true) && compareDeep(category, o.category, true) 718 && compareDeep(status, o.status, true) && compareDeep(period, o.period, true) 719 && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true) 720 && compareDeep(author, o.author, true) && compareDeep(code, o.code, true); 721 } 722 723 @Override 724 public boolean equalsShallow(Base other) { 725 if (!super.equalsShallow(other)) 726 return false; 727 if (!(other instanceof Flag)) 728 return false; 729 Flag o = (Flag) other; 730 return compareValues(status, o.status, true); 731 } 732 733 public boolean isEmpty() { 734 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (category == null || category.isEmpty()) 735 && (status == null || status.isEmpty()) && (period == null || period.isEmpty()) 736 && (subject == null || subject.isEmpty()) && (encounter == null || encounter.isEmpty()) 737 && (author == null || author.isEmpty()) && (code == null || code.isEmpty()); 738 } 739 740 @Override 741 public ResourceType getResourceType() { 742 return ResourceType.Flag; 743 } 744 745 @SearchParamDefinition(name = "date", path = "Flag.period", description = "Time period when flag is active", type = "date") 746 public static final String SP_DATE = "date"; 747 @SearchParamDefinition(name = "subject", path = "Flag.subject", description = "The identity of a subject to list flags for", type = "reference") 748 public static final String SP_SUBJECT = "subject"; 749 @SearchParamDefinition(name = "patient", path = "Flag.subject", description = "The identity of a subject to list flags for", type = "reference") 750 public static final String SP_PATIENT = "patient"; 751 @SearchParamDefinition(name = "author", path = "Flag.author", description = "Flag creator", type = "reference") 752 public static final String SP_AUTHOR = "author"; 753 @SearchParamDefinition(name = "encounter", path = "Flag.encounter", description = "Alert relevant during encounter", type = "reference") 754 public static final String SP_ENCOUNTER = "encounter"; 755 756}