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