001package org.hl7.fhir.dstu2016may.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 Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0 033import java.util.ArrayList; 034import java.util.Date; 035import java.util.List; 036 037import org.hl7.fhir.exceptions.FHIRException; 038 039import ca.uhn.fhir.model.api.annotation.Child; 040import ca.uhn.fhir.model.api.annotation.Description; 041import ca.uhn.fhir.model.api.annotation.ResourceDef; 042import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 043/** 044 * A record of a device being used by a patient where the record is the result of a report from the patient or another clinician. 045 */ 046@ResourceDef(name="DeviceUseStatement", profile="http://hl7.org/fhir/Profile/DeviceUseStatement") 047public class DeviceUseStatement extends DomainResource { 048 049 /** 050 * Indicates the site on the subject's body where the device was used ( i.e. the target site). 051 */ 052 @Child(name = "bodySite", type = {CodeableConcept.class, BodySite.class}, order=0, min=0, max=1, modifier=false, summary=true) 053 @Description(shortDefinition="Target body site", formalDefinition="Indicates the site on the subject's body where the device was used ( i.e. the target site)." ) 054 protected Type bodySite; 055 056 /** 057 * The time period over which the device was used. 058 */ 059 @Child(name = "whenUsed", type = {Period.class}, order=1, min=0, max=1, modifier=false, summary=true) 060 @Description(shortDefinition="", formalDefinition="The time period over which the device was used." ) 061 protected Period whenUsed; 062 063 /** 064 * The details of the device used. 065 */ 066 @Child(name = "device", type = {Device.class}, order=2, min=1, max=1, modifier=false, summary=true) 067 @Description(shortDefinition="", formalDefinition="The details of the device used." ) 068 protected Reference device; 069 070 /** 071 * The actual object that is the target of the reference (The details of the device used.) 072 */ 073 protected Device deviceTarget; 074 075 /** 076 * An external identifier for this statement such as an IRI. 077 */ 078 @Child(name = "identifier", type = {Identifier.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 079 @Description(shortDefinition="", formalDefinition="An external identifier for this statement such as an IRI." ) 080 protected List<Identifier> identifier; 081 082 /** 083 * Reason or justification for the use of the device. 084 */ 085 @Child(name = "indication", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 086 @Description(shortDefinition="", formalDefinition="Reason or justification for the use of the device." ) 087 protected List<CodeableConcept> indication; 088 089 /** 090 * Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement. 091 */ 092 @Child(name = "notes", type = {StringType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 093 @Description(shortDefinition="", formalDefinition="Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement." ) 094 protected List<StringType> notes; 095 096 /** 097 * The time at which the statement was made/recorded. 098 */ 099 @Child(name = "recordedOn", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true) 100 @Description(shortDefinition="", formalDefinition="The time at which the statement was made/recorded." ) 101 protected DateTimeType recordedOn; 102 103 /** 104 * The patient who used the device. 105 */ 106 @Child(name = "subject", type = {Patient.class}, order=7, min=1, max=1, modifier=false, summary=true) 107 @Description(shortDefinition="", formalDefinition="The patient who used the device." ) 108 protected Reference subject; 109 110 /** 111 * The actual object that is the target of the reference (The patient who used the device.) 112 */ 113 protected Patient subjectTarget; 114 115 /** 116 * How often the device was used. 117 */ 118 @Child(name = "timing", type = {Timing.class, Period.class, DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=true) 119 @Description(shortDefinition="", formalDefinition="How often the device was used." ) 120 protected Type timing; 121 122 private static final long serialVersionUID = -1668571635L; 123 124 /** 125 * Constructor 126 */ 127 public DeviceUseStatement() { 128 super(); 129 } 130 131 /** 132 * Constructor 133 */ 134 public DeviceUseStatement(Reference device, Reference subject) { 135 super(); 136 this.device = device; 137 this.subject = subject; 138 } 139 140 /** 141 * @return {@link #bodySite} (Indicates the site on the subject's body where the device was used ( i.e. the target site).) 142 */ 143 public Type getBodySite() { 144 return this.bodySite; 145 } 146 147 /** 148 * @return {@link #bodySite} (Indicates the site on the subject's body where the device was used ( i.e. the target site).) 149 */ 150 public CodeableConcept getBodySiteCodeableConcept() throws FHIRException { 151 if (!(this.bodySite instanceof CodeableConcept)) 152 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.bodySite.getClass().getName()+" was encountered"); 153 return (CodeableConcept) this.bodySite; 154 } 155 156 public boolean hasBodySiteCodeableConcept() { 157 return this.bodySite instanceof CodeableConcept; 158 } 159 160 /** 161 * @return {@link #bodySite} (Indicates the site on the subject's body where the device was used ( i.e. the target site).) 162 */ 163 public Reference getBodySiteReference() throws FHIRException { 164 if (!(this.bodySite instanceof Reference)) 165 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.bodySite.getClass().getName()+" was encountered"); 166 return (Reference) this.bodySite; 167 } 168 169 public boolean hasBodySiteReference() { 170 return this.bodySite instanceof Reference; 171 } 172 173 public boolean hasBodySite() { 174 return this.bodySite != null && !this.bodySite.isEmpty(); 175 } 176 177 /** 178 * @param value {@link #bodySite} (Indicates the site on the subject's body where the device was used ( i.e. the target site).) 179 */ 180 public DeviceUseStatement setBodySite(Type value) { 181 this.bodySite = value; 182 return this; 183 } 184 185 /** 186 * @return {@link #whenUsed} (The time period over which the device was used.) 187 */ 188 public Period getWhenUsed() { 189 if (this.whenUsed == null) 190 if (Configuration.errorOnAutoCreate()) 191 throw new Error("Attempt to auto-create DeviceUseStatement.whenUsed"); 192 else if (Configuration.doAutoCreate()) 193 this.whenUsed = new Period(); // cc 194 return this.whenUsed; 195 } 196 197 public boolean hasWhenUsed() { 198 return this.whenUsed != null && !this.whenUsed.isEmpty(); 199 } 200 201 /** 202 * @param value {@link #whenUsed} (The time period over which the device was used.) 203 */ 204 public DeviceUseStatement setWhenUsed(Period value) { 205 this.whenUsed = value; 206 return this; 207 } 208 209 /** 210 * @return {@link #device} (The details of the device used.) 211 */ 212 public Reference getDevice() { 213 if (this.device == null) 214 if (Configuration.errorOnAutoCreate()) 215 throw new Error("Attempt to auto-create DeviceUseStatement.device"); 216 else if (Configuration.doAutoCreate()) 217 this.device = new Reference(); // cc 218 return this.device; 219 } 220 221 public boolean hasDevice() { 222 return this.device != null && !this.device.isEmpty(); 223 } 224 225 /** 226 * @param value {@link #device} (The details of the device used.) 227 */ 228 public DeviceUseStatement setDevice(Reference value) { 229 this.device = value; 230 return this; 231 } 232 233 /** 234 * @return {@link #device} 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 details of the device used.) 235 */ 236 public Device getDeviceTarget() { 237 if (this.deviceTarget == null) 238 if (Configuration.errorOnAutoCreate()) 239 throw new Error("Attempt to auto-create DeviceUseStatement.device"); 240 else if (Configuration.doAutoCreate()) 241 this.deviceTarget = new Device(); // aa 242 return this.deviceTarget; 243 } 244 245 /** 246 * @param value {@link #device} 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 details of the device used.) 247 */ 248 public DeviceUseStatement setDeviceTarget(Device value) { 249 this.deviceTarget = value; 250 return this; 251 } 252 253 /** 254 * @return {@link #identifier} (An external identifier for this statement such as an IRI.) 255 */ 256 public List<Identifier> getIdentifier() { 257 if (this.identifier == null) 258 this.identifier = new ArrayList<Identifier>(); 259 return this.identifier; 260 } 261 262 public boolean hasIdentifier() { 263 if (this.identifier == null) 264 return false; 265 for (Identifier item : this.identifier) 266 if (!item.isEmpty()) 267 return true; 268 return false; 269 } 270 271 /** 272 * @return {@link #identifier} (An external identifier for this statement such as an IRI.) 273 */ 274 // syntactic sugar 275 public Identifier addIdentifier() { //3 276 Identifier t = new Identifier(); 277 if (this.identifier == null) 278 this.identifier = new ArrayList<Identifier>(); 279 this.identifier.add(t); 280 return t; 281 } 282 283 // syntactic sugar 284 public DeviceUseStatement addIdentifier(Identifier t) { //3 285 if (t == null) 286 return this; 287 if (this.identifier == null) 288 this.identifier = new ArrayList<Identifier>(); 289 this.identifier.add(t); 290 return this; 291 } 292 293 /** 294 * @return {@link #indication} (Reason or justification for the use of the device.) 295 */ 296 public List<CodeableConcept> getIndication() { 297 if (this.indication == null) 298 this.indication = new ArrayList<CodeableConcept>(); 299 return this.indication; 300 } 301 302 public boolean hasIndication() { 303 if (this.indication == null) 304 return false; 305 for (CodeableConcept item : this.indication) 306 if (!item.isEmpty()) 307 return true; 308 return false; 309 } 310 311 /** 312 * @return {@link #indication} (Reason or justification for the use of the device.) 313 */ 314 // syntactic sugar 315 public CodeableConcept addIndication() { //3 316 CodeableConcept t = new CodeableConcept(); 317 if (this.indication == null) 318 this.indication = new ArrayList<CodeableConcept>(); 319 this.indication.add(t); 320 return t; 321 } 322 323 // syntactic sugar 324 public DeviceUseStatement addIndication(CodeableConcept t) { //3 325 if (t == null) 326 return this; 327 if (this.indication == null) 328 this.indication = new ArrayList<CodeableConcept>(); 329 this.indication.add(t); 330 return this; 331 } 332 333 /** 334 * @return {@link #notes} (Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.) 335 */ 336 public List<StringType> getNotes() { 337 if (this.notes == null) 338 this.notes = new ArrayList<StringType>(); 339 return this.notes; 340 } 341 342 public boolean hasNotes() { 343 if (this.notes == null) 344 return false; 345 for (StringType item : this.notes) 346 if (!item.isEmpty()) 347 return true; 348 return false; 349 } 350 351 /** 352 * @return {@link #notes} (Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.) 353 */ 354 // syntactic sugar 355 public StringType addNotesElement() {//2 356 StringType t = new StringType(); 357 if (this.notes == null) 358 this.notes = new ArrayList<StringType>(); 359 this.notes.add(t); 360 return t; 361 } 362 363 /** 364 * @param value {@link #notes} (Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.) 365 */ 366 public DeviceUseStatement addNotes(String value) { //1 367 StringType t = new StringType(); 368 t.setValue(value); 369 if (this.notes == null) 370 this.notes = new ArrayList<StringType>(); 371 this.notes.add(t); 372 return this; 373 } 374 375 /** 376 * @param value {@link #notes} (Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.) 377 */ 378 public boolean hasNotes(String value) { 379 if (this.notes == null) 380 return false; 381 for (StringType v : this.notes) 382 if (v.equals(value)) // string 383 return true; 384 return false; 385 } 386 387 /** 388 * @return {@link #recordedOn} (The time at which the statement was made/recorded.). This is the underlying object with id, value and extensions. The accessor "getRecordedOn" gives direct access to the value 389 */ 390 public DateTimeType getRecordedOnElement() { 391 if (this.recordedOn == null) 392 if (Configuration.errorOnAutoCreate()) 393 throw new Error("Attempt to auto-create DeviceUseStatement.recordedOn"); 394 else if (Configuration.doAutoCreate()) 395 this.recordedOn = new DateTimeType(); // bb 396 return this.recordedOn; 397 } 398 399 public boolean hasRecordedOnElement() { 400 return this.recordedOn != null && !this.recordedOn.isEmpty(); 401 } 402 403 public boolean hasRecordedOn() { 404 return this.recordedOn != null && !this.recordedOn.isEmpty(); 405 } 406 407 /** 408 * @param value {@link #recordedOn} (The time at which the statement was made/recorded.). This is the underlying object with id, value and extensions. The accessor "getRecordedOn" gives direct access to the value 409 */ 410 public DeviceUseStatement setRecordedOnElement(DateTimeType value) { 411 this.recordedOn = value; 412 return this; 413 } 414 415 /** 416 * @return The time at which the statement was made/recorded. 417 */ 418 public Date getRecordedOn() { 419 return this.recordedOn == null ? null : this.recordedOn.getValue(); 420 } 421 422 /** 423 * @param value The time at which the statement was made/recorded. 424 */ 425 public DeviceUseStatement setRecordedOn(Date value) { 426 if (value == null) 427 this.recordedOn = null; 428 else { 429 if (this.recordedOn == null) 430 this.recordedOn = new DateTimeType(); 431 this.recordedOn.setValue(value); 432 } 433 return this; 434 } 435 436 /** 437 * @return {@link #subject} (The patient who used the device.) 438 */ 439 public Reference getSubject() { 440 if (this.subject == null) 441 if (Configuration.errorOnAutoCreate()) 442 throw new Error("Attempt to auto-create DeviceUseStatement.subject"); 443 else if (Configuration.doAutoCreate()) 444 this.subject = new Reference(); // cc 445 return this.subject; 446 } 447 448 public boolean hasSubject() { 449 return this.subject != null && !this.subject.isEmpty(); 450 } 451 452 /** 453 * @param value {@link #subject} (The patient who used the device.) 454 */ 455 public DeviceUseStatement setSubject(Reference value) { 456 this.subject = value; 457 return this; 458 } 459 460 /** 461 * @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 who used the device.) 462 */ 463 public Patient getSubjectTarget() { 464 if (this.subjectTarget == null) 465 if (Configuration.errorOnAutoCreate()) 466 throw new Error("Attempt to auto-create DeviceUseStatement.subject"); 467 else if (Configuration.doAutoCreate()) 468 this.subjectTarget = new Patient(); // aa 469 return this.subjectTarget; 470 } 471 472 /** 473 * @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 who used the device.) 474 */ 475 public DeviceUseStatement setSubjectTarget(Patient value) { 476 this.subjectTarget = value; 477 return this; 478 } 479 480 /** 481 * @return {@link #timing} (How often the device was used.) 482 */ 483 public Type getTiming() { 484 return this.timing; 485 } 486 487 /** 488 * @return {@link #timing} (How often the device was used.) 489 */ 490 public Timing getTimingTiming() throws FHIRException { 491 if (!(this.timing instanceof Timing)) 492 throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.timing.getClass().getName()+" was encountered"); 493 return (Timing) this.timing; 494 } 495 496 public boolean hasTimingTiming() { 497 return this.timing instanceof Timing; 498 } 499 500 /** 501 * @return {@link #timing} (How often the device was used.) 502 */ 503 public Period getTimingPeriod() throws FHIRException { 504 if (!(this.timing instanceof Period)) 505 throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered"); 506 return (Period) this.timing; 507 } 508 509 public boolean hasTimingPeriod() { 510 return this.timing instanceof Period; 511 } 512 513 /** 514 * @return {@link #timing} (How often the device was used.) 515 */ 516 public DateTimeType getTimingDateTimeType() throws FHIRException { 517 if (!(this.timing instanceof DateTimeType)) 518 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.timing.getClass().getName()+" was encountered"); 519 return (DateTimeType) this.timing; 520 } 521 522 public boolean hasTimingDateTimeType() { 523 return this.timing instanceof DateTimeType; 524 } 525 526 public boolean hasTiming() { 527 return this.timing != null && !this.timing.isEmpty(); 528 } 529 530 /** 531 * @param value {@link #timing} (How often the device was used.) 532 */ 533 public DeviceUseStatement setTiming(Type value) { 534 this.timing = value; 535 return this; 536 } 537 538 protected void listChildren(List<Property> childrenList) { 539 super.listChildren(childrenList); 540 childrenList.add(new Property("bodySite[x]", "CodeableConcept|Reference(BodySite)", "Indicates the site on the subject's body where the device was used ( i.e. the target site).", 0, java.lang.Integer.MAX_VALUE, bodySite)); 541 childrenList.add(new Property("whenUsed", "Period", "The time period over which the device was used.", 0, java.lang.Integer.MAX_VALUE, whenUsed)); 542 childrenList.add(new Property("device", "Reference(Device)", "The details of the device used.", 0, java.lang.Integer.MAX_VALUE, device)); 543 childrenList.add(new Property("identifier", "Identifier", "An external identifier for this statement such as an IRI.", 0, java.lang.Integer.MAX_VALUE, identifier)); 544 childrenList.add(new Property("indication", "CodeableConcept", "Reason or justification for the use of the device.", 0, java.lang.Integer.MAX_VALUE, indication)); 545 childrenList.add(new Property("notes", "string", "Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.", 0, java.lang.Integer.MAX_VALUE, notes)); 546 childrenList.add(new Property("recordedOn", "dateTime", "The time at which the statement was made/recorded.", 0, java.lang.Integer.MAX_VALUE, recordedOn)); 547 childrenList.add(new Property("subject", "Reference(Patient)", "The patient who used the device.", 0, java.lang.Integer.MAX_VALUE, subject)); 548 childrenList.add(new Property("timing[x]", "Timing|Period|dateTime", "How often the device was used.", 0, java.lang.Integer.MAX_VALUE, timing)); 549 } 550 551 @Override 552 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 553 switch (hash) { 554 case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // Type 555 case 2042879511: /*whenUsed*/ return this.whenUsed == null ? new Base[0] : new Base[] {this.whenUsed}; // Period 556 case -1335157162: /*device*/ return this.device == null ? new Base[0] : new Base[] {this.device}; // Reference 557 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 558 case -597168804: /*indication*/ return this.indication == null ? new Base[0] : this.indication.toArray(new Base[this.indication.size()]); // CodeableConcept 559 case 105008833: /*notes*/ return this.notes == null ? new Base[0] : this.notes.toArray(new Base[this.notes.size()]); // StringType 560 case 735397551: /*recordedOn*/ return this.recordedOn == null ? new Base[0] : new Base[] {this.recordedOn}; // DateTimeType 561 case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference 562 case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // Type 563 default: return super.getProperty(hash, name, checkValid); 564 } 565 566 } 567 568 @Override 569 public void setProperty(int hash, String name, Base value) throws FHIRException { 570 switch (hash) { 571 case 1702620169: // bodySite 572 this.bodySite = (Type) value; // Type 573 break; 574 case 2042879511: // whenUsed 575 this.whenUsed = castToPeriod(value); // Period 576 break; 577 case -1335157162: // device 578 this.device = castToReference(value); // Reference 579 break; 580 case -1618432855: // identifier 581 this.getIdentifier().add(castToIdentifier(value)); // Identifier 582 break; 583 case -597168804: // indication 584 this.getIndication().add(castToCodeableConcept(value)); // CodeableConcept 585 break; 586 case 105008833: // notes 587 this.getNotes().add(castToString(value)); // StringType 588 break; 589 case 735397551: // recordedOn 590 this.recordedOn = castToDateTime(value); // DateTimeType 591 break; 592 case -1867885268: // subject 593 this.subject = castToReference(value); // Reference 594 break; 595 case -873664438: // timing 596 this.timing = (Type) value; // Type 597 break; 598 default: super.setProperty(hash, name, value); 599 } 600 601 } 602 603 @Override 604 public void setProperty(String name, Base value) throws FHIRException { 605 if (name.equals("bodySite[x]")) 606 this.bodySite = (Type) value; // Type 607 else if (name.equals("whenUsed")) 608 this.whenUsed = castToPeriod(value); // Period 609 else if (name.equals("device")) 610 this.device = castToReference(value); // Reference 611 else if (name.equals("identifier")) 612 this.getIdentifier().add(castToIdentifier(value)); 613 else if (name.equals("indication")) 614 this.getIndication().add(castToCodeableConcept(value)); 615 else if (name.equals("notes")) 616 this.getNotes().add(castToString(value)); 617 else if (name.equals("recordedOn")) 618 this.recordedOn = castToDateTime(value); // DateTimeType 619 else if (name.equals("subject")) 620 this.subject = castToReference(value); // Reference 621 else if (name.equals("timing[x]")) 622 this.timing = (Type) value; // Type 623 else 624 super.setProperty(name, value); 625 } 626 627 @Override 628 public Base makeProperty(int hash, String name) throws FHIRException { 629 switch (hash) { 630 case -806219817: return getBodySite(); // Type 631 case 2042879511: return getWhenUsed(); // Period 632 case -1335157162: return getDevice(); // Reference 633 case -1618432855: return addIdentifier(); // Identifier 634 case -597168804: return addIndication(); // CodeableConcept 635 case 105008833: throw new FHIRException("Cannot make property notes as it is not a complex type"); // StringType 636 case 735397551: throw new FHIRException("Cannot make property recordedOn as it is not a complex type"); // DateTimeType 637 case -1867885268: return getSubject(); // Reference 638 case 164632566: return getTiming(); // Type 639 default: return super.makeProperty(hash, name); 640 } 641 642 } 643 644 @Override 645 public Base addChild(String name) throws FHIRException { 646 if (name.equals("bodySiteCodeableConcept")) { 647 this.bodySite = new CodeableConcept(); 648 return this.bodySite; 649 } 650 else if (name.equals("bodySiteReference")) { 651 this.bodySite = new Reference(); 652 return this.bodySite; 653 } 654 else if (name.equals("whenUsed")) { 655 this.whenUsed = new Period(); 656 return this.whenUsed; 657 } 658 else if (name.equals("device")) { 659 this.device = new Reference(); 660 return this.device; 661 } 662 else if (name.equals("identifier")) { 663 return addIdentifier(); 664 } 665 else if (name.equals("indication")) { 666 return addIndication(); 667 } 668 else if (name.equals("notes")) { 669 throw new FHIRException("Cannot call addChild on a primitive type DeviceUseStatement.notes"); 670 } 671 else if (name.equals("recordedOn")) { 672 throw new FHIRException("Cannot call addChild on a primitive type DeviceUseStatement.recordedOn"); 673 } 674 else if (name.equals("subject")) { 675 this.subject = new Reference(); 676 return this.subject; 677 } 678 else if (name.equals("timingTiming")) { 679 this.timing = new Timing(); 680 return this.timing; 681 } 682 else if (name.equals("timingPeriod")) { 683 this.timing = new Period(); 684 return this.timing; 685 } 686 else if (name.equals("timingDateTime")) { 687 this.timing = new DateTimeType(); 688 return this.timing; 689 } 690 else 691 return super.addChild(name); 692 } 693 694 public String fhirType() { 695 return "DeviceUseStatement"; 696 697 } 698 699 public DeviceUseStatement copy() { 700 DeviceUseStatement dst = new DeviceUseStatement(); 701 copyValues(dst); 702 dst.bodySite = bodySite == null ? null : bodySite.copy(); 703 dst.whenUsed = whenUsed == null ? null : whenUsed.copy(); 704 dst.device = device == null ? null : device.copy(); 705 if (identifier != null) { 706 dst.identifier = new ArrayList<Identifier>(); 707 for (Identifier i : identifier) 708 dst.identifier.add(i.copy()); 709 }; 710 if (indication != null) { 711 dst.indication = new ArrayList<CodeableConcept>(); 712 for (CodeableConcept i : indication) 713 dst.indication.add(i.copy()); 714 }; 715 if (notes != null) { 716 dst.notes = new ArrayList<StringType>(); 717 for (StringType i : notes) 718 dst.notes.add(i.copy()); 719 }; 720 dst.recordedOn = recordedOn == null ? null : recordedOn.copy(); 721 dst.subject = subject == null ? null : subject.copy(); 722 dst.timing = timing == null ? null : timing.copy(); 723 return dst; 724 } 725 726 protected DeviceUseStatement typedCopy() { 727 return copy(); 728 } 729 730 @Override 731 public boolean equalsDeep(Base other) { 732 if (!super.equalsDeep(other)) 733 return false; 734 if (!(other instanceof DeviceUseStatement)) 735 return false; 736 DeviceUseStatement o = (DeviceUseStatement) other; 737 return compareDeep(bodySite, o.bodySite, true) && compareDeep(whenUsed, o.whenUsed, true) && compareDeep(device, o.device, true) 738 && compareDeep(identifier, o.identifier, true) && compareDeep(indication, o.indication, true) && compareDeep(notes, o.notes, true) 739 && compareDeep(recordedOn, o.recordedOn, true) && compareDeep(subject, o.subject, true) && compareDeep(timing, o.timing, true) 740 ; 741 } 742 743 @Override 744 public boolean equalsShallow(Base other) { 745 if (!super.equalsShallow(other)) 746 return false; 747 if (!(other instanceof DeviceUseStatement)) 748 return false; 749 DeviceUseStatement o = (DeviceUseStatement) other; 750 return compareValues(notes, o.notes, true) && compareValues(recordedOn, o.recordedOn, true); 751 } 752 753 public boolean isEmpty() { 754 return super.isEmpty() && (bodySite == null || bodySite.isEmpty()) && (whenUsed == null || whenUsed.isEmpty()) 755 && (device == null || device.isEmpty()) && (identifier == null || identifier.isEmpty()) && (indication == null || indication.isEmpty()) 756 && (notes == null || notes.isEmpty()) && (recordedOn == null || recordedOn.isEmpty()) && (subject == null || subject.isEmpty()) 757 && (timing == null || timing.isEmpty()); 758 } 759 760 @Override 761 public ResourceType getResourceType() { 762 return ResourceType.DeviceUseStatement; 763 } 764 765 /** 766 * Search parameter: <b>patient</b> 767 * <p> 768 * Description: <b>Search by subject - a patient</b><br> 769 * Type: <b>reference</b><br> 770 * Path: <b>DeviceUseStatement.subject</b><br> 771 * </p> 772 */ 773 @SearchParamDefinition(name="patient", path="DeviceUseStatement.subject", description="Search by subject - a patient", type="reference" ) 774 public static final String SP_PATIENT = "patient"; 775 /** 776 * <b>Fluent Client</b> search parameter constant for <b>patient</b> 777 * <p> 778 * Description: <b>Search by subject - a patient</b><br> 779 * Type: <b>reference</b><br> 780 * Path: <b>DeviceUseStatement.subject</b><br> 781 * </p> 782 */ 783 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT); 784 785/** 786 * Constant for fluent queries to be used to add include statements. Specifies 787 * the path value of "<b>DeviceUseStatement:patient</b>". 788 */ 789 public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("DeviceUseStatement:patient").toLocked(); 790 791 /** 792 * Search parameter: <b>subject</b> 793 * <p> 794 * Description: <b>Search by subject</b><br> 795 * Type: <b>reference</b><br> 796 * Path: <b>DeviceUseStatement.subject</b><br> 797 * </p> 798 */ 799 @SearchParamDefinition(name="subject", path="DeviceUseStatement.subject", description="Search by subject", type="reference" ) 800 public static final String SP_SUBJECT = "subject"; 801 /** 802 * <b>Fluent Client</b> search parameter constant for <b>subject</b> 803 * <p> 804 * Description: <b>Search by subject</b><br> 805 * Type: <b>reference</b><br> 806 * Path: <b>DeviceUseStatement.subject</b><br> 807 * </p> 808 */ 809 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT); 810 811/** 812 * Constant for fluent queries to be used to add include statements. Specifies 813 * the path value of "<b>DeviceUseStatement:subject</b>". 814 */ 815 public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("DeviceUseStatement:subject").toLocked(); 816 817 /** 818 * Search parameter: <b>device</b> 819 * <p> 820 * Description: <b>Search by device</b><br> 821 * Type: <b>reference</b><br> 822 * Path: <b>DeviceUseStatement.device</b><br> 823 * </p> 824 */ 825 @SearchParamDefinition(name="device", path="DeviceUseStatement.device", description="Search by device", type="reference" ) 826 public static final String SP_DEVICE = "device"; 827 /** 828 * <b>Fluent Client</b> search parameter constant for <b>device</b> 829 * <p> 830 * Description: <b>Search by device</b><br> 831 * Type: <b>reference</b><br> 832 * Path: <b>DeviceUseStatement.device</b><br> 833 * </p> 834 */ 835 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DEVICE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DEVICE); 836 837/** 838 * Constant for fluent queries to be used to add include statements. Specifies 839 * the path value of "<b>DeviceUseStatement:device</b>". 840 */ 841 public static final ca.uhn.fhir.model.api.Include INCLUDE_DEVICE = new ca.uhn.fhir.model.api.Include("DeviceUseStatement:device").toLocked(); 842 843 844} 845