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.Date;
035import java.util.List;
036
037import ca.uhn.fhir.model.api.annotation.Child;
038import ca.uhn.fhir.model.api.annotation.Description;
039import ca.uhn.fhir.model.api.annotation.ResourceDef;
040import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
041import org.hl7.fhir.exceptions.FHIRException;
042import org.hl7.fhir.utilities.Utilities;
043
044/**
045 * This resource identifies an instance of a manufactured item that is used in
046 * the provision of healthcare without being substantially changed through that
047 * activity. The device may be a medical or non-medical device. Medical devices
048 * includes durable (reusable) medical equipment, implantable devices, as well
049 * as disposable equipment used for diagnostic, treatment, and research for
050 * healthcare and public health. Non-medical devices may include items such as a
051 * machine, cellphone, computer, application, etc.
052 */
053@ResourceDef(name = "Device", profile = "http://hl7.org/fhir/Profile/Device")
054public class Device extends DomainResource {
055
056  public enum DeviceStatus {
057    /**
058     * The Device is available for use.
059     */
060    AVAILABLE,
061    /**
062     * The Device is no longer available for use (e.g. lost, expired, damaged).
063     */
064    NOTAVAILABLE,
065    /**
066     * The Device was entered in error and voided.
067     */
068    ENTEREDINERROR,
069    /**
070     * added to help the parsers
071     */
072    NULL;
073
074    public static DeviceStatus fromCode(String codeString) throws FHIRException {
075      if (codeString == null || "".equals(codeString))
076        return null;
077      if ("available".equals(codeString))
078        return AVAILABLE;
079      if ("not-available".equals(codeString))
080        return NOTAVAILABLE;
081      if ("entered-in-error".equals(codeString))
082        return ENTEREDINERROR;
083      throw new FHIRException("Unknown DeviceStatus code '" + codeString + "'");
084    }
085
086    public String toCode() {
087      switch (this) {
088      case AVAILABLE:
089        return "available";
090      case NOTAVAILABLE:
091        return "not-available";
092      case ENTEREDINERROR:
093        return "entered-in-error";
094      case NULL:
095        return null;
096      default:
097        return "?";
098      }
099    }
100
101    public String getSystem() {
102      switch (this) {
103      case AVAILABLE:
104        return "http://hl7.org/fhir/devicestatus";
105      case NOTAVAILABLE:
106        return "http://hl7.org/fhir/devicestatus";
107      case ENTEREDINERROR:
108        return "http://hl7.org/fhir/devicestatus";
109      case NULL:
110        return null;
111      default:
112        return "?";
113      }
114    }
115
116    public String getDefinition() {
117      switch (this) {
118      case AVAILABLE:
119        return "The Device is available for use.";
120      case NOTAVAILABLE:
121        return "The Device is no longer available for use (e.g. lost, expired, damaged).";
122      case ENTEREDINERROR:
123        return "The Device was entered in error and voided.";
124      case NULL:
125        return null;
126      default:
127        return "?";
128      }
129    }
130
131    public String getDisplay() {
132      switch (this) {
133      case AVAILABLE:
134        return "Available";
135      case NOTAVAILABLE:
136        return "Not Available";
137      case ENTEREDINERROR:
138        return "Entered in Error";
139      case NULL:
140        return null;
141      default:
142        return "?";
143      }
144    }
145  }
146
147  public static class DeviceStatusEnumFactory implements EnumFactory<DeviceStatus> {
148    public DeviceStatus fromCode(String codeString) throws IllegalArgumentException {
149      if (codeString == null || "".equals(codeString))
150        if (codeString == null || "".equals(codeString))
151          return null;
152      if ("available".equals(codeString))
153        return DeviceStatus.AVAILABLE;
154      if ("not-available".equals(codeString))
155        return DeviceStatus.NOTAVAILABLE;
156      if ("entered-in-error".equals(codeString))
157        return DeviceStatus.ENTEREDINERROR;
158      throw new IllegalArgumentException("Unknown DeviceStatus code '" + codeString + "'");
159    }
160
161    public Enumeration<DeviceStatus> fromType(Base code) throws FHIRException {
162      if (code == null || code.isEmpty())
163        return null;
164      String codeString = ((PrimitiveType) code).asStringValue();
165      if (codeString == null || "".equals(codeString))
166        return null;
167      if ("available".equals(codeString))
168        return new Enumeration<DeviceStatus>(this, DeviceStatus.AVAILABLE);
169      if ("not-available".equals(codeString))
170        return new Enumeration<DeviceStatus>(this, DeviceStatus.NOTAVAILABLE);
171      if ("entered-in-error".equals(codeString))
172        return new Enumeration<DeviceStatus>(this, DeviceStatus.ENTEREDINERROR);
173      throw new FHIRException("Unknown DeviceStatus code '" + codeString + "'");
174    }
175
176    public String toCode(DeviceStatus code) {
177      if (code == DeviceStatus.AVAILABLE)
178        return "available";
179      if (code == DeviceStatus.NOTAVAILABLE)
180        return "not-available";
181      if (code == DeviceStatus.ENTEREDINERROR)
182        return "entered-in-error";
183      return "?";
184    }
185  }
186
187  /**
188   * Unique instance identifiers assigned to a device by organizations like
189   * manufacturers or owners. If the identifier identifies the type of device,
190   * Device.type should be used.
191   */
192  @Child(name = "identifier", type = {
193      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
194  @Description(shortDefinition = "Instance id from manufacturer, owner, and others", formalDefinition = "Unique instance identifiers assigned to a device by organizations like manufacturers or owners. If the identifier identifies the type of device, Device.type should be used.")
195  protected List<Identifier> identifier;
196
197  /**
198   * Code or identifier to identify a kind of device.
199   */
200  @Child(name = "type", type = {
201      CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
202  @Description(shortDefinition = "What kind of device this is", formalDefinition = "Code or identifier to identify a kind of device.")
203  protected CodeableConcept type;
204
205  /**
206   * Descriptive information, usage information or implantation information that
207   * is not captured in an existing element.
208   */
209  @Child(name = "note", type = {
210      Annotation.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
211  @Description(shortDefinition = "Device notes and comments", formalDefinition = "Descriptive information, usage information or implantation information that is not captured in an existing element.")
212  protected List<Annotation> note;
213
214  /**
215   * Status of the Device availability.
216   */
217  @Child(name = "status", type = { CodeType.class }, order = 3, min = 0, max = 1, modifier = true, summary = true)
218  @Description(shortDefinition = "available | not-available | entered-in-error", formalDefinition = "Status of the Device availability.")
219  protected Enumeration<DeviceStatus> status;
220
221  /**
222   * A name of the manufacturer.
223   */
224  @Child(name = "manufacturer", type = {
225      StringType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
226  @Description(shortDefinition = "Name of device manufacturer", formalDefinition = "A name of the manufacturer.")
227  protected StringType manufacturer;
228
229  /**
230   * The "model" is an identifier assigned by the manufacturer to identify the
231   * product by its type. This number is shared by the all devices sold as the
232   * same type.
233   */
234  @Child(name = "model", type = { StringType.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
235  @Description(shortDefinition = "Model id assigned by the manufacturer", formalDefinition = "The \"model\" is an identifier assigned by the manufacturer to identify the product by its type. This number is shared by the all devices sold as the same type.")
236  protected StringType model;
237
238  /**
239   * The version of the device, if the device has multiple releases under the same
240   * model, or if the device is software or carries firmware.
241   */
242  @Child(name = "version", type = { StringType.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
243  @Description(shortDefinition = "Version number (i.e. software)", formalDefinition = "The version of the device, if the device has multiple releases under the same model, or if the device is software or carries firmware.")
244  protected StringType version;
245
246  /**
247   * The date and time when the device was manufactured.
248   */
249  @Child(name = "manufactureDate", type = {
250      DateTimeType.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
251  @Description(shortDefinition = "Manufacture date", formalDefinition = "The date and time when the device was manufactured.")
252  protected DateTimeType manufactureDate;
253
254  /**
255   * The date and time beyond which this device is no longer valid or should not
256   * be used (if applicable).
257   */
258  @Child(name = "expiry", type = { DateTimeType.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
259  @Description(shortDefinition = "Date and time of expiry of this device (if applicable)", formalDefinition = "The date and time beyond which this device is no longer valid or should not be used (if applicable).")
260  protected DateTimeType expiry;
261
262  /**
263   * United States Food and Drug Administration mandated Unique Device Identifier
264   * (UDI). Use the human readable information (the content that the user sees,
265   * which is sometimes different to the exact syntax represented in the barcode)
266   * - see
267   * http://www.fda.gov/MedicalDevices/DeviceRegulationandGuidance/UniqueDeviceIdentification/default.htm.
268   */
269  @Child(name = "udi", type = { StringType.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
270  @Description(shortDefinition = "FDA mandated Unique Device Identifier", formalDefinition = "United States Food and Drug Administration mandated Unique Device Identifier (UDI). Use the human readable information (the content that the user sees, which is sometimes different to the exact syntax represented in the barcode)  - see http://www.fda.gov/MedicalDevices/DeviceRegulationandGuidance/UniqueDeviceIdentification/default.htm.")
271  protected StringType udi;
272
273  /**
274   * Lot number assigned by the manufacturer.
275   */
276  @Child(name = "lotNumber", type = {
277      StringType.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
278  @Description(shortDefinition = "Lot number of manufacture", formalDefinition = "Lot number assigned by the manufacturer.")
279  protected StringType lotNumber;
280
281  /**
282   * An organization that is responsible for the provision and ongoing maintenance
283   * of the device.
284   */
285  @Child(name = "owner", type = { Organization.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
286  @Description(shortDefinition = "Organization responsible for device", formalDefinition = "An organization that is responsible for the provision and ongoing maintenance of the device.")
287  protected Reference owner;
288
289  /**
290   * The actual object that is the target of the reference (An organization that
291   * is responsible for the provision and ongoing maintenance of the device.)
292   */
293  protected Organization ownerTarget;
294
295  /**
296   * The place where the device can be found.
297   */
298  @Child(name = "location", type = { Location.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
299  @Description(shortDefinition = "Where the resource is found", formalDefinition = "The place where the device can be found.")
300  protected Reference location;
301
302  /**
303   * The actual object that is the target of the reference (The place where the
304   * device can be found.)
305   */
306  protected Location locationTarget;
307
308  /**
309   * Patient information, if the resource is affixed to a person.
310   */
311  @Child(name = "patient", type = { Patient.class }, order = 13, min = 0, max = 1, modifier = false, summary = false)
312  @Description(shortDefinition = "If the resource is affixed to a person", formalDefinition = "Patient information, if the resource is affixed to a person.")
313  protected Reference patient;
314
315  /**
316   * The actual object that is the target of the reference (Patient information,
317   * if the resource is affixed to a person.)
318   */
319  protected Patient patientTarget;
320
321  /**
322   * Contact details for an organization or a particular human that is responsible
323   * for the device.
324   */
325  @Child(name = "contact", type = {
326      ContactPoint.class }, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
327  @Description(shortDefinition = "Details for human/organization for support", formalDefinition = "Contact details for an organization or a particular human that is responsible for the device.")
328  protected List<ContactPoint> contact;
329
330  /**
331   * A network address on which the device may be contacted directly.
332   */
333  @Child(name = "url", type = { UriType.class }, order = 15, min = 0, max = 1, modifier = false, summary = false)
334  @Description(shortDefinition = "Network address to contact device", formalDefinition = "A network address on which the device may be contacted directly.")
335  protected UriType url;
336
337  private static final long serialVersionUID = 366690094L;
338
339  /*
340   * Constructor
341   */
342  public Device() {
343    super();
344  }
345
346  /*
347   * Constructor
348   */
349  public Device(CodeableConcept type) {
350    super();
351    this.type = type;
352  }
353
354  /**
355   * @return {@link #identifier} (Unique instance identifiers assigned to a device
356   *         by organizations like manufacturers or owners. If the identifier
357   *         identifies the type of device, Device.type should be used.)
358   */
359  public List<Identifier> getIdentifier() {
360    if (this.identifier == null)
361      this.identifier = new ArrayList<Identifier>();
362    return this.identifier;
363  }
364
365  public boolean hasIdentifier() {
366    if (this.identifier == null)
367      return false;
368    for (Identifier item : this.identifier)
369      if (!item.isEmpty())
370        return true;
371    return false;
372  }
373
374  /**
375   * @return {@link #identifier} (Unique instance identifiers assigned to a device
376   *         by organizations like manufacturers or owners. If the identifier
377   *         identifies the type of device, Device.type should be used.)
378   */
379  // syntactic sugar
380  public Identifier addIdentifier() { // 3
381    Identifier t = new Identifier();
382    if (this.identifier == null)
383      this.identifier = new ArrayList<Identifier>();
384    this.identifier.add(t);
385    return t;
386  }
387
388  // syntactic sugar
389  public Device addIdentifier(Identifier t) { // 3
390    if (t == null)
391      return this;
392    if (this.identifier == null)
393      this.identifier = new ArrayList<Identifier>();
394    this.identifier.add(t);
395    return this;
396  }
397
398  /**
399   * @return {@link #type} (Code or identifier to identify a kind of device.)
400   */
401  public CodeableConcept getType() {
402    if (this.type == null)
403      if (Configuration.errorOnAutoCreate())
404        throw new Error("Attempt to auto-create Device.type");
405      else if (Configuration.doAutoCreate())
406        this.type = new CodeableConcept(); // cc
407    return this.type;
408  }
409
410  public boolean hasType() {
411    return this.type != null && !this.type.isEmpty();
412  }
413
414  /**
415   * @param value {@link #type} (Code or identifier to identify a kind of device.)
416   */
417  public Device setType(CodeableConcept value) {
418    this.type = value;
419    return this;
420  }
421
422  /**
423   * @return {@link #note} (Descriptive information, usage information or
424   *         implantation information that is not captured in an existing
425   *         element.)
426   */
427  public List<Annotation> getNote() {
428    if (this.note == null)
429      this.note = new ArrayList<Annotation>();
430    return this.note;
431  }
432
433  public boolean hasNote() {
434    if (this.note == null)
435      return false;
436    for (Annotation item : this.note)
437      if (!item.isEmpty())
438        return true;
439    return false;
440  }
441
442  /**
443   * @return {@link #note} (Descriptive information, usage information or
444   *         implantation information that is not captured in an existing
445   *         element.)
446   */
447  // syntactic sugar
448  public Annotation addNote() { // 3
449    Annotation t = new Annotation();
450    if (this.note == null)
451      this.note = new ArrayList<Annotation>();
452    this.note.add(t);
453    return t;
454  }
455
456  // syntactic sugar
457  public Device addNote(Annotation t) { // 3
458    if (t == null)
459      return this;
460    if (this.note == null)
461      this.note = new ArrayList<Annotation>();
462    this.note.add(t);
463    return this;
464  }
465
466  /**
467   * @return {@link #status} (Status of the Device availability.). This is the
468   *         underlying object with id, value and extensions. The accessor
469   *         "getStatus" gives direct access to the value
470   */
471  public Enumeration<DeviceStatus> getStatusElement() {
472    if (this.status == null)
473      if (Configuration.errorOnAutoCreate())
474        throw new Error("Attempt to auto-create Device.status");
475      else if (Configuration.doAutoCreate())
476        this.status = new Enumeration<DeviceStatus>(new DeviceStatusEnumFactory()); // bb
477    return this.status;
478  }
479
480  public boolean hasStatusElement() {
481    return this.status != null && !this.status.isEmpty();
482  }
483
484  public boolean hasStatus() {
485    return this.status != null && !this.status.isEmpty();
486  }
487
488  /**
489   * @param value {@link #status} (Status of the Device availability.). This is
490   *              the underlying object with id, value and extensions. The
491   *              accessor "getStatus" gives direct access to the value
492   */
493  public Device setStatusElement(Enumeration<DeviceStatus> value) {
494    this.status = value;
495    return this;
496  }
497
498  /**
499   * @return Status of the Device availability.
500   */
501  public DeviceStatus getStatus() {
502    return this.status == null ? null : this.status.getValue();
503  }
504
505  /**
506   * @param value Status of the Device availability.
507   */
508  public Device setStatus(DeviceStatus value) {
509    if (value == null)
510      this.status = null;
511    else {
512      if (this.status == null)
513        this.status = new Enumeration<DeviceStatus>(new DeviceStatusEnumFactory());
514      this.status.setValue(value);
515    }
516    return this;
517  }
518
519  /**
520   * @return {@link #manufacturer} (A name of the manufacturer.). This is the
521   *         underlying object with id, value and extensions. The accessor
522   *         "getManufacturer" gives direct access to the value
523   */
524  public StringType getManufacturerElement() {
525    if (this.manufacturer == null)
526      if (Configuration.errorOnAutoCreate())
527        throw new Error("Attempt to auto-create Device.manufacturer");
528      else if (Configuration.doAutoCreate())
529        this.manufacturer = new StringType(); // bb
530    return this.manufacturer;
531  }
532
533  public boolean hasManufacturerElement() {
534    return this.manufacturer != null && !this.manufacturer.isEmpty();
535  }
536
537  public boolean hasManufacturer() {
538    return this.manufacturer != null && !this.manufacturer.isEmpty();
539  }
540
541  /**
542   * @param value {@link #manufacturer} (A name of the manufacturer.). This is the
543   *              underlying object with id, value and extensions. The accessor
544   *              "getManufacturer" gives direct access to the value
545   */
546  public Device setManufacturerElement(StringType value) {
547    this.manufacturer = value;
548    return this;
549  }
550
551  /**
552   * @return A name of the manufacturer.
553   */
554  public String getManufacturer() {
555    return this.manufacturer == null ? null : this.manufacturer.getValue();
556  }
557
558  /**
559   * @param value A name of the manufacturer.
560   */
561  public Device setManufacturer(String value) {
562    if (Utilities.noString(value))
563      this.manufacturer = null;
564    else {
565      if (this.manufacturer == null)
566        this.manufacturer = new StringType();
567      this.manufacturer.setValue(value);
568    }
569    return this;
570  }
571
572  /**
573   * @return {@link #model} (The "model" is an identifier assigned by the
574   *         manufacturer to identify the product by its type. This number is
575   *         shared by the all devices sold as the same type.). This is the
576   *         underlying object with id, value and extensions. The accessor
577   *         "getModel" gives direct access to the value
578   */
579  public StringType getModelElement() {
580    if (this.model == null)
581      if (Configuration.errorOnAutoCreate())
582        throw new Error("Attempt to auto-create Device.model");
583      else if (Configuration.doAutoCreate())
584        this.model = new StringType(); // bb
585    return this.model;
586  }
587
588  public boolean hasModelElement() {
589    return this.model != null && !this.model.isEmpty();
590  }
591
592  public boolean hasModel() {
593    return this.model != null && !this.model.isEmpty();
594  }
595
596  /**
597   * @param value {@link #model} (The "model" is an identifier assigned by the
598   *              manufacturer to identify the product by its type. This number is
599   *              shared by the all devices sold as the same type.). This is the
600   *              underlying object with id, value and extensions. The accessor
601   *              "getModel" gives direct access to the value
602   */
603  public Device setModelElement(StringType value) {
604    this.model = value;
605    return this;
606  }
607
608  /**
609   * @return The "model" is an identifier assigned by the manufacturer to identify
610   *         the product by its type. This number is shared by the all devices
611   *         sold as the same type.
612   */
613  public String getModel() {
614    return this.model == null ? null : this.model.getValue();
615  }
616
617  /**
618   * @param value The "model" is an identifier assigned by the manufacturer to
619   *              identify the product by its type. This number is shared by the
620   *              all devices sold as the same type.
621   */
622  public Device setModel(String value) {
623    if (Utilities.noString(value))
624      this.model = null;
625    else {
626      if (this.model == null)
627        this.model = new StringType();
628      this.model.setValue(value);
629    }
630    return this;
631  }
632
633  /**
634   * @return {@link #version} (The version of the device, if the device has
635   *         multiple releases under the same model, or if the device is software
636   *         or carries firmware.). This is the underlying object with id, value
637   *         and extensions. The accessor "getVersion" gives direct access to the
638   *         value
639   */
640  public StringType getVersionElement() {
641    if (this.version == null)
642      if (Configuration.errorOnAutoCreate())
643        throw new Error("Attempt to auto-create Device.version");
644      else if (Configuration.doAutoCreate())
645        this.version = new StringType(); // bb
646    return this.version;
647  }
648
649  public boolean hasVersionElement() {
650    return this.version != null && !this.version.isEmpty();
651  }
652
653  public boolean hasVersion() {
654    return this.version != null && !this.version.isEmpty();
655  }
656
657  /**
658   * @param value {@link #version} (The version of the device, if the device has
659   *              multiple releases under the same model, or if the device is
660   *              software or carries firmware.). This is the underlying object
661   *              with id, value and extensions. The accessor "getVersion" gives
662   *              direct access to the value
663   */
664  public Device setVersionElement(StringType value) {
665    this.version = value;
666    return this;
667  }
668
669  /**
670   * @return The version of the device, if the device has multiple releases under
671   *         the same model, or if the device is software or carries firmware.
672   */
673  public String getVersion() {
674    return this.version == null ? null : this.version.getValue();
675  }
676
677  /**
678   * @param value The version of the device, if the device has multiple releases
679   *              under the same model, or if the device is software or carries
680   *              firmware.
681   */
682  public Device setVersion(String value) {
683    if (Utilities.noString(value))
684      this.version = null;
685    else {
686      if (this.version == null)
687        this.version = new StringType();
688      this.version.setValue(value);
689    }
690    return this;
691  }
692
693  /**
694   * @return {@link #manufactureDate} (The date and time when the device was
695   *         manufactured.). This is the underlying object with id, value and
696   *         extensions. The accessor "getManufactureDate" gives direct access to
697   *         the value
698   */
699  public DateTimeType getManufactureDateElement() {
700    if (this.manufactureDate == null)
701      if (Configuration.errorOnAutoCreate())
702        throw new Error("Attempt to auto-create Device.manufactureDate");
703      else if (Configuration.doAutoCreate())
704        this.manufactureDate = new DateTimeType(); // bb
705    return this.manufactureDate;
706  }
707
708  public boolean hasManufactureDateElement() {
709    return this.manufactureDate != null && !this.manufactureDate.isEmpty();
710  }
711
712  public boolean hasManufactureDate() {
713    return this.manufactureDate != null && !this.manufactureDate.isEmpty();
714  }
715
716  /**
717   * @param value {@link #manufactureDate} (The date and time when the device was
718   *              manufactured.). This is the underlying object with id, value and
719   *              extensions. The accessor "getManufactureDate" gives direct
720   *              access to the value
721   */
722  public Device setManufactureDateElement(DateTimeType value) {
723    this.manufactureDate = value;
724    return this;
725  }
726
727  /**
728   * @return The date and time when the device was manufactured.
729   */
730  public Date getManufactureDate() {
731    return this.manufactureDate == null ? null : this.manufactureDate.getValue();
732  }
733
734  /**
735   * @param value The date and time when the device was manufactured.
736   */
737  public Device setManufactureDate(Date value) {
738    if (value == null)
739      this.manufactureDate = null;
740    else {
741      if (this.manufactureDate == null)
742        this.manufactureDate = new DateTimeType();
743      this.manufactureDate.setValue(value);
744    }
745    return this;
746  }
747
748  /**
749   * @return {@link #expiry} (The date and time beyond which this device is no
750   *         longer valid or should not be used (if applicable).). This is the
751   *         underlying object with id, value and extensions. The accessor
752   *         "getExpiry" gives direct access to the value
753   */
754  public DateTimeType getExpiryElement() {
755    if (this.expiry == null)
756      if (Configuration.errorOnAutoCreate())
757        throw new Error("Attempt to auto-create Device.expiry");
758      else if (Configuration.doAutoCreate())
759        this.expiry = new DateTimeType(); // bb
760    return this.expiry;
761  }
762
763  public boolean hasExpiryElement() {
764    return this.expiry != null && !this.expiry.isEmpty();
765  }
766
767  public boolean hasExpiry() {
768    return this.expiry != null && !this.expiry.isEmpty();
769  }
770
771  /**
772   * @param value {@link #expiry} (The date and time beyond which this device is
773   *              no longer valid or should not be used (if applicable).). This is
774   *              the underlying object with id, value and extensions. The
775   *              accessor "getExpiry" gives direct access to the value
776   */
777  public Device setExpiryElement(DateTimeType value) {
778    this.expiry = value;
779    return this;
780  }
781
782  /**
783   * @return The date and time beyond which this device is no longer valid or
784   *         should not be used (if applicable).
785   */
786  public Date getExpiry() {
787    return this.expiry == null ? null : this.expiry.getValue();
788  }
789
790  /**
791   * @param value The date and time beyond which this device is no longer valid or
792   *              should not be used (if applicable).
793   */
794  public Device setExpiry(Date value) {
795    if (value == null)
796      this.expiry = null;
797    else {
798      if (this.expiry == null)
799        this.expiry = new DateTimeType();
800      this.expiry.setValue(value);
801    }
802    return this;
803  }
804
805  /**
806   * @return {@link #udi} (United States Food and Drug Administration mandated
807   *         Unique Device Identifier (UDI). Use the human readable information
808   *         (the content that the user sees, which is sometimes different to the
809   *         exact syntax represented in the barcode) - see
810   *         http://www.fda.gov/MedicalDevices/DeviceRegulationandGuidance/UniqueDeviceIdentification/default.htm.).
811   *         This is the underlying object with id, value and extensions. The
812   *         accessor "getUdi" gives direct access to the value
813   */
814  public StringType getUdiElement() {
815    if (this.udi == null)
816      if (Configuration.errorOnAutoCreate())
817        throw new Error("Attempt to auto-create Device.udi");
818      else if (Configuration.doAutoCreate())
819        this.udi = new StringType(); // bb
820    return this.udi;
821  }
822
823  public boolean hasUdiElement() {
824    return this.udi != null && !this.udi.isEmpty();
825  }
826
827  public boolean hasUdi() {
828    return this.udi != null && !this.udi.isEmpty();
829  }
830
831  /**
832   * @param value {@link #udi} (United States Food and Drug Administration
833   *              mandated Unique Device Identifier (UDI). Use the human readable
834   *              information (the content that the user sees, which is sometimes
835   *              different to the exact syntax represented in the barcode) - see
836   *              http://www.fda.gov/MedicalDevices/DeviceRegulationandGuidance/UniqueDeviceIdentification/default.htm.).
837   *              This is the underlying object with id, value and extensions. The
838   *              accessor "getUdi" gives direct access to the value
839   */
840  public Device setUdiElement(StringType value) {
841    this.udi = value;
842    return this;
843  }
844
845  /**
846   * @return United States Food and Drug Administration mandated Unique Device
847   *         Identifier (UDI). Use the human readable information (the content
848   *         that the user sees, which is sometimes different to the exact syntax
849   *         represented in the barcode) - see
850   *         http://www.fda.gov/MedicalDevices/DeviceRegulationandGuidance/UniqueDeviceIdentification/default.htm.
851   */
852  public String getUdi() {
853    return this.udi == null ? null : this.udi.getValue();
854  }
855
856  /**
857   * @param value United States Food and Drug Administration mandated Unique
858   *              Device Identifier (UDI). Use the human readable information (the
859   *              content that the user sees, which is sometimes different to the
860   *              exact syntax represented in the barcode) - see
861   *              http://www.fda.gov/MedicalDevices/DeviceRegulationandGuidance/UniqueDeviceIdentification/default.htm.
862   */
863  public Device setUdi(String value) {
864    if (Utilities.noString(value))
865      this.udi = null;
866    else {
867      if (this.udi == null)
868        this.udi = new StringType();
869      this.udi.setValue(value);
870    }
871    return this;
872  }
873
874  /**
875   * @return {@link #lotNumber} (Lot number assigned by the manufacturer.). This
876   *         is the underlying object with id, value and extensions. The accessor
877   *         "getLotNumber" gives direct access to the value
878   */
879  public StringType getLotNumberElement() {
880    if (this.lotNumber == null)
881      if (Configuration.errorOnAutoCreate())
882        throw new Error("Attempt to auto-create Device.lotNumber");
883      else if (Configuration.doAutoCreate())
884        this.lotNumber = new StringType(); // bb
885    return this.lotNumber;
886  }
887
888  public boolean hasLotNumberElement() {
889    return this.lotNumber != null && !this.lotNumber.isEmpty();
890  }
891
892  public boolean hasLotNumber() {
893    return this.lotNumber != null && !this.lotNumber.isEmpty();
894  }
895
896  /**
897   * @param value {@link #lotNumber} (Lot number assigned by the manufacturer.).
898   *              This is the underlying object with id, value and extensions. The
899   *              accessor "getLotNumber" gives direct access to the value
900   */
901  public Device setLotNumberElement(StringType value) {
902    this.lotNumber = value;
903    return this;
904  }
905
906  /**
907   * @return Lot number assigned by the manufacturer.
908   */
909  public String getLotNumber() {
910    return this.lotNumber == null ? null : this.lotNumber.getValue();
911  }
912
913  /**
914   * @param value Lot number assigned by the manufacturer.
915   */
916  public Device setLotNumber(String value) {
917    if (Utilities.noString(value))
918      this.lotNumber = null;
919    else {
920      if (this.lotNumber == null)
921        this.lotNumber = new StringType();
922      this.lotNumber.setValue(value);
923    }
924    return this;
925  }
926
927  /**
928   * @return {@link #owner} (An organization that is responsible for the provision
929   *         and ongoing maintenance of the device.)
930   */
931  public Reference getOwner() {
932    if (this.owner == null)
933      if (Configuration.errorOnAutoCreate())
934        throw new Error("Attempt to auto-create Device.owner");
935      else if (Configuration.doAutoCreate())
936        this.owner = new Reference(); // cc
937    return this.owner;
938  }
939
940  public boolean hasOwner() {
941    return this.owner != null && !this.owner.isEmpty();
942  }
943
944  /**
945   * @param value {@link #owner} (An organization that is responsible for the
946   *              provision and ongoing maintenance of the device.)
947   */
948  public Device setOwner(Reference value) {
949    this.owner = value;
950    return this;
951  }
952
953  /**
954   * @return {@link #owner} The actual object that is the target of the reference.
955   *         The reference library doesn't populate this, but you can use it to
956   *         hold the resource if you resolve it. (An organization that is
957   *         responsible for the provision and ongoing maintenance of the device.)
958   */
959  public Organization getOwnerTarget() {
960    if (this.ownerTarget == null)
961      if (Configuration.errorOnAutoCreate())
962        throw new Error("Attempt to auto-create Device.owner");
963      else if (Configuration.doAutoCreate())
964        this.ownerTarget = new Organization(); // aa
965    return this.ownerTarget;
966  }
967
968  /**
969   * @param value {@link #owner} The actual object that is the target of the
970   *              reference. The reference library doesn't use these, but you can
971   *              use it to hold the resource if you resolve it. (An organization
972   *              that is responsible for the provision and ongoing maintenance of
973   *              the device.)
974   */
975  public Device setOwnerTarget(Organization value) {
976    this.ownerTarget = value;
977    return this;
978  }
979
980  /**
981   * @return {@link #location} (The place where the device can be found.)
982   */
983  public Reference getLocation() {
984    if (this.location == null)
985      if (Configuration.errorOnAutoCreate())
986        throw new Error("Attempt to auto-create Device.location");
987      else if (Configuration.doAutoCreate())
988        this.location = new Reference(); // cc
989    return this.location;
990  }
991
992  public boolean hasLocation() {
993    return this.location != null && !this.location.isEmpty();
994  }
995
996  /**
997   * @param value {@link #location} (The place where the device can be found.)
998   */
999  public Device setLocation(Reference value) {
1000    this.location = value;
1001    return this;
1002  }
1003
1004  /**
1005   * @return {@link #location} The actual object that is the target of the
1006   *         reference. The reference library doesn't populate this, but you can
1007   *         use it to hold the resource if you resolve it. (The place where the
1008   *         device can be found.)
1009   */
1010  public Location getLocationTarget() {
1011    if (this.locationTarget == null)
1012      if (Configuration.errorOnAutoCreate())
1013        throw new Error("Attempt to auto-create Device.location");
1014      else if (Configuration.doAutoCreate())
1015        this.locationTarget = new Location(); // aa
1016    return this.locationTarget;
1017  }
1018
1019  /**
1020   * @param value {@link #location} The actual object that is the target of the
1021   *              reference. The reference library doesn't use these, but you can
1022   *              use it to hold the resource if you resolve it. (The place where
1023   *              the device can be found.)
1024   */
1025  public Device setLocationTarget(Location value) {
1026    this.locationTarget = value;
1027    return this;
1028  }
1029
1030  /**
1031   * @return {@link #patient} (Patient information, if the resource is affixed to
1032   *         a person.)
1033   */
1034  public Reference getPatient() {
1035    if (this.patient == null)
1036      if (Configuration.errorOnAutoCreate())
1037        throw new Error("Attempt to auto-create Device.patient");
1038      else if (Configuration.doAutoCreate())
1039        this.patient = new Reference(); // cc
1040    return this.patient;
1041  }
1042
1043  public boolean hasPatient() {
1044    return this.patient != null && !this.patient.isEmpty();
1045  }
1046
1047  /**
1048   * @param value {@link #patient} (Patient information, if the resource is
1049   *              affixed to a person.)
1050   */
1051  public Device setPatient(Reference value) {
1052    this.patient = value;
1053    return this;
1054  }
1055
1056  /**
1057   * @return {@link #patient} The actual object that is the target of the
1058   *         reference. The reference library doesn't populate this, but you can
1059   *         use it to hold the resource if you resolve it. (Patient information,
1060   *         if the resource is affixed to a person.)
1061   */
1062  public Patient getPatientTarget() {
1063    if (this.patientTarget == null)
1064      if (Configuration.errorOnAutoCreate())
1065        throw new Error("Attempt to auto-create Device.patient");
1066      else if (Configuration.doAutoCreate())
1067        this.patientTarget = new Patient(); // aa
1068    return this.patientTarget;
1069  }
1070
1071  /**
1072   * @param value {@link #patient} The actual object that is the target of the
1073   *              reference. The reference library doesn't use these, but you can
1074   *              use it to hold the resource if you resolve it. (Patient
1075   *              information, if the resource is affixed to a person.)
1076   */
1077  public Device setPatientTarget(Patient value) {
1078    this.patientTarget = value;
1079    return this;
1080  }
1081
1082  /**
1083   * @return {@link #contact} (Contact details for an organization or a particular
1084   *         human that is responsible for the device.)
1085   */
1086  public List<ContactPoint> getContact() {
1087    if (this.contact == null)
1088      this.contact = new ArrayList<ContactPoint>();
1089    return this.contact;
1090  }
1091
1092  public boolean hasContact() {
1093    if (this.contact == null)
1094      return false;
1095    for (ContactPoint item : this.contact)
1096      if (!item.isEmpty())
1097        return true;
1098    return false;
1099  }
1100
1101  /**
1102   * @return {@link #contact} (Contact details for an organization or a particular
1103   *         human that is responsible for the device.)
1104   */
1105  // syntactic sugar
1106  public ContactPoint addContact() { // 3
1107    ContactPoint t = new ContactPoint();
1108    if (this.contact == null)
1109      this.contact = new ArrayList<ContactPoint>();
1110    this.contact.add(t);
1111    return t;
1112  }
1113
1114  // syntactic sugar
1115  public Device addContact(ContactPoint t) { // 3
1116    if (t == null)
1117      return this;
1118    if (this.contact == null)
1119      this.contact = new ArrayList<ContactPoint>();
1120    this.contact.add(t);
1121    return this;
1122  }
1123
1124  /**
1125   * @return {@link #url} (A network address on which the device may be contacted
1126   *         directly.). This is the underlying object with id, value and
1127   *         extensions. The accessor "getUrl" gives direct access to the value
1128   */
1129  public UriType getUrlElement() {
1130    if (this.url == null)
1131      if (Configuration.errorOnAutoCreate())
1132        throw new Error("Attempt to auto-create Device.url");
1133      else if (Configuration.doAutoCreate())
1134        this.url = new UriType(); // bb
1135    return this.url;
1136  }
1137
1138  public boolean hasUrlElement() {
1139    return this.url != null && !this.url.isEmpty();
1140  }
1141
1142  public boolean hasUrl() {
1143    return this.url != null && !this.url.isEmpty();
1144  }
1145
1146  /**
1147   * @param value {@link #url} (A network address on which the device may be
1148   *              contacted directly.). This is the underlying object with id,
1149   *              value and extensions. The accessor "getUrl" gives direct access
1150   *              to the value
1151   */
1152  public Device setUrlElement(UriType value) {
1153    this.url = value;
1154    return this;
1155  }
1156
1157  /**
1158   * @return A network address on which the device may be contacted directly.
1159   */
1160  public String getUrl() {
1161    return this.url == null ? null : this.url.getValue();
1162  }
1163
1164  /**
1165   * @param value A network address on which the device may be contacted directly.
1166   */
1167  public Device setUrl(String value) {
1168    if (Utilities.noString(value))
1169      this.url = null;
1170    else {
1171      if (this.url == null)
1172        this.url = new UriType();
1173      this.url.setValue(value);
1174    }
1175    return this;
1176  }
1177
1178  protected void listChildren(List<Property> childrenList) {
1179    super.listChildren(childrenList);
1180    childrenList.add(new Property("identifier", "Identifier",
1181        "Unique instance identifiers assigned to a device by organizations like manufacturers or owners. If the identifier identifies the type of device, Device.type should be used.",
1182        0, java.lang.Integer.MAX_VALUE, identifier));
1183    childrenList.add(new Property("type", "CodeableConcept", "Code or identifier to identify a kind of device.", 0,
1184        java.lang.Integer.MAX_VALUE, type));
1185    childrenList.add(new Property("note", "Annotation",
1186        "Descriptive information, usage information or implantation information that is not captured in an existing element.",
1187        0, java.lang.Integer.MAX_VALUE, note));
1188    childrenList.add(
1189        new Property("status", "code", "Status of the Device availability.", 0, java.lang.Integer.MAX_VALUE, status));
1190    childrenList.add(new Property("manufacturer", "string", "A name of the manufacturer.", 0,
1191        java.lang.Integer.MAX_VALUE, manufacturer));
1192    childrenList.add(new Property("model", "string",
1193        "The \"model\" is an identifier assigned by the manufacturer to identify the product by its type. This number is shared by the all devices sold as the same type.",
1194        0, java.lang.Integer.MAX_VALUE, model));
1195    childrenList.add(new Property("version", "string",
1196        "The version of the device, if the device has multiple releases under the same model, or if the device is software or carries firmware.",
1197        0, java.lang.Integer.MAX_VALUE, version));
1198    childrenList.add(new Property("manufactureDate", "dateTime", "The date and time when the device was manufactured.",
1199        0, java.lang.Integer.MAX_VALUE, manufactureDate));
1200    childrenList.add(new Property("expiry", "dateTime",
1201        "The date and time beyond which this device is no longer valid or should not be used (if applicable).", 0,
1202        java.lang.Integer.MAX_VALUE, expiry));
1203    childrenList.add(new Property("udi", "string",
1204        "United States Food and Drug Administration mandated Unique Device Identifier (UDI). Use the human readable information (the content that the user sees, which is sometimes different to the exact syntax represented in the barcode)  - see http://www.fda.gov/MedicalDevices/DeviceRegulationandGuidance/UniqueDeviceIdentification/default.htm.",
1205        0, java.lang.Integer.MAX_VALUE, udi));
1206    childrenList.add(new Property("lotNumber", "string", "Lot number assigned by the manufacturer.", 0,
1207        java.lang.Integer.MAX_VALUE, lotNumber));
1208    childrenList.add(new Property("owner", "Reference(Organization)",
1209        "An organization that is responsible for the provision and ongoing maintenance of the device.", 0,
1210        java.lang.Integer.MAX_VALUE, owner));
1211    childrenList.add(new Property("location", "Reference(Location)", "The place where the device can be found.", 0,
1212        java.lang.Integer.MAX_VALUE, location));
1213    childrenList.add(new Property("patient", "Reference(Patient)",
1214        "Patient information, if the resource is affixed to a person.", 0, java.lang.Integer.MAX_VALUE, patient));
1215    childrenList.add(new Property("contact", "ContactPoint",
1216        "Contact details for an organization or a particular human that is responsible for the device.", 0,
1217        java.lang.Integer.MAX_VALUE, contact));
1218    childrenList.add(new Property("url", "uri", "A network address on which the device may be contacted directly.", 0,
1219        java.lang.Integer.MAX_VALUE, url));
1220  }
1221
1222  @Override
1223  public void setProperty(String name, Base value) throws FHIRException {
1224    if (name.equals("identifier"))
1225      this.getIdentifier().add(castToIdentifier(value));
1226    else if (name.equals("type"))
1227      this.type = castToCodeableConcept(value); // CodeableConcept
1228    else if (name.equals("note"))
1229      this.getNote().add(castToAnnotation(value));
1230    else if (name.equals("status"))
1231      this.status = new DeviceStatusEnumFactory().fromType(value); // Enumeration<DeviceStatus>
1232    else if (name.equals("manufacturer"))
1233      this.manufacturer = castToString(value); // StringType
1234    else if (name.equals("model"))
1235      this.model = castToString(value); // StringType
1236    else if (name.equals("version"))
1237      this.version = castToString(value); // StringType
1238    else if (name.equals("manufactureDate"))
1239      this.manufactureDate = castToDateTime(value); // DateTimeType
1240    else if (name.equals("expiry"))
1241      this.expiry = castToDateTime(value); // DateTimeType
1242    else if (name.equals("udi"))
1243      this.udi = castToString(value); // StringType
1244    else if (name.equals("lotNumber"))
1245      this.lotNumber = castToString(value); // StringType
1246    else if (name.equals("owner"))
1247      this.owner = castToReference(value); // Reference
1248    else if (name.equals("location"))
1249      this.location = castToReference(value); // Reference
1250    else if (name.equals("patient"))
1251      this.patient = castToReference(value); // Reference
1252    else if (name.equals("contact"))
1253      this.getContact().add(castToContactPoint(value));
1254    else if (name.equals("url"))
1255      this.url = castToUri(value); // UriType
1256    else
1257      super.setProperty(name, value);
1258  }
1259
1260  @Override
1261  public Base addChild(String name) throws FHIRException {
1262    if (name.equals("identifier")) {
1263      return addIdentifier();
1264    } else if (name.equals("type")) {
1265      this.type = new CodeableConcept();
1266      return this.type;
1267    } else if (name.equals("note")) {
1268      return addNote();
1269    } else if (name.equals("status")) {
1270      throw new FHIRException("Cannot call addChild on a singleton property Device.status");
1271    } else if (name.equals("manufacturer")) {
1272      throw new FHIRException("Cannot call addChild on a singleton property Device.manufacturer");
1273    } else if (name.equals("model")) {
1274      throw new FHIRException("Cannot call addChild on a singleton property Device.model");
1275    } else if (name.equals("version")) {
1276      throw new FHIRException("Cannot call addChild on a singleton property Device.version");
1277    } else if (name.equals("manufactureDate")) {
1278      throw new FHIRException("Cannot call addChild on a singleton property Device.manufactureDate");
1279    } else if (name.equals("expiry")) {
1280      throw new FHIRException("Cannot call addChild on a singleton property Device.expiry");
1281    } else if (name.equals("udi")) {
1282      throw new FHIRException("Cannot call addChild on a singleton property Device.udi");
1283    } else if (name.equals("lotNumber")) {
1284      throw new FHIRException("Cannot call addChild on a singleton property Device.lotNumber");
1285    } else if (name.equals("owner")) {
1286      this.owner = new Reference();
1287      return this.owner;
1288    } else if (name.equals("location")) {
1289      this.location = new Reference();
1290      return this.location;
1291    } else if (name.equals("patient")) {
1292      this.patient = new Reference();
1293      return this.patient;
1294    } else if (name.equals("contact")) {
1295      return addContact();
1296    } else if (name.equals("url")) {
1297      throw new FHIRException("Cannot call addChild on a singleton property Device.url");
1298    } else
1299      return super.addChild(name);
1300  }
1301
1302  public String fhirType() {
1303    return "Device";
1304
1305  }
1306
1307  public Device copy() {
1308    Device dst = new Device();
1309    copyValues(dst);
1310    if (identifier != null) {
1311      dst.identifier = new ArrayList<Identifier>();
1312      for (Identifier i : identifier)
1313        dst.identifier.add(i.copy());
1314    }
1315    ;
1316    dst.type = type == null ? null : type.copy();
1317    if (note != null) {
1318      dst.note = new ArrayList<Annotation>();
1319      for (Annotation i : note)
1320        dst.note.add(i.copy());
1321    }
1322    ;
1323    dst.status = status == null ? null : status.copy();
1324    dst.manufacturer = manufacturer == null ? null : manufacturer.copy();
1325    dst.model = model == null ? null : model.copy();
1326    dst.version = version == null ? null : version.copy();
1327    dst.manufactureDate = manufactureDate == null ? null : manufactureDate.copy();
1328    dst.expiry = expiry == null ? null : expiry.copy();
1329    dst.udi = udi == null ? null : udi.copy();
1330    dst.lotNumber = lotNumber == null ? null : lotNumber.copy();
1331    dst.owner = owner == null ? null : owner.copy();
1332    dst.location = location == null ? null : location.copy();
1333    dst.patient = patient == null ? null : patient.copy();
1334    if (contact != null) {
1335      dst.contact = new ArrayList<ContactPoint>();
1336      for (ContactPoint i : contact)
1337        dst.contact.add(i.copy());
1338    }
1339    ;
1340    dst.url = url == null ? null : url.copy();
1341    return dst;
1342  }
1343
1344  protected Device typedCopy() {
1345    return copy();
1346  }
1347
1348  @Override
1349  public boolean equalsDeep(Base other) {
1350    if (!super.equalsDeep(other))
1351      return false;
1352    if (!(other instanceof Device))
1353      return false;
1354    Device o = (Device) other;
1355    return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true)
1356        && compareDeep(note, o.note, true) && compareDeep(status, o.status, true)
1357        && compareDeep(manufacturer, o.manufacturer, true) && compareDeep(model, o.model, true)
1358        && compareDeep(version, o.version, true) && compareDeep(manufactureDate, o.manufactureDate, true)
1359        && compareDeep(expiry, o.expiry, true) && compareDeep(udi, o.udi, true)
1360        && compareDeep(lotNumber, o.lotNumber, true) && compareDeep(owner, o.owner, true)
1361        && compareDeep(location, o.location, true) && compareDeep(patient, o.patient, true)
1362        && compareDeep(contact, o.contact, true) && compareDeep(url, o.url, true);
1363  }
1364
1365  @Override
1366  public boolean equalsShallow(Base other) {
1367    if (!super.equalsShallow(other))
1368      return false;
1369    if (!(other instanceof Device))
1370      return false;
1371    Device o = (Device) other;
1372    return compareValues(status, o.status, true) && compareValues(manufacturer, o.manufacturer, true)
1373        && compareValues(model, o.model, true) && compareValues(version, o.version, true)
1374        && compareValues(manufactureDate, o.manufactureDate, true) && compareValues(expiry, o.expiry, true)
1375        && compareValues(udi, o.udi, true) && compareValues(lotNumber, o.lotNumber, true)
1376        && compareValues(url, o.url, true);
1377  }
1378
1379  public boolean isEmpty() {
1380    return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (type == null || type.isEmpty())
1381        && (note == null || note.isEmpty()) && (status == null || status.isEmpty())
1382        && (manufacturer == null || manufacturer.isEmpty()) && (model == null || model.isEmpty())
1383        && (version == null || version.isEmpty()) && (manufactureDate == null || manufactureDate.isEmpty())
1384        && (expiry == null || expiry.isEmpty()) && (udi == null || udi.isEmpty())
1385        && (lotNumber == null || lotNumber.isEmpty()) && (owner == null || owner.isEmpty())
1386        && (location == null || location.isEmpty()) && (patient == null || patient.isEmpty())
1387        && (contact == null || contact.isEmpty()) && (url == null || url.isEmpty());
1388  }
1389
1390  @Override
1391  public ResourceType getResourceType() {
1392    return ResourceType.Device;
1393  }
1394
1395  @SearchParamDefinition(name = "identifier", path = "Device.identifier", description = "Instance id from manufacturer, owner, and others", type = "token")
1396  public static final String SP_IDENTIFIER = "identifier";
1397  @SearchParamDefinition(name = "patient", path = "Device.patient", description = "Patient information, if the resource is affixed to a person", type = "reference")
1398  public static final String SP_PATIENT = "patient";
1399  @SearchParamDefinition(name = "organization", path = "Device.owner", description = "The organization responsible for the device", type = "reference")
1400  public static final String SP_ORGANIZATION = "organization";
1401  @SearchParamDefinition(name = "model", path = "Device.model", description = "The model of the device", type = "string")
1402  public static final String SP_MODEL = "model";
1403  @SearchParamDefinition(name = "location", path = "Device.location", description = "A location, where the resource is found", type = "reference")
1404  public static final String SP_LOCATION = "location";
1405  @SearchParamDefinition(name = "udi", path = "Device.udi", description = "FDA mandated Unique Device Identifier", type = "string")
1406  public static final String SP_UDI = "udi";
1407  @SearchParamDefinition(name = "type", path = "Device.type", description = "The type of the device", type = "token")
1408  public static final String SP_TYPE = "type";
1409  @SearchParamDefinition(name = "url", path = "Device.url", description = "Network address to contact device", type = "uri")
1410  public static final String SP_URL = "url";
1411  @SearchParamDefinition(name = "manufacturer", path = "Device.manufacturer", description = "The manufacturer of the device", type = "string")
1412  public static final String SP_MANUFACTURER = "manufacturer";
1413
1414}