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