001package org.hl7.fhir.dstu2.model; 002 003/*- 004 * #%L 005 * org.hl7.fhir.dstu2 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/* 025 Copyright (c) 2011+, HL7, Inc. 026 All rights reserved. 027 028 Redistribution and use in source and binary forms, with or without modification, 029 are permitted provided that the following conditions are met: 030 031 * Redistributions of source code must retain the above copyright notice, this 032 list of conditions and the following disclaimer. 033 * Redistributions in binary form must reproduce the above copyright notice, 034 this list of conditions and the following disclaimer in the documentation 035 and/or other materials provided with the distribution. 036 * Neither the name of HL7 nor the names of its contributors may be used to 037 endorse or promote products derived from this software without specific 038 prior written permission. 039 040 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 041 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 042 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 043 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 044 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 045 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 046 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 047 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 048 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 049 POSSIBILITY OF SUCH DAMAGE. 050 051*/ 052 053// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 054import java.util.ArrayList; 055import java.util.Date; 056import java.util.List; 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; 062import org.hl7.fhir.exceptions.FHIRException; 063/** 064 * 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. 065 */ 066@ResourceDef(name="DeviceUseStatement", profile="http://hl7.org/fhir/Profile/DeviceUseStatement") 067public class DeviceUseStatement extends DomainResource { 068 069 /** 070 * Indicates the site on the subject's body where the device was used ( i.e. the target site). 071 */ 072 @Child(name = "bodySite", type = {CodeableConcept.class, BodySite.class}, order=0, min=0, max=1, modifier=false, summary=true) 073 @Description(shortDefinition="Target body site", formalDefinition="Indicates the site on the subject's body where the device was used ( i.e. the target site)." ) 074 protected Type bodySite; 075 076 /** 077 * The time period over which the device was used. 078 */ 079 @Child(name = "whenUsed", type = {Period.class}, order=1, min=0, max=1, modifier=false, summary=true) 080 @Description(shortDefinition="", formalDefinition="The time period over which the device was used." ) 081 protected Period whenUsed; 082 083 /** 084 * The details of the device used. 085 */ 086 @Child(name = "device", type = {Device.class}, order=2, min=1, max=1, modifier=false, summary=true) 087 @Description(shortDefinition="", formalDefinition="The details of the device used." ) 088 protected Reference device; 089 090 /** 091 * The actual object that is the target of the reference (The details of the device used.) 092 */ 093 protected Device deviceTarget; 094 095 /** 096 * An external identifier for this statement such as an IRI. 097 */ 098 @Child(name = "identifier", type = {Identifier.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 099 @Description(shortDefinition="", formalDefinition="An external identifier for this statement such as an IRI." ) 100 protected List<Identifier> identifier; 101 102 /** 103 * Reason or justification for the use of the device. 104 */ 105 @Child(name = "indication", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 106 @Description(shortDefinition="", formalDefinition="Reason or justification for the use of the device." ) 107 protected List<CodeableConcept> indication; 108 109 /** 110 * 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. 111 */ 112 @Child(name = "notes", type = {StringType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 113 @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." ) 114 protected List<StringType> notes; 115 116 /** 117 * The time at which the statement was made/recorded. 118 */ 119 @Child(name = "recordedOn", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true) 120 @Description(shortDefinition="", formalDefinition="The time at which the statement was made/recorded." ) 121 protected DateTimeType recordedOn; 122 123 /** 124 * The patient who used the device. 125 */ 126 @Child(name = "subject", type = {Patient.class}, order=7, min=1, max=1, modifier=false, summary=true) 127 @Description(shortDefinition="", formalDefinition="The patient who used the device." ) 128 protected Reference subject; 129 130 /** 131 * The actual object that is the target of the reference (The patient who used the device.) 132 */ 133 protected Patient subjectTarget; 134 135 /** 136 * How often the device was used. 137 */ 138 @Child(name = "timing", type = {Timing.class, Period.class, DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=true) 139 @Description(shortDefinition="", formalDefinition="How often the device was used." ) 140 protected Type timing; 141 142 private static final long serialVersionUID = -1668571635L; 143 144 /* 145 * Constructor 146 */ 147 public DeviceUseStatement() { 148 super(); 149 } 150 151 /* 152 * Constructor 153 */ 154 public DeviceUseStatement(Reference device, Reference subject) { 155 super(); 156 this.device = device; 157 this.subject = subject; 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 Type getBodySite() { 164 return this.bodySite; 165 } 166 167 /** 168 * @return {@link #bodySite} (Indicates the site on the subject's body where the device was used ( i.e. the target site).) 169 */ 170 public CodeableConcept getBodySiteCodeableConcept() throws FHIRException { 171 if (!(this.bodySite instanceof CodeableConcept)) 172 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.bodySite.getClass().getName()+" was encountered"); 173 return (CodeableConcept) this.bodySite; 174 } 175 176 public boolean hasBodySiteCodeableConcept() { 177 return this.bodySite instanceof CodeableConcept; 178 } 179 180 /** 181 * @return {@link #bodySite} (Indicates the site on the subject's body where the device was used ( i.e. the target site).) 182 */ 183 public Reference getBodySiteReference() throws FHIRException { 184 if (!(this.bodySite instanceof Reference)) 185 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.bodySite.getClass().getName()+" was encountered"); 186 return (Reference) this.bodySite; 187 } 188 189 public boolean hasBodySiteReference() { 190 return this.bodySite instanceof Reference; 191 } 192 193 public boolean hasBodySite() { 194 return this.bodySite != null && !this.bodySite.isEmpty(); 195 } 196 197 /** 198 * @param value {@link #bodySite} (Indicates the site on the subject's body where the device was used ( i.e. the target site).) 199 */ 200 public DeviceUseStatement setBodySite(Type value) { 201 this.bodySite = value; 202 return this; 203 } 204 205 /** 206 * @return {@link #whenUsed} (The time period over which the device was used.) 207 */ 208 public Period getWhenUsed() { 209 if (this.whenUsed == null) 210 if (Configuration.errorOnAutoCreate()) 211 throw new Error("Attempt to auto-create DeviceUseStatement.whenUsed"); 212 else if (Configuration.doAutoCreate()) 213 this.whenUsed = new Period(); // cc 214 return this.whenUsed; 215 } 216 217 public boolean hasWhenUsed() { 218 return this.whenUsed != null && !this.whenUsed.isEmpty(); 219 } 220 221 /** 222 * @param value {@link #whenUsed} (The time period over which the device was used.) 223 */ 224 public DeviceUseStatement setWhenUsed(Period value) { 225 this.whenUsed = value; 226 return this; 227 } 228 229 /** 230 * @return {@link #device} (The details of the device used.) 231 */ 232 public Reference getDevice() { 233 if (this.device == null) 234 if (Configuration.errorOnAutoCreate()) 235 throw new Error("Attempt to auto-create DeviceUseStatement.device"); 236 else if (Configuration.doAutoCreate()) 237 this.device = new Reference(); // cc 238 return this.device; 239 } 240 241 public boolean hasDevice() { 242 return this.device != null && !this.device.isEmpty(); 243 } 244 245 /** 246 * @param value {@link #device} (The details of the device used.) 247 */ 248 public DeviceUseStatement setDevice(Reference value) { 249 this.device = value; 250 return this; 251 } 252 253 /** 254 * @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.) 255 */ 256 public Device getDeviceTarget() { 257 if (this.deviceTarget == null) 258 if (Configuration.errorOnAutoCreate()) 259 throw new Error("Attempt to auto-create DeviceUseStatement.device"); 260 else if (Configuration.doAutoCreate()) 261 this.deviceTarget = new Device(); // aa 262 return this.deviceTarget; 263 } 264 265 /** 266 * @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.) 267 */ 268 public DeviceUseStatement setDeviceTarget(Device value) { 269 this.deviceTarget = value; 270 return this; 271 } 272 273 /** 274 * @return {@link #identifier} (An external identifier for this statement such as an IRI.) 275 */ 276 public List<Identifier> getIdentifier() { 277 if (this.identifier == null) 278 this.identifier = new ArrayList<Identifier>(); 279 return this.identifier; 280 } 281 282 public boolean hasIdentifier() { 283 if (this.identifier == null) 284 return false; 285 for (Identifier item : this.identifier) 286 if (!item.isEmpty()) 287 return true; 288 return false; 289 } 290 291 /** 292 * @return {@link #identifier} (An external identifier for this statement such as an IRI.) 293 */ 294 // syntactic sugar 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 // syntactic sugar 304 public DeviceUseStatement addIdentifier(Identifier t) { //3 305 if (t == null) 306 return this; 307 if (this.identifier == null) 308 this.identifier = new ArrayList<Identifier>(); 309 this.identifier.add(t); 310 return this; 311 } 312 313 /** 314 * @return {@link #indication} (Reason or justification for the use of the device.) 315 */ 316 public List<CodeableConcept> getIndication() { 317 if (this.indication == null) 318 this.indication = new ArrayList<CodeableConcept>(); 319 return this.indication; 320 } 321 322 public boolean hasIndication() { 323 if (this.indication == null) 324 return false; 325 for (CodeableConcept item : this.indication) 326 if (!item.isEmpty()) 327 return true; 328 return false; 329 } 330 331 /** 332 * @return {@link #indication} (Reason or justification for the use of the device.) 333 */ 334 // syntactic sugar 335 public CodeableConcept addIndication() { //3 336 CodeableConcept t = new CodeableConcept(); 337 if (this.indication == null) 338 this.indication = new ArrayList<CodeableConcept>(); 339 this.indication.add(t); 340 return t; 341 } 342 343 // syntactic sugar 344 public DeviceUseStatement addIndication(CodeableConcept t) { //3 345 if (t == null) 346 return this; 347 if (this.indication == null) 348 this.indication = new ArrayList<CodeableConcept>(); 349 this.indication.add(t); 350 return this; 351 } 352 353 /** 354 * @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.) 355 */ 356 public List<StringType> getNotes() { 357 if (this.notes == null) 358 this.notes = new ArrayList<StringType>(); 359 return this.notes; 360 } 361 362 public boolean hasNotes() { 363 if (this.notes == null) 364 return false; 365 for (StringType item : this.notes) 366 if (!item.isEmpty()) 367 return true; 368 return false; 369 } 370 371 /** 372 * @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.) 373 */ 374 // syntactic sugar 375 public StringType addNotesElement() {//2 376 StringType t = new StringType(); 377 if (this.notes == null) 378 this.notes = new ArrayList<StringType>(); 379 this.notes.add(t); 380 return t; 381 } 382 383 /** 384 * @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.) 385 */ 386 public DeviceUseStatement addNotes(String value) { //1 387 StringType t = new StringType(); 388 t.setValue(value); 389 if (this.notes == null) 390 this.notes = new ArrayList<StringType>(); 391 this.notes.add(t); 392 return this; 393 } 394 395 /** 396 * @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.) 397 */ 398 public boolean hasNotes(String value) { 399 if (this.notes == null) 400 return false; 401 for (StringType v : this.notes) 402 if (v.equals(value)) // string 403 return true; 404 return false; 405 } 406 407 /** 408 * @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 409 */ 410 public DateTimeType getRecordedOnElement() { 411 if (this.recordedOn == null) 412 if (Configuration.errorOnAutoCreate()) 413 throw new Error("Attempt to auto-create DeviceUseStatement.recordedOn"); 414 else if (Configuration.doAutoCreate()) 415 this.recordedOn = new DateTimeType(); // bb 416 return this.recordedOn; 417 } 418 419 public boolean hasRecordedOnElement() { 420 return this.recordedOn != null && !this.recordedOn.isEmpty(); 421 } 422 423 public boolean hasRecordedOn() { 424 return this.recordedOn != null && !this.recordedOn.isEmpty(); 425 } 426 427 /** 428 * @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 429 */ 430 public DeviceUseStatement setRecordedOnElement(DateTimeType value) { 431 this.recordedOn = value; 432 return this; 433 } 434 435 /** 436 * @return The time at which the statement was made/recorded. 437 */ 438 public Date getRecordedOn() { 439 return this.recordedOn == null ? null : this.recordedOn.getValue(); 440 } 441 442 /** 443 * @param value The time at which the statement was made/recorded. 444 */ 445 public DeviceUseStatement setRecordedOn(Date value) { 446 if (value == null) 447 this.recordedOn = null; 448 else { 449 if (this.recordedOn == null) 450 this.recordedOn = new DateTimeType(); 451 this.recordedOn.setValue(value); 452 } 453 return this; 454 } 455 456 /** 457 * @return {@link #subject} (The patient who used the device.) 458 */ 459 public Reference getSubject() { 460 if (this.subject == null) 461 if (Configuration.errorOnAutoCreate()) 462 throw new Error("Attempt to auto-create DeviceUseStatement.subject"); 463 else if (Configuration.doAutoCreate()) 464 this.subject = new Reference(); // cc 465 return this.subject; 466 } 467 468 public boolean hasSubject() { 469 return this.subject != null && !this.subject.isEmpty(); 470 } 471 472 /** 473 * @param value {@link #subject} (The patient who used the device.) 474 */ 475 public DeviceUseStatement setSubject(Reference value) { 476 this.subject = value; 477 return this; 478 } 479 480 /** 481 * @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.) 482 */ 483 public Patient getSubjectTarget() { 484 if (this.subjectTarget == null) 485 if (Configuration.errorOnAutoCreate()) 486 throw new Error("Attempt to auto-create DeviceUseStatement.subject"); 487 else if (Configuration.doAutoCreate()) 488 this.subjectTarget = new Patient(); // aa 489 return this.subjectTarget; 490 } 491 492 /** 493 * @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.) 494 */ 495 public DeviceUseStatement setSubjectTarget(Patient value) { 496 this.subjectTarget = value; 497 return this; 498 } 499 500 /** 501 * @return {@link #timing} (How often the device was used.) 502 */ 503 public Type getTiming() { 504 return this.timing; 505 } 506 507 /** 508 * @return {@link #timing} (How often the device was used.) 509 */ 510 public Timing getTimingTiming() throws FHIRException { 511 if (!(this.timing instanceof Timing)) 512 throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.timing.getClass().getName()+" was encountered"); 513 return (Timing) this.timing; 514 } 515 516 public boolean hasTimingTiming() { 517 return this.timing instanceof Timing; 518 } 519 520 /** 521 * @return {@link #timing} (How often the device was used.) 522 */ 523 public Period getTimingPeriod() throws FHIRException { 524 if (!(this.timing instanceof Period)) 525 throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered"); 526 return (Period) this.timing; 527 } 528 529 public boolean hasTimingPeriod() { 530 return this.timing instanceof Period; 531 } 532 533 /** 534 * @return {@link #timing} (How often the device was used.) 535 */ 536 public DateTimeType getTimingDateTimeType() throws FHIRException { 537 if (!(this.timing instanceof DateTimeType)) 538 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.timing.getClass().getName()+" was encountered"); 539 return (DateTimeType) this.timing; 540 } 541 542 public boolean hasTimingDateTimeType() { 543 return this.timing instanceof DateTimeType; 544 } 545 546 public boolean hasTiming() { 547 return this.timing != null && !this.timing.isEmpty(); 548 } 549 550 /** 551 * @param value {@link #timing} (How often the device was used.) 552 */ 553 public DeviceUseStatement setTiming(Type value) { 554 this.timing = value; 555 return this; 556 } 557 558 protected void listChildren(List<Property> childrenList) { 559 super.listChildren(childrenList); 560 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)); 561 childrenList.add(new Property("whenUsed", "Period", "The time period over which the device was used.", 0, java.lang.Integer.MAX_VALUE, whenUsed)); 562 childrenList.add(new Property("device", "Reference(Device)", "The details of the device used.", 0, java.lang.Integer.MAX_VALUE, device)); 563 childrenList.add(new Property("identifier", "Identifier", "An external identifier for this statement such as an IRI.", 0, java.lang.Integer.MAX_VALUE, identifier)); 564 childrenList.add(new Property("indication", "CodeableConcept", "Reason or justification for the use of the device.", 0, java.lang.Integer.MAX_VALUE, indication)); 565 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)); 566 childrenList.add(new Property("recordedOn", "dateTime", "The time at which the statement was made/recorded.", 0, java.lang.Integer.MAX_VALUE, recordedOn)); 567 childrenList.add(new Property("subject", "Reference(Patient)", "The patient who used the device.", 0, java.lang.Integer.MAX_VALUE, subject)); 568 childrenList.add(new Property("timing[x]", "Timing|Period|dateTime", "How often the device was used.", 0, java.lang.Integer.MAX_VALUE, timing)); 569 } 570 571 @Override 572 public void setProperty(String name, Base value) throws FHIRException { 573 if (name.equals("bodySite[x]")) 574 this.bodySite = (Type) value; // Type 575 else if (name.equals("whenUsed")) 576 this.whenUsed = castToPeriod(value); // Period 577 else if (name.equals("device")) 578 this.device = castToReference(value); // Reference 579 else if (name.equals("identifier")) 580 this.getIdentifier().add(castToIdentifier(value)); 581 else if (name.equals("indication")) 582 this.getIndication().add(castToCodeableConcept(value)); 583 else if (name.equals("notes")) 584 this.getNotes().add(castToString(value)); 585 else if (name.equals("recordedOn")) 586 this.recordedOn = castToDateTime(value); // DateTimeType 587 else if (name.equals("subject")) 588 this.subject = castToReference(value); // Reference 589 else if (name.equals("timing[x]")) 590 this.timing = (Type) value; // Type 591 else 592 super.setProperty(name, value); 593 } 594 595 @Override 596 public Base addChild(String name) throws FHIRException { 597 if (name.equals("bodySiteCodeableConcept")) { 598 this.bodySite = new CodeableConcept(); 599 return this.bodySite; 600 } 601 else if (name.equals("bodySiteReference")) { 602 this.bodySite = new Reference(); 603 return this.bodySite; 604 } 605 else if (name.equals("whenUsed")) { 606 this.whenUsed = new Period(); 607 return this.whenUsed; 608 } 609 else if (name.equals("device")) { 610 this.device = new Reference(); 611 return this.device; 612 } 613 else if (name.equals("identifier")) { 614 return addIdentifier(); 615 } 616 else if (name.equals("indication")) { 617 return addIndication(); 618 } 619 else if (name.equals("notes")) { 620 throw new FHIRException("Cannot call addChild on a primitive type DeviceUseStatement.notes"); 621 } 622 else if (name.equals("recordedOn")) { 623 throw new FHIRException("Cannot call addChild on a primitive type DeviceUseStatement.recordedOn"); 624 } 625 else if (name.equals("subject")) { 626 this.subject = new Reference(); 627 return this.subject; 628 } 629 else if (name.equals("timingTiming")) { 630 this.timing = new Timing(); 631 return this.timing; 632 } 633 else if (name.equals("timingPeriod")) { 634 this.timing = new Period(); 635 return this.timing; 636 } 637 else if (name.equals("timingDateTime")) { 638 this.timing = new DateTimeType(); 639 return this.timing; 640 } 641 else 642 return super.addChild(name); 643 } 644 645 public String fhirType() { 646 return "DeviceUseStatement"; 647 648 } 649 650 public DeviceUseStatement copy() { 651 DeviceUseStatement dst = new DeviceUseStatement(); 652 copyValues(dst); 653 dst.bodySite = bodySite == null ? null : bodySite.copy(); 654 dst.whenUsed = whenUsed == null ? null : whenUsed.copy(); 655 dst.device = device == null ? null : device.copy(); 656 if (identifier != null) { 657 dst.identifier = new ArrayList<Identifier>(); 658 for (Identifier i : identifier) 659 dst.identifier.add(i.copy()); 660 }; 661 if (indication != null) { 662 dst.indication = new ArrayList<CodeableConcept>(); 663 for (CodeableConcept i : indication) 664 dst.indication.add(i.copy()); 665 }; 666 if (notes != null) { 667 dst.notes = new ArrayList<StringType>(); 668 for (StringType i : notes) 669 dst.notes.add(i.copy()); 670 }; 671 dst.recordedOn = recordedOn == null ? null : recordedOn.copy(); 672 dst.subject = subject == null ? null : subject.copy(); 673 dst.timing = timing == null ? null : timing.copy(); 674 return dst; 675 } 676 677 protected DeviceUseStatement typedCopy() { 678 return copy(); 679 } 680 681 @Override 682 public boolean equalsDeep(Base other) { 683 if (!super.equalsDeep(other)) 684 return false; 685 if (!(other instanceof DeviceUseStatement)) 686 return false; 687 DeviceUseStatement o = (DeviceUseStatement) other; 688 return compareDeep(bodySite, o.bodySite, true) && compareDeep(whenUsed, o.whenUsed, true) && compareDeep(device, o.device, true) 689 && compareDeep(identifier, o.identifier, true) && compareDeep(indication, o.indication, true) && compareDeep(notes, o.notes, true) 690 && compareDeep(recordedOn, o.recordedOn, true) && compareDeep(subject, o.subject, true) && compareDeep(timing, o.timing, true) 691 ; 692 } 693 694 @Override 695 public boolean equalsShallow(Base other) { 696 if (!super.equalsShallow(other)) 697 return false; 698 if (!(other instanceof DeviceUseStatement)) 699 return false; 700 DeviceUseStatement o = (DeviceUseStatement) other; 701 return compareValues(notes, o.notes, true) && compareValues(recordedOn, o.recordedOn, true); 702 } 703 704 public boolean isEmpty() { 705 return super.isEmpty() && (bodySite == null || bodySite.isEmpty()) && (whenUsed == null || whenUsed.isEmpty()) 706 && (device == null || device.isEmpty()) && (identifier == null || identifier.isEmpty()) && (indication == null || indication.isEmpty()) 707 && (notes == null || notes.isEmpty()) && (recordedOn == null || recordedOn.isEmpty()) && (subject == null || subject.isEmpty()) 708 && (timing == null || timing.isEmpty()); 709 } 710 711 @Override 712 public ResourceType getResourceType() { 713 return ResourceType.DeviceUseStatement; 714 } 715 716 @SearchParamDefinition(name="subject", path="DeviceUseStatement.subject", description="Search by subject", type="reference" ) 717 public static final String SP_SUBJECT = "subject"; 718 @SearchParamDefinition(name="patient", path="DeviceUseStatement.subject", description="Search by subject - a patient", type="reference" ) 719 public static final String SP_PATIENT = "patient"; 720 @SearchParamDefinition(name="device", path="DeviceUseStatement.device", description="Search by device", type="reference" ) 721 public static final String SP_DEVICE = "device"; 722 723} 724