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