001package org.hl7.fhir.r4.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 6, 2018 17:51-0400 for FHIR v3.4.0
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import ca.uhn.fhir.model.api.annotation.ResourceDef;
038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.ChildOrder;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.Block;
043import org.hl7.fhir.instance.model.api.*;
044import org.hl7.fhir.exceptions.FHIRException;
045/**
046 * 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 include 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.
047 */
048@ResourceDef(name="Device", profile="http://hl7.org/fhir/Profile/Device")
049public class Device extends DomainResource {
050
051    public enum UDIEntryType {
052        /**
053         * a barcodescanner captured the data from the device label
054         */
055        BARCODE, 
056        /**
057         * An RFID chip reader captured the data from the device label
058         */
059        RFID, 
060        /**
061         * The data was read from the label by a person and manually entered. (e.g.  via a keyboard)
062         */
063        MANUAL, 
064        /**
065         * The data originated from a patient's implant card and was read by an operator.
066         */
067        CARD, 
068        /**
069         * The data originated from a patient source and was not directly scanned or read from a label or card.
070         */
071        SELFREPORTED, 
072        /**
073         * The method of data capture has not been determined
074         */
075        UNKNOWN, 
076        /**
077         * added to help the parsers with the generic types
078         */
079        NULL;
080        public static UDIEntryType fromCode(String codeString) throws FHIRException {
081            if (codeString == null || "".equals(codeString))
082                return null;
083        if ("barcode".equals(codeString))
084          return BARCODE;
085        if ("rfid".equals(codeString))
086          return RFID;
087        if ("manual".equals(codeString))
088          return MANUAL;
089        if ("card".equals(codeString))
090          return CARD;
091        if ("self-reported".equals(codeString))
092          return SELFREPORTED;
093        if ("unknown".equals(codeString))
094          return UNKNOWN;
095        if (Configuration.isAcceptInvalidEnums())
096          return null;
097        else
098          throw new FHIRException("Unknown UDIEntryType code '"+codeString+"'");
099        }
100        public String toCode() {
101          switch (this) {
102            case BARCODE: return "barcode";
103            case RFID: return "rfid";
104            case MANUAL: return "manual";
105            case CARD: return "card";
106            case SELFREPORTED: return "self-reported";
107            case UNKNOWN: return "unknown";
108            default: return "?";
109          }
110        }
111        public String getSystem() {
112          switch (this) {
113            case BARCODE: return "http://hl7.org/fhir/udi-entry-type";
114            case RFID: return "http://hl7.org/fhir/udi-entry-type";
115            case MANUAL: return "http://hl7.org/fhir/udi-entry-type";
116            case CARD: return "http://hl7.org/fhir/udi-entry-type";
117            case SELFREPORTED: return "http://hl7.org/fhir/udi-entry-type";
118            case UNKNOWN: return "http://hl7.org/fhir/udi-entry-type";
119            default: return "?";
120          }
121        }
122        public String getDefinition() {
123          switch (this) {
124            case BARCODE: return "a barcodescanner captured the data from the device label";
125            case RFID: return "An RFID chip reader captured the data from the device label";
126            case MANUAL: return "The data was read from the label by a person and manually entered. (e.g.  via a keyboard)";
127            case CARD: return "The data originated from a patient's implant card and was read by an operator.";
128            case SELFREPORTED: return "The data originated from a patient source and was not directly scanned or read from a label or card.";
129            case UNKNOWN: return "The method of data capture has not been determined";
130            default: return "?";
131          }
132        }
133        public String getDisplay() {
134          switch (this) {
135            case BARCODE: return "Barcode";
136            case RFID: return "RFID";
137            case MANUAL: return "Manual";
138            case CARD: return "Card";
139            case SELFREPORTED: return "Self Reported";
140            case UNKNOWN: return "Unknown";
141            default: return "?";
142          }
143        }
144    }
145
146  public static class UDIEntryTypeEnumFactory implements EnumFactory<UDIEntryType> {
147    public UDIEntryType fromCode(String codeString) throws IllegalArgumentException {
148      if (codeString == null || "".equals(codeString))
149            if (codeString == null || "".equals(codeString))
150                return null;
151        if ("barcode".equals(codeString))
152          return UDIEntryType.BARCODE;
153        if ("rfid".equals(codeString))
154          return UDIEntryType.RFID;
155        if ("manual".equals(codeString))
156          return UDIEntryType.MANUAL;
157        if ("card".equals(codeString))
158          return UDIEntryType.CARD;
159        if ("self-reported".equals(codeString))
160          return UDIEntryType.SELFREPORTED;
161        if ("unknown".equals(codeString))
162          return UDIEntryType.UNKNOWN;
163        throw new IllegalArgumentException("Unknown UDIEntryType code '"+codeString+"'");
164        }
165        public Enumeration<UDIEntryType> fromType(Base code) throws FHIRException {
166          if (code == null)
167            return null;
168          if (code.isEmpty())
169            return new Enumeration<UDIEntryType>(this);
170          String codeString = ((PrimitiveType) code).asStringValue();
171          if (codeString == null || "".equals(codeString))
172            return null;
173        if ("barcode".equals(codeString))
174          return new Enumeration<UDIEntryType>(this, UDIEntryType.BARCODE);
175        if ("rfid".equals(codeString))
176          return new Enumeration<UDIEntryType>(this, UDIEntryType.RFID);
177        if ("manual".equals(codeString))
178          return new Enumeration<UDIEntryType>(this, UDIEntryType.MANUAL);
179        if ("card".equals(codeString))
180          return new Enumeration<UDIEntryType>(this, UDIEntryType.CARD);
181        if ("self-reported".equals(codeString))
182          return new Enumeration<UDIEntryType>(this, UDIEntryType.SELFREPORTED);
183        if ("unknown".equals(codeString))
184          return new Enumeration<UDIEntryType>(this, UDIEntryType.UNKNOWN);
185        throw new FHIRException("Unknown UDIEntryType code '"+codeString+"'");
186        }
187    public String toCode(UDIEntryType code) {
188      if (code == UDIEntryType.BARCODE)
189        return "barcode";
190      if (code == UDIEntryType.RFID)
191        return "rfid";
192      if (code == UDIEntryType.MANUAL)
193        return "manual";
194      if (code == UDIEntryType.CARD)
195        return "card";
196      if (code == UDIEntryType.SELFREPORTED)
197        return "self-reported";
198      if (code == UDIEntryType.UNKNOWN)
199        return "unknown";
200      return "?";
201      }
202    public String toSystem(UDIEntryType code) {
203      return code.getSystem();
204      }
205    }
206
207    public enum FHIRDeviceStatus {
208        /**
209         * The device is available for use.  Note: For *implanted devices*  this means that the device is implanted in the patient.
210         */
211        ACTIVE, 
212        /**
213         * The device is no longer available for use (e.g. lost, expired, damaged).  Note: For *implanted devices*  this means that the device has been removed from the patient.
214         */
215        INACTIVE, 
216        /**
217         * The device was entered in error and voided.
218         */
219        ENTEREDINERROR, 
220        /**
221         * The status of the device has not been determined.
222         */
223        UNKNOWN, 
224        /**
225         * added to help the parsers with the generic types
226         */
227        NULL;
228        public static FHIRDeviceStatus fromCode(String codeString) throws FHIRException {
229            if (codeString == null || "".equals(codeString))
230                return null;
231        if ("active".equals(codeString))
232          return ACTIVE;
233        if ("inactive".equals(codeString))
234          return INACTIVE;
235        if ("entered-in-error".equals(codeString))
236          return ENTEREDINERROR;
237        if ("unknown".equals(codeString))
238          return UNKNOWN;
239        if (Configuration.isAcceptInvalidEnums())
240          return null;
241        else
242          throw new FHIRException("Unknown FHIRDeviceStatus code '"+codeString+"'");
243        }
244        public String toCode() {
245          switch (this) {
246            case ACTIVE: return "active";
247            case INACTIVE: return "inactive";
248            case ENTEREDINERROR: return "entered-in-error";
249            case UNKNOWN: return "unknown";
250            default: return "?";
251          }
252        }
253        public String getSystem() {
254          switch (this) {
255            case ACTIVE: return "http://hl7.org/fhir/device-status";
256            case INACTIVE: return "http://hl7.org/fhir/device-status";
257            case ENTEREDINERROR: return "http://hl7.org/fhir/device-status";
258            case UNKNOWN: return "http://hl7.org/fhir/device-status";
259            default: return "?";
260          }
261        }
262        public String getDefinition() {
263          switch (this) {
264            case ACTIVE: return "The device is available for use.  Note: For *implanted devices*  this means that the device is implanted in the patient.";
265            case INACTIVE: return "The device is no longer available for use (e.g. lost, expired, damaged).  Note: For *implanted devices*  this means that the device has been removed from the patient.";
266            case ENTEREDINERROR: return "The device was entered in error and voided.";
267            case UNKNOWN: return "The status of the device has not been determined.";
268            default: return "?";
269          }
270        }
271        public String getDisplay() {
272          switch (this) {
273            case ACTIVE: return "Active";
274            case INACTIVE: return "Inactive";
275            case ENTEREDINERROR: return "Entered in Error";
276            case UNKNOWN: return "Unknown";
277            default: return "?";
278          }
279        }
280    }
281
282  public static class FHIRDeviceStatusEnumFactory implements EnumFactory<FHIRDeviceStatus> {
283    public FHIRDeviceStatus fromCode(String codeString) throws IllegalArgumentException {
284      if (codeString == null || "".equals(codeString))
285            if (codeString == null || "".equals(codeString))
286                return null;
287        if ("active".equals(codeString))
288          return FHIRDeviceStatus.ACTIVE;
289        if ("inactive".equals(codeString))
290          return FHIRDeviceStatus.INACTIVE;
291        if ("entered-in-error".equals(codeString))
292          return FHIRDeviceStatus.ENTEREDINERROR;
293        if ("unknown".equals(codeString))
294          return FHIRDeviceStatus.UNKNOWN;
295        throw new IllegalArgumentException("Unknown FHIRDeviceStatus code '"+codeString+"'");
296        }
297        public Enumeration<FHIRDeviceStatus> fromType(Base code) throws FHIRException {
298          if (code == null)
299            return null;
300          if (code.isEmpty())
301            return new Enumeration<FHIRDeviceStatus>(this);
302          String codeString = ((PrimitiveType) code).asStringValue();
303          if (codeString == null || "".equals(codeString))
304            return null;
305        if ("active".equals(codeString))
306          return new Enumeration<FHIRDeviceStatus>(this, FHIRDeviceStatus.ACTIVE);
307        if ("inactive".equals(codeString))
308          return new Enumeration<FHIRDeviceStatus>(this, FHIRDeviceStatus.INACTIVE);
309        if ("entered-in-error".equals(codeString))
310          return new Enumeration<FHIRDeviceStatus>(this, FHIRDeviceStatus.ENTEREDINERROR);
311        if ("unknown".equals(codeString))
312          return new Enumeration<FHIRDeviceStatus>(this, FHIRDeviceStatus.UNKNOWN);
313        throw new FHIRException("Unknown FHIRDeviceStatus code '"+codeString+"'");
314        }
315    public String toCode(FHIRDeviceStatus code) {
316      if (code == FHIRDeviceStatus.ACTIVE)
317        return "active";
318      if (code == FHIRDeviceStatus.INACTIVE)
319        return "inactive";
320      if (code == FHIRDeviceStatus.ENTEREDINERROR)
321        return "entered-in-error";
322      if (code == FHIRDeviceStatus.UNKNOWN)
323        return "unknown";
324      return "?";
325      }
326    public String toSystem(FHIRDeviceStatus code) {
327      return code.getSystem();
328      }
329    }
330
331    @Block()
332    public static class DeviceUdiComponent extends BackboneElement implements IBaseBackboneElement {
333        /**
334         * The device identifier (DI) is a mandatory, fixed portion of a UDI that identifies the labeler and the specific version or model of a device.
335         */
336        @Child(name = "deviceIdentifier", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
337        @Description(shortDefinition="Mandatory fixed portion of UDI", formalDefinition="The device identifier (DI) is a mandatory, fixed portion of a UDI that identifies the labeler and the specific version or model of a device." )
338        protected StringType deviceIdentifier;
339
340        /**
341         * Name of device as used in labeling or catalog.
342         */
343        @Child(name = "name", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
344        @Description(shortDefinition="Device Name as appears on UDI label", formalDefinition="Name of device as used in labeling or catalog." )
345        protected StringType name;
346
347        /**
348         * The identity of the authoritative source for UDI generation within a  jurisdiction.  All UDIs are globally unique within a single namespace with the appropriate repository uri as the system.  For example,  UDIs of devices managed in the U.S. by the FDA, the value is  http://hl7.org/fhir/NamingSystem/fda-udi.
349         */
350        @Child(name = "jurisdiction", type = {UriType.class}, order=3, min=0, max=1, modifier=false, summary=false)
351        @Description(shortDefinition="Regional UDI authority", formalDefinition="The identity of the authoritative source for UDI generation within a  jurisdiction.  All UDIs are globally unique within a single namespace with the appropriate repository uri as the system.  For example,  UDIs of devices managed in the U.S. by the FDA, the value is  http://hl7.org/fhir/NamingSystem/fda-udi." )
352        protected UriType jurisdiction;
353
354        /**
355         * The full UDI carrier as the human readable form (HRF) representation of the barcode string as printed on the packaging of the device.
356         */
357        @Child(name = "carrierHRF", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
358        @Description(shortDefinition="UDI Human Readable Barcode String", formalDefinition="The full UDI carrier as the human readable form (HRF) representation of the barcode string as printed on the packaging of the device." )
359        protected StringType carrierHRF;
360
361        /**
362         * The full UDI carrier of the Automatic Identification and Data Capture (AIDC) technology representation of the barcode string as printed on the packaging of the device - e.g., a barcode or RFID.   Because of limitations on character sets in XML and the need to round-trip JSON data through XML, AIDC Formats *SHALL* be base64 encoded.
363         */
364        @Child(name = "carrierAIDC", type = {Base64BinaryType.class}, order=5, min=0, max=1, modifier=false, summary=true)
365        @Description(shortDefinition="UDI Machine Readable Barcode String", formalDefinition="The full UDI carrier of the Automatic Identification and Data Capture (AIDC) technology representation of the barcode string as printed on the packaging of the device - e.g., a barcode or RFID.   Because of limitations on character sets in XML and the need to round-trip JSON data through XML, AIDC Formats *SHALL* be base64 encoded." )
366        protected Base64BinaryType carrierAIDC;
367
368        /**
369         * Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :
3701) GS1: 
371http://hl7.org/fhir/NamingSystem/gs1-di, 
3722) HIBCC:
373http://hl7.org/fhir/NamingSystem/hibcc-dI, 
3743) ICCBBA for blood containers:
375http://hl7.org/fhir/NamingSystem/iccbba-blood-di, 
3764) ICCBA for other devices:
377http://hl7.org/fhir/NamingSystem/iccbba-other-di.
378         */
379        @Child(name = "issuer", type = {UriType.class}, order=6, min=0, max=1, modifier=false, summary=false)
380        @Description(shortDefinition="UDI Issuing Organization", formalDefinition="Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :\n1) GS1: \nhttp://hl7.org/fhir/NamingSystem/gs1-di, \n2) HIBCC:\nhttp://hl7.org/fhir/NamingSystem/hibcc-dI, \n3) ICCBBA for blood containers:\nhttp://hl7.org/fhir/NamingSystem/iccbba-blood-di, \n4) ICCBA for other devices:\nhttp://hl7.org/fhir/NamingSystem/iccbba-other-di." )
381        protected UriType issuer;
382
383        /**
384         * A coded entry to indicate how the data was entered.
385         */
386        @Child(name = "entryType", type = {CodeType.class}, order=7, min=0, max=1, modifier=false, summary=false)
387        @Description(shortDefinition="barcode | rfid | manual +", formalDefinition="A coded entry to indicate how the data was entered." )
388        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/udi-entry-type")
389        protected Enumeration<UDIEntryType> entryType;
390
391        private static final long serialVersionUID = -1105798343L;
392
393    /**
394     * Constructor
395     */
396      public DeviceUdiComponent() {
397        super();
398      }
399
400        /**
401         * @return {@link #deviceIdentifier} (The device identifier (DI) is a mandatory, fixed portion of a UDI that identifies the labeler and the specific version or model of a device.). This is the underlying object with id, value and extensions. The accessor "getDeviceIdentifier" gives direct access to the value
402         */
403        public StringType getDeviceIdentifierElement() { 
404          if (this.deviceIdentifier == null)
405            if (Configuration.errorOnAutoCreate())
406              throw new Error("Attempt to auto-create DeviceUdiComponent.deviceIdentifier");
407            else if (Configuration.doAutoCreate())
408              this.deviceIdentifier = new StringType(); // bb
409          return this.deviceIdentifier;
410        }
411
412        public boolean hasDeviceIdentifierElement() { 
413          return this.deviceIdentifier != null && !this.deviceIdentifier.isEmpty();
414        }
415
416        public boolean hasDeviceIdentifier() { 
417          return this.deviceIdentifier != null && !this.deviceIdentifier.isEmpty();
418        }
419
420        /**
421         * @param value {@link #deviceIdentifier} (The device identifier (DI) is a mandatory, fixed portion of a UDI that identifies the labeler and the specific version or model of a device.). This is the underlying object with id, value and extensions. The accessor "getDeviceIdentifier" gives direct access to the value
422         */
423        public DeviceUdiComponent setDeviceIdentifierElement(StringType value) { 
424          this.deviceIdentifier = value;
425          return this;
426        }
427
428        /**
429         * @return The device identifier (DI) is a mandatory, fixed portion of a UDI that identifies the labeler and the specific version or model of a device.
430         */
431        public String getDeviceIdentifier() { 
432          return this.deviceIdentifier == null ? null : this.deviceIdentifier.getValue();
433        }
434
435        /**
436         * @param value The device identifier (DI) is a mandatory, fixed portion of a UDI that identifies the labeler and the specific version or model of a device.
437         */
438        public DeviceUdiComponent setDeviceIdentifier(String value) { 
439          if (Utilities.noString(value))
440            this.deviceIdentifier = null;
441          else {
442            if (this.deviceIdentifier == null)
443              this.deviceIdentifier = new StringType();
444            this.deviceIdentifier.setValue(value);
445          }
446          return this;
447        }
448
449        /**
450         * @return {@link #name} (Name of device as used in labeling or catalog.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
451         */
452        public StringType getNameElement() { 
453          if (this.name == null)
454            if (Configuration.errorOnAutoCreate())
455              throw new Error("Attempt to auto-create DeviceUdiComponent.name");
456            else if (Configuration.doAutoCreate())
457              this.name = new StringType(); // bb
458          return this.name;
459        }
460
461        public boolean hasNameElement() { 
462          return this.name != null && !this.name.isEmpty();
463        }
464
465        public boolean hasName() { 
466          return this.name != null && !this.name.isEmpty();
467        }
468
469        /**
470         * @param value {@link #name} (Name of device as used in labeling or catalog.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
471         */
472        public DeviceUdiComponent setNameElement(StringType value) { 
473          this.name = value;
474          return this;
475        }
476
477        /**
478         * @return Name of device as used in labeling or catalog.
479         */
480        public String getName() { 
481          return this.name == null ? null : this.name.getValue();
482        }
483
484        /**
485         * @param value Name of device as used in labeling or catalog.
486         */
487        public DeviceUdiComponent setName(String value) { 
488          if (Utilities.noString(value))
489            this.name = null;
490          else {
491            if (this.name == null)
492              this.name = new StringType();
493            this.name.setValue(value);
494          }
495          return this;
496        }
497
498        /**
499         * @return {@link #jurisdiction} (The identity of the authoritative source for UDI generation within a  jurisdiction.  All UDIs are globally unique within a single namespace with the appropriate repository uri as the system.  For example,  UDIs of devices managed in the U.S. by the FDA, the value is  http://hl7.org/fhir/NamingSystem/fda-udi.). This is the underlying object with id, value and extensions. The accessor "getJurisdiction" gives direct access to the value
500         */
501        public UriType getJurisdictionElement() { 
502          if (this.jurisdiction == null)
503            if (Configuration.errorOnAutoCreate())
504              throw new Error("Attempt to auto-create DeviceUdiComponent.jurisdiction");
505            else if (Configuration.doAutoCreate())
506              this.jurisdiction = new UriType(); // bb
507          return this.jurisdiction;
508        }
509
510        public boolean hasJurisdictionElement() { 
511          return this.jurisdiction != null && !this.jurisdiction.isEmpty();
512        }
513
514        public boolean hasJurisdiction() { 
515          return this.jurisdiction != null && !this.jurisdiction.isEmpty();
516        }
517
518        /**
519         * @param value {@link #jurisdiction} (The identity of the authoritative source for UDI generation within a  jurisdiction.  All UDIs are globally unique within a single namespace with the appropriate repository uri as the system.  For example,  UDIs of devices managed in the U.S. by the FDA, the value is  http://hl7.org/fhir/NamingSystem/fda-udi.). This is the underlying object with id, value and extensions. The accessor "getJurisdiction" gives direct access to the value
520         */
521        public DeviceUdiComponent setJurisdictionElement(UriType value) { 
522          this.jurisdiction = value;
523          return this;
524        }
525
526        /**
527         * @return The identity of the authoritative source for UDI generation within a  jurisdiction.  All UDIs are globally unique within a single namespace with the appropriate repository uri as the system.  For example,  UDIs of devices managed in the U.S. by the FDA, the value is  http://hl7.org/fhir/NamingSystem/fda-udi.
528         */
529        public String getJurisdiction() { 
530          return this.jurisdiction == null ? null : this.jurisdiction.getValue();
531        }
532
533        /**
534         * @param value The identity of the authoritative source for UDI generation within a  jurisdiction.  All UDIs are globally unique within a single namespace with the appropriate repository uri as the system.  For example,  UDIs of devices managed in the U.S. by the FDA, the value is  http://hl7.org/fhir/NamingSystem/fda-udi.
535         */
536        public DeviceUdiComponent setJurisdiction(String value) { 
537          if (Utilities.noString(value))
538            this.jurisdiction = null;
539          else {
540            if (this.jurisdiction == null)
541              this.jurisdiction = new UriType();
542            this.jurisdiction.setValue(value);
543          }
544          return this;
545        }
546
547        /**
548         * @return {@link #carrierHRF} (The full UDI carrier as the human readable form (HRF) representation of the barcode string as printed on the packaging of the device.). This is the underlying object with id, value and extensions. The accessor "getCarrierHRF" gives direct access to the value
549         */
550        public StringType getCarrierHRFElement() { 
551          if (this.carrierHRF == null)
552            if (Configuration.errorOnAutoCreate())
553              throw new Error("Attempt to auto-create DeviceUdiComponent.carrierHRF");
554            else if (Configuration.doAutoCreate())
555              this.carrierHRF = new StringType(); // bb
556          return this.carrierHRF;
557        }
558
559        public boolean hasCarrierHRFElement() { 
560          return this.carrierHRF != null && !this.carrierHRF.isEmpty();
561        }
562
563        public boolean hasCarrierHRF() { 
564          return this.carrierHRF != null && !this.carrierHRF.isEmpty();
565        }
566
567        /**
568         * @param value {@link #carrierHRF} (The full UDI carrier as the human readable form (HRF) representation of the barcode string as printed on the packaging of the device.). This is the underlying object with id, value and extensions. The accessor "getCarrierHRF" gives direct access to the value
569         */
570        public DeviceUdiComponent setCarrierHRFElement(StringType value) { 
571          this.carrierHRF = value;
572          return this;
573        }
574
575        /**
576         * @return The full UDI carrier as the human readable form (HRF) representation of the barcode string as printed on the packaging of the device.
577         */
578        public String getCarrierHRF() { 
579          return this.carrierHRF == null ? null : this.carrierHRF.getValue();
580        }
581
582        /**
583         * @param value The full UDI carrier as the human readable form (HRF) representation of the barcode string as printed on the packaging of the device.
584         */
585        public DeviceUdiComponent setCarrierHRF(String value) { 
586          if (Utilities.noString(value))
587            this.carrierHRF = null;
588          else {
589            if (this.carrierHRF == null)
590              this.carrierHRF = new StringType();
591            this.carrierHRF.setValue(value);
592          }
593          return this;
594        }
595
596        /**
597         * @return {@link #carrierAIDC} (The full UDI carrier of the Automatic Identification and Data Capture (AIDC) technology representation of the barcode string as printed on the packaging of the device - e.g., a barcode or RFID.   Because of limitations on character sets in XML and the need to round-trip JSON data through XML, AIDC Formats *SHALL* be base64 encoded.). This is the underlying object with id, value and extensions. The accessor "getCarrierAIDC" gives direct access to the value
598         */
599        public Base64BinaryType getCarrierAIDCElement() { 
600          if (this.carrierAIDC == null)
601            if (Configuration.errorOnAutoCreate())
602              throw new Error("Attempt to auto-create DeviceUdiComponent.carrierAIDC");
603            else if (Configuration.doAutoCreate())
604              this.carrierAIDC = new Base64BinaryType(); // bb
605          return this.carrierAIDC;
606        }
607
608        public boolean hasCarrierAIDCElement() { 
609          return this.carrierAIDC != null && !this.carrierAIDC.isEmpty();
610        }
611
612        public boolean hasCarrierAIDC() { 
613          return this.carrierAIDC != null && !this.carrierAIDC.isEmpty();
614        }
615
616        /**
617         * @param value {@link #carrierAIDC} (The full UDI carrier of the Automatic Identification and Data Capture (AIDC) technology representation of the barcode string as printed on the packaging of the device - e.g., a barcode or RFID.   Because of limitations on character sets in XML and the need to round-trip JSON data through XML, AIDC Formats *SHALL* be base64 encoded.). This is the underlying object with id, value and extensions. The accessor "getCarrierAIDC" gives direct access to the value
618         */
619        public DeviceUdiComponent setCarrierAIDCElement(Base64BinaryType value) { 
620          this.carrierAIDC = value;
621          return this;
622        }
623
624        /**
625         * @return The full UDI carrier of the Automatic Identification and Data Capture (AIDC) technology representation of the barcode string as printed on the packaging of the device - e.g., a barcode or RFID.   Because of limitations on character sets in XML and the need to round-trip JSON data through XML, AIDC Formats *SHALL* be base64 encoded.
626         */
627        public byte[] getCarrierAIDC() { 
628          return this.carrierAIDC == null ? null : this.carrierAIDC.getValue();
629        }
630
631        /**
632         * @param value The full UDI carrier of the Automatic Identification and Data Capture (AIDC) technology representation of the barcode string as printed on the packaging of the device - e.g., a barcode or RFID.   Because of limitations on character sets in XML and the need to round-trip JSON data through XML, AIDC Formats *SHALL* be base64 encoded.
633         */
634        public DeviceUdiComponent setCarrierAIDC(byte[] value) { 
635          if (value == null)
636            this.carrierAIDC = null;
637          else {
638            if (this.carrierAIDC == null)
639              this.carrierAIDC = new Base64BinaryType();
640            this.carrierAIDC.setValue(value);
641          }
642          return this;
643        }
644
645        /**
646         * @return {@link #issuer} (Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :
6471) GS1: 
648http://hl7.org/fhir/NamingSystem/gs1-di, 
6492) HIBCC:
650http://hl7.org/fhir/NamingSystem/hibcc-dI, 
6513) ICCBBA for blood containers:
652http://hl7.org/fhir/NamingSystem/iccbba-blood-di, 
6534) ICCBA for other devices:
654http://hl7.org/fhir/NamingSystem/iccbba-other-di.). This is the underlying object with id, value and extensions. The accessor "getIssuer" gives direct access to the value
655         */
656        public UriType getIssuerElement() { 
657          if (this.issuer == null)
658            if (Configuration.errorOnAutoCreate())
659              throw new Error("Attempt to auto-create DeviceUdiComponent.issuer");
660            else if (Configuration.doAutoCreate())
661              this.issuer = new UriType(); // bb
662          return this.issuer;
663        }
664
665        public boolean hasIssuerElement() { 
666          return this.issuer != null && !this.issuer.isEmpty();
667        }
668
669        public boolean hasIssuer() { 
670          return this.issuer != null && !this.issuer.isEmpty();
671        }
672
673        /**
674         * @param value {@link #issuer} (Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :
6751) GS1: 
676http://hl7.org/fhir/NamingSystem/gs1-di, 
6772) HIBCC:
678http://hl7.org/fhir/NamingSystem/hibcc-dI, 
6793) ICCBBA for blood containers:
680http://hl7.org/fhir/NamingSystem/iccbba-blood-di, 
6814) ICCBA for other devices:
682http://hl7.org/fhir/NamingSystem/iccbba-other-di.). This is the underlying object with id, value and extensions. The accessor "getIssuer" gives direct access to the value
683         */
684        public DeviceUdiComponent setIssuerElement(UriType value) { 
685          this.issuer = value;
686          return this;
687        }
688
689        /**
690         * @return Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :
6911) GS1: 
692http://hl7.org/fhir/NamingSystem/gs1-di, 
6932) HIBCC:
694http://hl7.org/fhir/NamingSystem/hibcc-dI, 
6953) ICCBBA for blood containers:
696http://hl7.org/fhir/NamingSystem/iccbba-blood-di, 
6974) ICCBA for other devices:
698http://hl7.org/fhir/NamingSystem/iccbba-other-di.
699         */
700        public String getIssuer() { 
701          return this.issuer == null ? null : this.issuer.getValue();
702        }
703
704        /**
705         * @param value Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :
7061) GS1: 
707http://hl7.org/fhir/NamingSystem/gs1-di, 
7082) HIBCC:
709http://hl7.org/fhir/NamingSystem/hibcc-dI, 
7103) ICCBBA for blood containers:
711http://hl7.org/fhir/NamingSystem/iccbba-blood-di, 
7124) ICCBA for other devices:
713http://hl7.org/fhir/NamingSystem/iccbba-other-di.
714         */
715        public DeviceUdiComponent setIssuer(String value) { 
716          if (Utilities.noString(value))
717            this.issuer = null;
718          else {
719            if (this.issuer == null)
720              this.issuer = new UriType();
721            this.issuer.setValue(value);
722          }
723          return this;
724        }
725
726        /**
727         * @return {@link #entryType} (A coded entry to indicate how the data was entered.). This is the underlying object with id, value and extensions. The accessor "getEntryType" gives direct access to the value
728         */
729        public Enumeration<UDIEntryType> getEntryTypeElement() { 
730          if (this.entryType == null)
731            if (Configuration.errorOnAutoCreate())
732              throw new Error("Attempt to auto-create DeviceUdiComponent.entryType");
733            else if (Configuration.doAutoCreate())
734              this.entryType = new Enumeration<UDIEntryType>(new UDIEntryTypeEnumFactory()); // bb
735          return this.entryType;
736        }
737
738        public boolean hasEntryTypeElement() { 
739          return this.entryType != null && !this.entryType.isEmpty();
740        }
741
742        public boolean hasEntryType() { 
743          return this.entryType != null && !this.entryType.isEmpty();
744        }
745
746        /**
747         * @param value {@link #entryType} (A coded entry to indicate how the data was entered.). This is the underlying object with id, value and extensions. The accessor "getEntryType" gives direct access to the value
748         */
749        public DeviceUdiComponent setEntryTypeElement(Enumeration<UDIEntryType> value) { 
750          this.entryType = value;
751          return this;
752        }
753
754        /**
755         * @return A coded entry to indicate how the data was entered.
756         */
757        public UDIEntryType getEntryType() { 
758          return this.entryType == null ? null : this.entryType.getValue();
759        }
760
761        /**
762         * @param value A coded entry to indicate how the data was entered.
763         */
764        public DeviceUdiComponent setEntryType(UDIEntryType value) { 
765          if (value == null)
766            this.entryType = null;
767          else {
768            if (this.entryType == null)
769              this.entryType = new Enumeration<UDIEntryType>(new UDIEntryTypeEnumFactory());
770            this.entryType.setValue(value);
771          }
772          return this;
773        }
774
775        protected void listChildren(List<Property> children) {
776          super.listChildren(children);
777          children.add(new Property("deviceIdentifier", "string", "The device identifier (DI) is a mandatory, fixed portion of a UDI that identifies the labeler and the specific version or model of a device.", 0, 1, deviceIdentifier));
778          children.add(new Property("name", "string", "Name of device as used in labeling or catalog.", 0, 1, name));
779          children.add(new Property("jurisdiction", "uri", "The identity of the authoritative source for UDI generation within a  jurisdiction.  All UDIs are globally unique within a single namespace with the appropriate repository uri as the system.  For example,  UDIs of devices managed in the U.S. by the FDA, the value is  http://hl7.org/fhir/NamingSystem/fda-udi.", 0, 1, jurisdiction));
780          children.add(new Property("carrierHRF", "string", "The full UDI carrier as the human readable form (HRF) representation of the barcode string as printed on the packaging of the device.", 0, 1, carrierHRF));
781          children.add(new Property("carrierAIDC", "base64Binary", "The full UDI carrier of the Automatic Identification and Data Capture (AIDC) technology representation of the barcode string as printed on the packaging of the device - e.g., a barcode or RFID.   Because of limitations on character sets in XML and the need to round-trip JSON data through XML, AIDC Formats *SHALL* be base64 encoded.", 0, 1, carrierAIDC));
782          children.add(new Property("issuer", "uri", "Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :\n1) GS1: \nhttp://hl7.org/fhir/NamingSystem/gs1-di, \n2) HIBCC:\nhttp://hl7.org/fhir/NamingSystem/hibcc-dI, \n3) ICCBBA for blood containers:\nhttp://hl7.org/fhir/NamingSystem/iccbba-blood-di, \n4) ICCBA for other devices:\nhttp://hl7.org/fhir/NamingSystem/iccbba-other-di.", 0, 1, issuer));
783          children.add(new Property("entryType", "code", "A coded entry to indicate how the data was entered.", 0, 1, entryType));
784        }
785
786        @Override
787        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
788          switch (_hash) {
789          case 1322005407: /*deviceIdentifier*/  return new Property("deviceIdentifier", "string", "The device identifier (DI) is a mandatory, fixed portion of a UDI that identifies the labeler and the specific version or model of a device.", 0, 1, deviceIdentifier);
790          case 3373707: /*name*/  return new Property("name", "string", "Name of device as used in labeling or catalog.", 0, 1, name);
791          case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "uri", "The identity of the authoritative source for UDI generation within a  jurisdiction.  All UDIs are globally unique within a single namespace with the appropriate repository uri as the system.  For example,  UDIs of devices managed in the U.S. by the FDA, the value is  http://hl7.org/fhir/NamingSystem/fda-udi.", 0, 1, jurisdiction);
792          case 806499972: /*carrierHRF*/  return new Property("carrierHRF", "string", "The full UDI carrier as the human readable form (HRF) representation of the barcode string as printed on the packaging of the device.", 0, 1, carrierHRF);
793          case -768521825: /*carrierAIDC*/  return new Property("carrierAIDC", "base64Binary", "The full UDI carrier of the Automatic Identification and Data Capture (AIDC) technology representation of the barcode string as printed on the packaging of the device - e.g., a barcode or RFID.   Because of limitations on character sets in XML and the need to round-trip JSON data through XML, AIDC Formats *SHALL* be base64 encoded.", 0, 1, carrierAIDC);
794          case -1179159879: /*issuer*/  return new Property("issuer", "uri", "Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :\n1) GS1: \nhttp://hl7.org/fhir/NamingSystem/gs1-di, \n2) HIBCC:\nhttp://hl7.org/fhir/NamingSystem/hibcc-dI, \n3) ICCBBA for blood containers:\nhttp://hl7.org/fhir/NamingSystem/iccbba-blood-di, \n4) ICCBA for other devices:\nhttp://hl7.org/fhir/NamingSystem/iccbba-other-di.", 0, 1, issuer);
795          case -479362356: /*entryType*/  return new Property("entryType", "code", "A coded entry to indicate how the data was entered.", 0, 1, entryType);
796          default: return super.getNamedProperty(_hash, _name, _checkValid);
797          }
798
799        }
800
801      @Override
802      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
803        switch (hash) {
804        case 1322005407: /*deviceIdentifier*/ return this.deviceIdentifier == null ? new Base[0] : new Base[] {this.deviceIdentifier}; // StringType
805        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
806        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : new Base[] {this.jurisdiction}; // UriType
807        case 806499972: /*carrierHRF*/ return this.carrierHRF == null ? new Base[0] : new Base[] {this.carrierHRF}; // StringType
808        case -768521825: /*carrierAIDC*/ return this.carrierAIDC == null ? new Base[0] : new Base[] {this.carrierAIDC}; // Base64BinaryType
809        case -1179159879: /*issuer*/ return this.issuer == null ? new Base[0] : new Base[] {this.issuer}; // UriType
810        case -479362356: /*entryType*/ return this.entryType == null ? new Base[0] : new Base[] {this.entryType}; // Enumeration<UDIEntryType>
811        default: return super.getProperty(hash, name, checkValid);
812        }
813
814      }
815
816      @Override
817      public Base setProperty(int hash, String name, Base value) throws FHIRException {
818        switch (hash) {
819        case 1322005407: // deviceIdentifier
820          this.deviceIdentifier = castToString(value); // StringType
821          return value;
822        case 3373707: // name
823          this.name = castToString(value); // StringType
824          return value;
825        case -507075711: // jurisdiction
826          this.jurisdiction = castToUri(value); // UriType
827          return value;
828        case 806499972: // carrierHRF
829          this.carrierHRF = castToString(value); // StringType
830          return value;
831        case -768521825: // carrierAIDC
832          this.carrierAIDC = castToBase64Binary(value); // Base64BinaryType
833          return value;
834        case -1179159879: // issuer
835          this.issuer = castToUri(value); // UriType
836          return value;
837        case -479362356: // entryType
838          value = new UDIEntryTypeEnumFactory().fromType(castToCode(value));
839          this.entryType = (Enumeration) value; // Enumeration<UDIEntryType>
840          return value;
841        default: return super.setProperty(hash, name, value);
842        }
843
844      }
845
846      @Override
847      public Base setProperty(String name, Base value) throws FHIRException {
848        if (name.equals("deviceIdentifier")) {
849          this.deviceIdentifier = castToString(value); // StringType
850        } else if (name.equals("name")) {
851          this.name = castToString(value); // StringType
852        } else if (name.equals("jurisdiction")) {
853          this.jurisdiction = castToUri(value); // UriType
854        } else if (name.equals("carrierHRF")) {
855          this.carrierHRF = castToString(value); // StringType
856        } else if (name.equals("carrierAIDC")) {
857          this.carrierAIDC = castToBase64Binary(value); // Base64BinaryType
858        } else if (name.equals("issuer")) {
859          this.issuer = castToUri(value); // UriType
860        } else if (name.equals("entryType")) {
861          value = new UDIEntryTypeEnumFactory().fromType(castToCode(value));
862          this.entryType = (Enumeration) value; // Enumeration<UDIEntryType>
863        } else
864          return super.setProperty(name, value);
865        return value;
866      }
867
868      @Override
869      public Base makeProperty(int hash, String name) throws FHIRException {
870        switch (hash) {
871        case 1322005407:  return getDeviceIdentifierElement();
872        case 3373707:  return getNameElement();
873        case -507075711:  return getJurisdictionElement();
874        case 806499972:  return getCarrierHRFElement();
875        case -768521825:  return getCarrierAIDCElement();
876        case -1179159879:  return getIssuerElement();
877        case -479362356:  return getEntryTypeElement();
878        default: return super.makeProperty(hash, name);
879        }
880
881      }
882
883      @Override
884      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
885        switch (hash) {
886        case 1322005407: /*deviceIdentifier*/ return new String[] {"string"};
887        case 3373707: /*name*/ return new String[] {"string"};
888        case -507075711: /*jurisdiction*/ return new String[] {"uri"};
889        case 806499972: /*carrierHRF*/ return new String[] {"string"};
890        case -768521825: /*carrierAIDC*/ return new String[] {"base64Binary"};
891        case -1179159879: /*issuer*/ return new String[] {"uri"};
892        case -479362356: /*entryType*/ return new String[] {"code"};
893        default: return super.getTypesForProperty(hash, name);
894        }
895
896      }
897
898      @Override
899      public Base addChild(String name) throws FHIRException {
900        if (name.equals("deviceIdentifier")) {
901          throw new FHIRException("Cannot call addChild on a primitive type Device.deviceIdentifier");
902        }
903        else if (name.equals("name")) {
904          throw new FHIRException("Cannot call addChild on a primitive type Device.name");
905        }
906        else if (name.equals("jurisdiction")) {
907          throw new FHIRException("Cannot call addChild on a primitive type Device.jurisdiction");
908        }
909        else if (name.equals("carrierHRF")) {
910          throw new FHIRException("Cannot call addChild on a primitive type Device.carrierHRF");
911        }
912        else if (name.equals("carrierAIDC")) {
913          throw new FHIRException("Cannot call addChild on a primitive type Device.carrierAIDC");
914        }
915        else if (name.equals("issuer")) {
916          throw new FHIRException("Cannot call addChild on a primitive type Device.issuer");
917        }
918        else if (name.equals("entryType")) {
919          throw new FHIRException("Cannot call addChild on a primitive type Device.entryType");
920        }
921        else
922          return super.addChild(name);
923      }
924
925      public DeviceUdiComponent copy() {
926        DeviceUdiComponent dst = new DeviceUdiComponent();
927        copyValues(dst);
928        dst.deviceIdentifier = deviceIdentifier == null ? null : deviceIdentifier.copy();
929        dst.name = name == null ? null : name.copy();
930        dst.jurisdiction = jurisdiction == null ? null : jurisdiction.copy();
931        dst.carrierHRF = carrierHRF == null ? null : carrierHRF.copy();
932        dst.carrierAIDC = carrierAIDC == null ? null : carrierAIDC.copy();
933        dst.issuer = issuer == null ? null : issuer.copy();
934        dst.entryType = entryType == null ? null : entryType.copy();
935        return dst;
936      }
937
938      @Override
939      public boolean equalsDeep(Base other_) {
940        if (!super.equalsDeep(other_))
941          return false;
942        if (!(other_ instanceof DeviceUdiComponent))
943          return false;
944        DeviceUdiComponent o = (DeviceUdiComponent) other_;
945        return compareDeep(deviceIdentifier, o.deviceIdentifier, true) && compareDeep(name, o.name, true)
946           && compareDeep(jurisdiction, o.jurisdiction, true) && compareDeep(carrierHRF, o.carrierHRF, true)
947           && compareDeep(carrierAIDC, o.carrierAIDC, true) && compareDeep(issuer, o.issuer, true) && compareDeep(entryType, o.entryType, true)
948          ;
949      }
950
951      @Override
952      public boolean equalsShallow(Base other_) {
953        if (!super.equalsShallow(other_))
954          return false;
955        if (!(other_ instanceof DeviceUdiComponent))
956          return false;
957        DeviceUdiComponent o = (DeviceUdiComponent) other_;
958        return compareValues(deviceIdentifier, o.deviceIdentifier, true) && compareValues(name, o.name, true)
959           && compareValues(jurisdiction, o.jurisdiction, true) && compareValues(carrierHRF, o.carrierHRF, true)
960           && compareValues(carrierAIDC, o.carrierAIDC, true) && compareValues(issuer, o.issuer, true) && compareValues(entryType, o.entryType, true)
961          ;
962      }
963
964      public boolean isEmpty() {
965        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(deviceIdentifier, name, jurisdiction
966          , carrierHRF, carrierAIDC, issuer, entryType);
967      }
968
969  public String fhirType() {
970    return "Device.udi";
971
972  }
973
974  }
975
976    /**
977     * Unique instance identifiers assigned to a device by manufacturers other organizations or owners.
978     */
979    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
980    @Description(shortDefinition="Instance identifier", formalDefinition="Unique instance identifiers assigned to a device by manufacturers other organizations or owners." )
981    protected List<Identifier> identifier;
982
983    /**
984     * [Unique device identifier (UDI)](device.html#udi) assigned to device label or package.
985     */
986    @Child(name = "udi", type = {}, order=1, min=0, max=1, modifier=false, summary=true)
987    @Description(shortDefinition="Unique Device Identifier (UDI) Barcode string", formalDefinition="[Unique device identifier (UDI)](device.html#udi) assigned to device label or package." )
988    protected DeviceUdiComponent udi;
989
990    /**
991     * Status of the Device availability.
992     */
993    @Child(name = "status", type = {CodeType.class}, order=2, min=0, max=1, modifier=true, summary=true)
994    @Description(shortDefinition="active | inactive | entered-in-error | unknown", formalDefinition="Status of the Device availability." )
995    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-status")
996    protected Enumeration<FHIRDeviceStatus> status;
997
998    /**
999     * Code or identifier to identify a kind of device.
1000     */
1001    @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
1002    @Description(shortDefinition="What kind of device this is", formalDefinition="Code or identifier to identify a kind of device." )
1003    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-kind")
1004    protected CodeableConcept type;
1005
1006    /**
1007     * Lot number assigned by the manufacturer.
1008     */
1009    @Child(name = "lotNumber", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
1010    @Description(shortDefinition="Lot number of manufacture", formalDefinition="Lot number assigned by the manufacturer." )
1011    protected StringType lotNumber;
1012
1013    /**
1014     * A name of the manufacturer.
1015     */
1016    @Child(name = "manufacturer", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
1017    @Description(shortDefinition="Name of device manufacturer", formalDefinition="A name of the manufacturer." )
1018    protected StringType manufacturer;
1019
1020    /**
1021     * The date and time when the device was manufactured.
1022     */
1023    @Child(name = "manufactureDate", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=false)
1024    @Description(shortDefinition="Date when the device was made", formalDefinition="The date and time when the device was manufactured." )
1025    protected DateTimeType manufactureDate;
1026
1027    /**
1028     * The date and time beyond which this device is no longer valid or should not be used (if applicable).
1029     */
1030    @Child(name = "expirationDate", type = {DateTimeType.class}, order=7, min=0, max=1, modifier=false, summary=false)
1031    @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)." )
1032    protected DateTimeType expirationDate;
1033
1034    /**
1035     * 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.
1036     */
1037    @Child(name = "model", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=false)
1038    @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." )
1039    protected StringType model;
1040
1041    /**
1042     * The version of the device, if the device has multiple releases under the same model, or if the device is software or carries firmware.
1043     */
1044    @Child(name = "version", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=false)
1045    @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." )
1046    protected StringType version;
1047
1048    /**
1049     * Patient information, If the device is affixed to a person.
1050     */
1051    @Child(name = "patient", type = {Patient.class}, order=10, min=0, max=1, modifier=false, summary=false)
1052    @Description(shortDefinition="Patient to whom Device is affixed", formalDefinition="Patient information, If the device is affixed to a person." )
1053    protected Reference patient;
1054
1055    /**
1056     * The actual object that is the target of the reference (Patient information, If the device is affixed to a person.)
1057     */
1058    protected Patient patientTarget;
1059
1060    /**
1061     * An organization that is responsible for the provision and ongoing maintenance of the device.
1062     */
1063    @Child(name = "owner", type = {Organization.class}, order=11, min=0, max=1, modifier=false, summary=false)
1064    @Description(shortDefinition="Organization responsible for device", formalDefinition="An organization that is responsible for the provision and ongoing maintenance of the device." )
1065    protected Reference owner;
1066
1067    /**
1068     * The actual object that is the target of the reference (An organization that is responsible for the provision and ongoing maintenance of the device.)
1069     */
1070    protected Organization ownerTarget;
1071
1072    /**
1073     * Contact details for an organization or a particular human that is responsible for the device.
1074     */
1075    @Child(name = "contact", type = {ContactPoint.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1076    @Description(shortDefinition="Details for human/organization for support", formalDefinition="Contact details for an organization or a particular human that is responsible for the device." )
1077    protected List<ContactPoint> contact;
1078
1079    /**
1080     * The place where the device can be found.
1081     */
1082    @Child(name = "location", type = {Location.class}, order=13, min=0, max=1, modifier=false, summary=false)
1083    @Description(shortDefinition="Where the resource is found", formalDefinition="The place where the device can be found." )
1084    protected Reference location;
1085
1086    /**
1087     * The actual object that is the target of the reference (The place where the device can be found.)
1088     */
1089    protected Location locationTarget;
1090
1091    /**
1092     * A network address on which the device may be contacted directly.
1093     */
1094    @Child(name = "url", type = {UriType.class}, order=14, min=0, max=1, modifier=false, summary=false)
1095    @Description(shortDefinition="Network address to contact device", formalDefinition="A network address on which the device may be contacted directly." )
1096    protected UriType url;
1097
1098    /**
1099     * Descriptive information, usage information or implantation information that is not captured in an existing element.
1100     */
1101    @Child(name = "note", type = {Annotation.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1102    @Description(shortDefinition="Device notes and comments", formalDefinition="Descriptive information, usage information or implantation information that is not captured in an existing element." )
1103    protected List<Annotation> note;
1104
1105    /**
1106     * Provides additional safety characteristics about a medical device.  For example devices containing latex.
1107     */
1108    @Child(name = "safety", type = {CodeableConcept.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1109    @Description(shortDefinition="Safety Characteristics of Device", formalDefinition="Provides additional safety characteristics about a medical device.  For example devices containing latex." )
1110    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-safety")
1111    protected List<CodeableConcept> safety;
1112
1113    private static final long serialVersionUID = -1056263930L;
1114
1115  /**
1116   * Constructor
1117   */
1118    public Device() {
1119      super();
1120    }
1121
1122    /**
1123     * @return {@link #identifier} (Unique instance identifiers assigned to a device by manufacturers other organizations or owners.)
1124     */
1125    public List<Identifier> getIdentifier() { 
1126      if (this.identifier == null)
1127        this.identifier = new ArrayList<Identifier>();
1128      return this.identifier;
1129    }
1130
1131    /**
1132     * @return Returns a reference to <code>this</code> for easy method chaining
1133     */
1134    public Device setIdentifier(List<Identifier> theIdentifier) { 
1135      this.identifier = theIdentifier;
1136      return this;
1137    }
1138
1139    public boolean hasIdentifier() { 
1140      if (this.identifier == null)
1141        return false;
1142      for (Identifier item : this.identifier)
1143        if (!item.isEmpty())
1144          return true;
1145      return false;
1146    }
1147
1148    public Identifier addIdentifier() { //3
1149      Identifier t = new Identifier();
1150      if (this.identifier == null)
1151        this.identifier = new ArrayList<Identifier>();
1152      this.identifier.add(t);
1153      return t;
1154    }
1155
1156    public Device addIdentifier(Identifier t) { //3
1157      if (t == null)
1158        return this;
1159      if (this.identifier == null)
1160        this.identifier = new ArrayList<Identifier>();
1161      this.identifier.add(t);
1162      return this;
1163    }
1164
1165    /**
1166     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1167     */
1168    public Identifier getIdentifierFirstRep() { 
1169      if (getIdentifier().isEmpty()) {
1170        addIdentifier();
1171      }
1172      return getIdentifier().get(0);
1173    }
1174
1175    /**
1176     * @return {@link #udi} ([Unique device identifier (UDI)](device.html#udi) assigned to device label or package.)
1177     */
1178    public DeviceUdiComponent getUdi() { 
1179      if (this.udi == null)
1180        if (Configuration.errorOnAutoCreate())
1181          throw new Error("Attempt to auto-create Device.udi");
1182        else if (Configuration.doAutoCreate())
1183          this.udi = new DeviceUdiComponent(); // cc
1184      return this.udi;
1185    }
1186
1187    public boolean hasUdi() { 
1188      return this.udi != null && !this.udi.isEmpty();
1189    }
1190
1191    /**
1192     * @param value {@link #udi} ([Unique device identifier (UDI)](device.html#udi) assigned to device label or package.)
1193     */
1194    public Device setUdi(DeviceUdiComponent value) { 
1195      this.udi = value;
1196      return this;
1197    }
1198
1199    /**
1200     * @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
1201     */
1202    public Enumeration<FHIRDeviceStatus> getStatusElement() { 
1203      if (this.status == null)
1204        if (Configuration.errorOnAutoCreate())
1205          throw new Error("Attempt to auto-create Device.status");
1206        else if (Configuration.doAutoCreate())
1207          this.status = new Enumeration<FHIRDeviceStatus>(new FHIRDeviceStatusEnumFactory()); // bb
1208      return this.status;
1209    }
1210
1211    public boolean hasStatusElement() { 
1212      return this.status != null && !this.status.isEmpty();
1213    }
1214
1215    public boolean hasStatus() { 
1216      return this.status != null && !this.status.isEmpty();
1217    }
1218
1219    /**
1220     * @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
1221     */
1222    public Device setStatusElement(Enumeration<FHIRDeviceStatus> value) { 
1223      this.status = value;
1224      return this;
1225    }
1226
1227    /**
1228     * @return Status of the Device availability.
1229     */
1230    public FHIRDeviceStatus getStatus() { 
1231      return this.status == null ? null : this.status.getValue();
1232    }
1233
1234    /**
1235     * @param value Status of the Device availability.
1236     */
1237    public Device setStatus(FHIRDeviceStatus value) { 
1238      if (value == null)
1239        this.status = null;
1240      else {
1241        if (this.status == null)
1242          this.status = new Enumeration<FHIRDeviceStatus>(new FHIRDeviceStatusEnumFactory());
1243        this.status.setValue(value);
1244      }
1245      return this;
1246    }
1247
1248    /**
1249     * @return {@link #type} (Code or identifier to identify a kind of device.)
1250     */
1251    public CodeableConcept getType() { 
1252      if (this.type == null)
1253        if (Configuration.errorOnAutoCreate())
1254          throw new Error("Attempt to auto-create Device.type");
1255        else if (Configuration.doAutoCreate())
1256          this.type = new CodeableConcept(); // cc
1257      return this.type;
1258    }
1259
1260    public boolean hasType() { 
1261      return this.type != null && !this.type.isEmpty();
1262    }
1263
1264    /**
1265     * @param value {@link #type} (Code or identifier to identify a kind of device.)
1266     */
1267    public Device setType(CodeableConcept value) { 
1268      this.type = value;
1269      return this;
1270    }
1271
1272    /**
1273     * @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
1274     */
1275    public StringType getLotNumberElement() { 
1276      if (this.lotNumber == null)
1277        if (Configuration.errorOnAutoCreate())
1278          throw new Error("Attempt to auto-create Device.lotNumber");
1279        else if (Configuration.doAutoCreate())
1280          this.lotNumber = new StringType(); // bb
1281      return this.lotNumber;
1282    }
1283
1284    public boolean hasLotNumberElement() { 
1285      return this.lotNumber != null && !this.lotNumber.isEmpty();
1286    }
1287
1288    public boolean hasLotNumber() { 
1289      return this.lotNumber != null && !this.lotNumber.isEmpty();
1290    }
1291
1292    /**
1293     * @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
1294     */
1295    public Device setLotNumberElement(StringType value) { 
1296      this.lotNumber = value;
1297      return this;
1298    }
1299
1300    /**
1301     * @return Lot number assigned by the manufacturer.
1302     */
1303    public String getLotNumber() { 
1304      return this.lotNumber == null ? null : this.lotNumber.getValue();
1305    }
1306
1307    /**
1308     * @param value Lot number assigned by the manufacturer.
1309     */
1310    public Device setLotNumber(String value) { 
1311      if (Utilities.noString(value))
1312        this.lotNumber = null;
1313      else {
1314        if (this.lotNumber == null)
1315          this.lotNumber = new StringType();
1316        this.lotNumber.setValue(value);
1317      }
1318      return this;
1319    }
1320
1321    /**
1322     * @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
1323     */
1324    public StringType getManufacturerElement() { 
1325      if (this.manufacturer == null)
1326        if (Configuration.errorOnAutoCreate())
1327          throw new Error("Attempt to auto-create Device.manufacturer");
1328        else if (Configuration.doAutoCreate())
1329          this.manufacturer = new StringType(); // bb
1330      return this.manufacturer;
1331    }
1332
1333    public boolean hasManufacturerElement() { 
1334      return this.manufacturer != null && !this.manufacturer.isEmpty();
1335    }
1336
1337    public boolean hasManufacturer() { 
1338      return this.manufacturer != null && !this.manufacturer.isEmpty();
1339    }
1340
1341    /**
1342     * @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
1343     */
1344    public Device setManufacturerElement(StringType value) { 
1345      this.manufacturer = value;
1346      return this;
1347    }
1348
1349    /**
1350     * @return A name of the manufacturer.
1351     */
1352    public String getManufacturer() { 
1353      return this.manufacturer == null ? null : this.manufacturer.getValue();
1354    }
1355
1356    /**
1357     * @param value A name of the manufacturer.
1358     */
1359    public Device setManufacturer(String value) { 
1360      if (Utilities.noString(value))
1361        this.manufacturer = null;
1362      else {
1363        if (this.manufacturer == null)
1364          this.manufacturer = new StringType();
1365        this.manufacturer.setValue(value);
1366      }
1367      return this;
1368    }
1369
1370    /**
1371     * @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
1372     */
1373    public DateTimeType getManufactureDateElement() { 
1374      if (this.manufactureDate == null)
1375        if (Configuration.errorOnAutoCreate())
1376          throw new Error("Attempt to auto-create Device.manufactureDate");
1377        else if (Configuration.doAutoCreate())
1378          this.manufactureDate = new DateTimeType(); // bb
1379      return this.manufactureDate;
1380    }
1381
1382    public boolean hasManufactureDateElement() { 
1383      return this.manufactureDate != null && !this.manufactureDate.isEmpty();
1384    }
1385
1386    public boolean hasManufactureDate() { 
1387      return this.manufactureDate != null && !this.manufactureDate.isEmpty();
1388    }
1389
1390    /**
1391     * @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
1392     */
1393    public Device setManufactureDateElement(DateTimeType value) { 
1394      this.manufactureDate = value;
1395      return this;
1396    }
1397
1398    /**
1399     * @return The date and time when the device was manufactured.
1400     */
1401    public Date getManufactureDate() { 
1402      return this.manufactureDate == null ? null : this.manufactureDate.getValue();
1403    }
1404
1405    /**
1406     * @param value The date and time when the device was manufactured.
1407     */
1408    public Device setManufactureDate(Date value) { 
1409      if (value == null)
1410        this.manufactureDate = null;
1411      else {
1412        if (this.manufactureDate == null)
1413          this.manufactureDate = new DateTimeType();
1414        this.manufactureDate.setValue(value);
1415      }
1416      return this;
1417    }
1418
1419    /**
1420     * @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
1421     */
1422    public DateTimeType getExpirationDateElement() { 
1423      if (this.expirationDate == null)
1424        if (Configuration.errorOnAutoCreate())
1425          throw new Error("Attempt to auto-create Device.expirationDate");
1426        else if (Configuration.doAutoCreate())
1427          this.expirationDate = new DateTimeType(); // bb
1428      return this.expirationDate;
1429    }
1430
1431    public boolean hasExpirationDateElement() { 
1432      return this.expirationDate != null && !this.expirationDate.isEmpty();
1433    }
1434
1435    public boolean hasExpirationDate() { 
1436      return this.expirationDate != null && !this.expirationDate.isEmpty();
1437    }
1438
1439    /**
1440     * @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
1441     */
1442    public Device setExpirationDateElement(DateTimeType value) { 
1443      this.expirationDate = value;
1444      return this;
1445    }
1446
1447    /**
1448     * @return The date and time beyond which this device is no longer valid or should not be used (if applicable).
1449     */
1450    public Date getExpirationDate() { 
1451      return this.expirationDate == null ? null : this.expirationDate.getValue();
1452    }
1453
1454    /**
1455     * @param value The date and time beyond which this device is no longer valid or should not be used (if applicable).
1456     */
1457    public Device setExpirationDate(Date value) { 
1458      if (value == null)
1459        this.expirationDate = null;
1460      else {
1461        if (this.expirationDate == null)
1462          this.expirationDate = new DateTimeType();
1463        this.expirationDate.setValue(value);
1464      }
1465      return this;
1466    }
1467
1468    /**
1469     * @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
1470     */
1471    public StringType getModelElement() { 
1472      if (this.model == null)
1473        if (Configuration.errorOnAutoCreate())
1474          throw new Error("Attempt to auto-create Device.model");
1475        else if (Configuration.doAutoCreate())
1476          this.model = new StringType(); // bb
1477      return this.model;
1478    }
1479
1480    public boolean hasModelElement() { 
1481      return this.model != null && !this.model.isEmpty();
1482    }
1483
1484    public boolean hasModel() { 
1485      return this.model != null && !this.model.isEmpty();
1486    }
1487
1488    /**
1489     * @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
1490     */
1491    public Device setModelElement(StringType value) { 
1492      this.model = value;
1493      return this;
1494    }
1495
1496    /**
1497     * @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.
1498     */
1499    public String getModel() { 
1500      return this.model == null ? null : this.model.getValue();
1501    }
1502
1503    /**
1504     * @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.
1505     */
1506    public Device setModel(String value) { 
1507      if (Utilities.noString(value))
1508        this.model = null;
1509      else {
1510        if (this.model == null)
1511          this.model = new StringType();
1512        this.model.setValue(value);
1513      }
1514      return this;
1515    }
1516
1517    /**
1518     * @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
1519     */
1520    public StringType getVersionElement() { 
1521      if (this.version == null)
1522        if (Configuration.errorOnAutoCreate())
1523          throw new Error("Attempt to auto-create Device.version");
1524        else if (Configuration.doAutoCreate())
1525          this.version = new StringType(); // bb
1526      return this.version;
1527    }
1528
1529    public boolean hasVersionElement() { 
1530      return this.version != null && !this.version.isEmpty();
1531    }
1532
1533    public boolean hasVersion() { 
1534      return this.version != null && !this.version.isEmpty();
1535    }
1536
1537    /**
1538     * @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
1539     */
1540    public Device setVersionElement(StringType value) { 
1541      this.version = value;
1542      return this;
1543    }
1544
1545    /**
1546     * @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.
1547     */
1548    public String getVersion() { 
1549      return this.version == null ? null : this.version.getValue();
1550    }
1551
1552    /**
1553     * @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.
1554     */
1555    public Device setVersion(String value) { 
1556      if (Utilities.noString(value))
1557        this.version = null;
1558      else {
1559        if (this.version == null)
1560          this.version = new StringType();
1561        this.version.setValue(value);
1562      }
1563      return this;
1564    }
1565
1566    /**
1567     * @return {@link #patient} (Patient information, If the device is affixed to a person.)
1568     */
1569    public Reference getPatient() { 
1570      if (this.patient == null)
1571        if (Configuration.errorOnAutoCreate())
1572          throw new Error("Attempt to auto-create Device.patient");
1573        else if (Configuration.doAutoCreate())
1574          this.patient = new Reference(); // cc
1575      return this.patient;
1576    }
1577
1578    public boolean hasPatient() { 
1579      return this.patient != null && !this.patient.isEmpty();
1580    }
1581
1582    /**
1583     * @param value {@link #patient} (Patient information, If the device is affixed to a person.)
1584     */
1585    public Device setPatient(Reference value) { 
1586      this.patient = value;
1587      return this;
1588    }
1589
1590    /**
1591     * @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.)
1592     */
1593    public Patient getPatientTarget() { 
1594      if (this.patientTarget == null)
1595        if (Configuration.errorOnAutoCreate())
1596          throw new Error("Attempt to auto-create Device.patient");
1597        else if (Configuration.doAutoCreate())
1598          this.patientTarget = new Patient(); // aa
1599      return this.patientTarget;
1600    }
1601
1602    /**
1603     * @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.)
1604     */
1605    public Device setPatientTarget(Patient value) { 
1606      this.patientTarget = value;
1607      return this;
1608    }
1609
1610    /**
1611     * @return {@link #owner} (An organization that is responsible for the provision and ongoing maintenance of the device.)
1612     */
1613    public Reference getOwner() { 
1614      if (this.owner == null)
1615        if (Configuration.errorOnAutoCreate())
1616          throw new Error("Attempt to auto-create Device.owner");
1617        else if (Configuration.doAutoCreate())
1618          this.owner = new Reference(); // cc
1619      return this.owner;
1620    }
1621
1622    public boolean hasOwner() { 
1623      return this.owner != null && !this.owner.isEmpty();
1624    }
1625
1626    /**
1627     * @param value {@link #owner} (An organization that is responsible for the provision and ongoing maintenance of the device.)
1628     */
1629    public Device setOwner(Reference value) { 
1630      this.owner = value;
1631      return this;
1632    }
1633
1634    /**
1635     * @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.)
1636     */
1637    public Organization getOwnerTarget() { 
1638      if (this.ownerTarget == null)
1639        if (Configuration.errorOnAutoCreate())
1640          throw new Error("Attempt to auto-create Device.owner");
1641        else if (Configuration.doAutoCreate())
1642          this.ownerTarget = new Organization(); // aa
1643      return this.ownerTarget;
1644    }
1645
1646    /**
1647     * @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.)
1648     */
1649    public Device setOwnerTarget(Organization value) { 
1650      this.ownerTarget = value;
1651      return this;
1652    }
1653
1654    /**
1655     * @return {@link #contact} (Contact details for an organization or a particular human that is responsible for the device.)
1656     */
1657    public List<ContactPoint> getContact() { 
1658      if (this.contact == null)
1659        this.contact = new ArrayList<ContactPoint>();
1660      return this.contact;
1661    }
1662
1663    /**
1664     * @return Returns a reference to <code>this</code> for easy method chaining
1665     */
1666    public Device setContact(List<ContactPoint> theContact) { 
1667      this.contact = theContact;
1668      return this;
1669    }
1670
1671    public boolean hasContact() { 
1672      if (this.contact == null)
1673        return false;
1674      for (ContactPoint item : this.contact)
1675        if (!item.isEmpty())
1676          return true;
1677      return false;
1678    }
1679
1680    public ContactPoint addContact() { //3
1681      ContactPoint t = new ContactPoint();
1682      if (this.contact == null)
1683        this.contact = new ArrayList<ContactPoint>();
1684      this.contact.add(t);
1685      return t;
1686    }
1687
1688    public Device addContact(ContactPoint t) { //3
1689      if (t == null)
1690        return this;
1691      if (this.contact == null)
1692        this.contact = new ArrayList<ContactPoint>();
1693      this.contact.add(t);
1694      return this;
1695    }
1696
1697    /**
1698     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist
1699     */
1700    public ContactPoint getContactFirstRep() { 
1701      if (getContact().isEmpty()) {
1702        addContact();
1703      }
1704      return getContact().get(0);
1705    }
1706
1707    /**
1708     * @return {@link #location} (The place where the device can be found.)
1709     */
1710    public Reference getLocation() { 
1711      if (this.location == null)
1712        if (Configuration.errorOnAutoCreate())
1713          throw new Error("Attempt to auto-create Device.location");
1714        else if (Configuration.doAutoCreate())
1715          this.location = new Reference(); // cc
1716      return this.location;
1717    }
1718
1719    public boolean hasLocation() { 
1720      return this.location != null && !this.location.isEmpty();
1721    }
1722
1723    /**
1724     * @param value {@link #location} (The place where the device can be found.)
1725     */
1726    public Device setLocation(Reference value) { 
1727      this.location = value;
1728      return this;
1729    }
1730
1731    /**
1732     * @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.)
1733     */
1734    public Location getLocationTarget() { 
1735      if (this.locationTarget == null)
1736        if (Configuration.errorOnAutoCreate())
1737          throw new Error("Attempt to auto-create Device.location");
1738        else if (Configuration.doAutoCreate())
1739          this.locationTarget = new Location(); // aa
1740      return this.locationTarget;
1741    }
1742
1743    /**
1744     * @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.)
1745     */
1746    public Device setLocationTarget(Location value) { 
1747      this.locationTarget = value;
1748      return this;
1749    }
1750
1751    /**
1752     * @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
1753     */
1754    public UriType getUrlElement() { 
1755      if (this.url == null)
1756        if (Configuration.errorOnAutoCreate())
1757          throw new Error("Attempt to auto-create Device.url");
1758        else if (Configuration.doAutoCreate())
1759          this.url = new UriType(); // bb
1760      return this.url;
1761    }
1762
1763    public boolean hasUrlElement() { 
1764      return this.url != null && !this.url.isEmpty();
1765    }
1766
1767    public boolean hasUrl() { 
1768      return this.url != null && !this.url.isEmpty();
1769    }
1770
1771    /**
1772     * @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
1773     */
1774    public Device setUrlElement(UriType value) { 
1775      this.url = value;
1776      return this;
1777    }
1778
1779    /**
1780     * @return A network address on which the device may be contacted directly.
1781     */
1782    public String getUrl() { 
1783      return this.url == null ? null : this.url.getValue();
1784    }
1785
1786    /**
1787     * @param value A network address on which the device may be contacted directly.
1788     */
1789    public Device setUrl(String value) { 
1790      if (Utilities.noString(value))
1791        this.url = null;
1792      else {
1793        if (this.url == null)
1794          this.url = new UriType();
1795        this.url.setValue(value);
1796      }
1797      return this;
1798    }
1799
1800    /**
1801     * @return {@link #note} (Descriptive information, usage information or implantation information that is not captured in an existing element.)
1802     */
1803    public List<Annotation> getNote() { 
1804      if (this.note == null)
1805        this.note = new ArrayList<Annotation>();
1806      return this.note;
1807    }
1808
1809    /**
1810     * @return Returns a reference to <code>this</code> for easy method chaining
1811     */
1812    public Device setNote(List<Annotation> theNote) { 
1813      this.note = theNote;
1814      return this;
1815    }
1816
1817    public boolean hasNote() { 
1818      if (this.note == null)
1819        return false;
1820      for (Annotation item : this.note)
1821        if (!item.isEmpty())
1822          return true;
1823      return false;
1824    }
1825
1826    public Annotation addNote() { //3
1827      Annotation t = new Annotation();
1828      if (this.note == null)
1829        this.note = new ArrayList<Annotation>();
1830      this.note.add(t);
1831      return t;
1832    }
1833
1834    public Device addNote(Annotation t) { //3
1835      if (t == null)
1836        return this;
1837      if (this.note == null)
1838        this.note = new ArrayList<Annotation>();
1839      this.note.add(t);
1840      return this;
1841    }
1842
1843    /**
1844     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
1845     */
1846    public Annotation getNoteFirstRep() { 
1847      if (getNote().isEmpty()) {
1848        addNote();
1849      }
1850      return getNote().get(0);
1851    }
1852
1853    /**
1854     * @return {@link #safety} (Provides additional safety characteristics about a medical device.  For example devices containing latex.)
1855     */
1856    public List<CodeableConcept> getSafety() { 
1857      if (this.safety == null)
1858        this.safety = new ArrayList<CodeableConcept>();
1859      return this.safety;
1860    }
1861
1862    /**
1863     * @return Returns a reference to <code>this</code> for easy method chaining
1864     */
1865    public Device setSafety(List<CodeableConcept> theSafety) { 
1866      this.safety = theSafety;
1867      return this;
1868    }
1869
1870    public boolean hasSafety() { 
1871      if (this.safety == null)
1872        return false;
1873      for (CodeableConcept item : this.safety)
1874        if (!item.isEmpty())
1875          return true;
1876      return false;
1877    }
1878
1879    public CodeableConcept addSafety() { //3
1880      CodeableConcept t = new CodeableConcept();
1881      if (this.safety == null)
1882        this.safety = new ArrayList<CodeableConcept>();
1883      this.safety.add(t);
1884      return t;
1885    }
1886
1887    public Device addSafety(CodeableConcept t) { //3
1888      if (t == null)
1889        return this;
1890      if (this.safety == null)
1891        this.safety = new ArrayList<CodeableConcept>();
1892      this.safety.add(t);
1893      return this;
1894    }
1895
1896    /**
1897     * @return The first repetition of repeating field {@link #safety}, creating it if it does not already exist
1898     */
1899    public CodeableConcept getSafetyFirstRep() { 
1900      if (getSafety().isEmpty()) {
1901        addSafety();
1902      }
1903      return getSafety().get(0);
1904    }
1905
1906      protected void listChildren(List<Property> children) {
1907        super.listChildren(children);
1908        children.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));
1909        children.add(new Property("udi", "", "[Unique device identifier (UDI)](device.html#udi) assigned to device label or package.", 0, 1, udi));
1910        children.add(new Property("status", "code", "Status of the Device availability.", 0, 1, status));
1911        children.add(new Property("type", "CodeableConcept", "Code or identifier to identify a kind of device.", 0, 1, type));
1912        children.add(new Property("lotNumber", "string", "Lot number assigned by the manufacturer.", 0, 1, lotNumber));
1913        children.add(new Property("manufacturer", "string", "A name of the manufacturer.", 0, 1, manufacturer));
1914        children.add(new Property("manufactureDate", "dateTime", "The date and time when the device was manufactured.", 0, 1, manufactureDate));
1915        children.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, 1, expirationDate));
1916        children.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, 1, model));
1917        children.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, 1, version));
1918        children.add(new Property("patient", "Reference(Patient)", "Patient information, If the device is affixed to a person.", 0, 1, patient));
1919        children.add(new Property("owner", "Reference(Organization)", "An organization that is responsible for the provision and ongoing maintenance of the device.", 0, 1, owner));
1920        children.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));
1921        children.add(new Property("location", "Reference(Location)", "The place where the device can be found.", 0, 1, location));
1922        children.add(new Property("url", "uri", "A network address on which the device may be contacted directly.", 0, 1, url));
1923        children.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));
1924        children.add(new Property("safety", "CodeableConcept", "Provides additional safety characteristics about a medical device.  For example devices containing latex.", 0, java.lang.Integer.MAX_VALUE, safety));
1925      }
1926
1927      @Override
1928      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1929        switch (_hash) {
1930        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique instance identifiers assigned to a device by manufacturers other organizations or owners.", 0, java.lang.Integer.MAX_VALUE, identifier);
1931        case 115642: /*udi*/  return new Property("udi", "", "[Unique device identifier (UDI)](device.html#udi) assigned to device label or package.", 0, 1, udi);
1932        case -892481550: /*status*/  return new Property("status", "code", "Status of the Device availability.", 0, 1, status);
1933        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Code or identifier to identify a kind of device.", 0, 1, type);
1934        case 462547450: /*lotNumber*/  return new Property("lotNumber", "string", "Lot number assigned by the manufacturer.", 0, 1, lotNumber);
1935        case -1969347631: /*manufacturer*/  return new Property("manufacturer", "string", "A name of the manufacturer.", 0, 1, manufacturer);
1936        case 416714767: /*manufactureDate*/  return new Property("manufactureDate", "dateTime", "The date and time when the device was manufactured.", 0, 1, manufactureDate);
1937        case -668811523: /*expirationDate*/  return new Property("expirationDate", "dateTime", "The date and time beyond which this device is no longer valid or should not be used (if applicable).", 0, 1, expirationDate);
1938        case 104069929: /*model*/  return 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, 1, model);
1939        case 351608024: /*version*/  return 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, 1, version);
1940        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "Patient information, If the device is affixed to a person.", 0, 1, patient);
1941        case 106164915: /*owner*/  return new Property("owner", "Reference(Organization)", "An organization that is responsible for the provision and ongoing maintenance of the device.", 0, 1, owner);
1942        case 951526432: /*contact*/  return 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);
1943        case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "The place where the device can be found.", 0, 1, location);
1944        case 116079: /*url*/  return new Property("url", "uri", "A network address on which the device may be contacted directly.", 0, 1, url);
1945        case 3387378: /*note*/  return 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);
1946        case -909893934: /*safety*/  return new Property("safety", "CodeableConcept", "Provides additional safety characteristics about a medical device.  For example devices containing latex.", 0, java.lang.Integer.MAX_VALUE, safety);
1947        default: return super.getNamedProperty(_hash, _name, _checkValid);
1948        }
1949
1950      }
1951
1952      @Override
1953      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1954        switch (hash) {
1955        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1956        case 115642: /*udi*/ return this.udi == null ? new Base[0] : new Base[] {this.udi}; // DeviceUdiComponent
1957        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<FHIRDeviceStatus>
1958        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1959        case 462547450: /*lotNumber*/ return this.lotNumber == null ? new Base[0] : new Base[] {this.lotNumber}; // StringType
1960        case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : new Base[] {this.manufacturer}; // StringType
1961        case 416714767: /*manufactureDate*/ return this.manufactureDate == null ? new Base[0] : new Base[] {this.manufactureDate}; // DateTimeType
1962        case -668811523: /*expirationDate*/ return this.expirationDate == null ? new Base[0] : new Base[] {this.expirationDate}; // DateTimeType
1963        case 104069929: /*model*/ return this.model == null ? new Base[0] : new Base[] {this.model}; // StringType
1964        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
1965        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
1966        case 106164915: /*owner*/ return this.owner == null ? new Base[0] : new Base[] {this.owner}; // Reference
1967        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactPoint
1968        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
1969        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
1970        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
1971        case -909893934: /*safety*/ return this.safety == null ? new Base[0] : this.safety.toArray(new Base[this.safety.size()]); // CodeableConcept
1972        default: return super.getProperty(hash, name, checkValid);
1973        }
1974
1975      }
1976
1977      @Override
1978      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1979        switch (hash) {
1980        case -1618432855: // identifier
1981          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1982          return value;
1983        case 115642: // udi
1984          this.udi = (DeviceUdiComponent) value; // DeviceUdiComponent
1985          return value;
1986        case -892481550: // status
1987          value = new FHIRDeviceStatusEnumFactory().fromType(castToCode(value));
1988          this.status = (Enumeration) value; // Enumeration<FHIRDeviceStatus>
1989          return value;
1990        case 3575610: // type
1991          this.type = castToCodeableConcept(value); // CodeableConcept
1992          return value;
1993        case 462547450: // lotNumber
1994          this.lotNumber = castToString(value); // StringType
1995          return value;
1996        case -1969347631: // manufacturer
1997          this.manufacturer = castToString(value); // StringType
1998          return value;
1999        case 416714767: // manufactureDate
2000          this.manufactureDate = castToDateTime(value); // DateTimeType
2001          return value;
2002        case -668811523: // expirationDate
2003          this.expirationDate = castToDateTime(value); // DateTimeType
2004          return value;
2005        case 104069929: // model
2006          this.model = castToString(value); // StringType
2007          return value;
2008        case 351608024: // version
2009          this.version = castToString(value); // StringType
2010          return value;
2011        case -791418107: // patient
2012          this.patient = castToReference(value); // Reference
2013          return value;
2014        case 106164915: // owner
2015          this.owner = castToReference(value); // Reference
2016          return value;
2017        case 951526432: // contact
2018          this.getContact().add(castToContactPoint(value)); // ContactPoint
2019          return value;
2020        case 1901043637: // location
2021          this.location = castToReference(value); // Reference
2022          return value;
2023        case 116079: // url
2024          this.url = castToUri(value); // UriType
2025          return value;
2026        case 3387378: // note
2027          this.getNote().add(castToAnnotation(value)); // Annotation
2028          return value;
2029        case -909893934: // safety
2030          this.getSafety().add(castToCodeableConcept(value)); // CodeableConcept
2031          return value;
2032        default: return super.setProperty(hash, name, value);
2033        }
2034
2035      }
2036
2037      @Override
2038      public Base setProperty(String name, Base value) throws FHIRException {
2039        if (name.equals("identifier")) {
2040          this.getIdentifier().add(castToIdentifier(value));
2041        } else if (name.equals("udi")) {
2042          this.udi = (DeviceUdiComponent) value; // DeviceUdiComponent
2043        } else if (name.equals("status")) {
2044          value = new FHIRDeviceStatusEnumFactory().fromType(castToCode(value));
2045          this.status = (Enumeration) value; // Enumeration<FHIRDeviceStatus>
2046        } else if (name.equals("type")) {
2047          this.type = castToCodeableConcept(value); // CodeableConcept
2048        } else if (name.equals("lotNumber")) {
2049          this.lotNumber = castToString(value); // StringType
2050        } else if (name.equals("manufacturer")) {
2051          this.manufacturer = castToString(value); // StringType
2052        } else if (name.equals("manufactureDate")) {
2053          this.manufactureDate = castToDateTime(value); // DateTimeType
2054        } else if (name.equals("expirationDate")) {
2055          this.expirationDate = castToDateTime(value); // DateTimeType
2056        } else if (name.equals("model")) {
2057          this.model = castToString(value); // StringType
2058        } else if (name.equals("version")) {
2059          this.version = castToString(value); // StringType
2060        } else if (name.equals("patient")) {
2061          this.patient = castToReference(value); // Reference
2062        } else if (name.equals("owner")) {
2063          this.owner = castToReference(value); // Reference
2064        } else if (name.equals("contact")) {
2065          this.getContact().add(castToContactPoint(value));
2066        } else if (name.equals("location")) {
2067          this.location = castToReference(value); // Reference
2068        } else if (name.equals("url")) {
2069          this.url = castToUri(value); // UriType
2070        } else if (name.equals("note")) {
2071          this.getNote().add(castToAnnotation(value));
2072        } else if (name.equals("safety")) {
2073          this.getSafety().add(castToCodeableConcept(value));
2074        } else
2075          return super.setProperty(name, value);
2076        return value;
2077      }
2078
2079      @Override
2080      public Base makeProperty(int hash, String name) throws FHIRException {
2081        switch (hash) {
2082        case -1618432855:  return addIdentifier(); 
2083        case 115642:  return getUdi(); 
2084        case -892481550:  return getStatusElement();
2085        case 3575610:  return getType(); 
2086        case 462547450:  return getLotNumberElement();
2087        case -1969347631:  return getManufacturerElement();
2088        case 416714767:  return getManufactureDateElement();
2089        case -668811523:  return getExpirationDateElement();
2090        case 104069929:  return getModelElement();
2091        case 351608024:  return getVersionElement();
2092        case -791418107:  return getPatient(); 
2093        case 106164915:  return getOwner(); 
2094        case 951526432:  return addContact(); 
2095        case 1901043637:  return getLocation(); 
2096        case 116079:  return getUrlElement();
2097        case 3387378:  return addNote(); 
2098        case -909893934:  return addSafety(); 
2099        default: return super.makeProperty(hash, name);
2100        }
2101
2102      }
2103
2104      @Override
2105      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2106        switch (hash) {
2107        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2108        case 115642: /*udi*/ return new String[] {};
2109        case -892481550: /*status*/ return new String[] {"code"};
2110        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2111        case 462547450: /*lotNumber*/ return new String[] {"string"};
2112        case -1969347631: /*manufacturer*/ return new String[] {"string"};
2113        case 416714767: /*manufactureDate*/ return new String[] {"dateTime"};
2114        case -668811523: /*expirationDate*/ return new String[] {"dateTime"};
2115        case 104069929: /*model*/ return new String[] {"string"};
2116        case 351608024: /*version*/ return new String[] {"string"};
2117        case -791418107: /*patient*/ return new String[] {"Reference"};
2118        case 106164915: /*owner*/ return new String[] {"Reference"};
2119        case 951526432: /*contact*/ return new String[] {"ContactPoint"};
2120        case 1901043637: /*location*/ return new String[] {"Reference"};
2121        case 116079: /*url*/ return new String[] {"uri"};
2122        case 3387378: /*note*/ return new String[] {"Annotation"};
2123        case -909893934: /*safety*/ return new String[] {"CodeableConcept"};
2124        default: return super.getTypesForProperty(hash, name);
2125        }
2126
2127      }
2128
2129      @Override
2130      public Base addChild(String name) throws FHIRException {
2131        if (name.equals("identifier")) {
2132          return addIdentifier();
2133        }
2134        else if (name.equals("udi")) {
2135          this.udi = new DeviceUdiComponent();
2136          return this.udi;
2137        }
2138        else if (name.equals("status")) {
2139          throw new FHIRException("Cannot call addChild on a primitive type Device.status");
2140        }
2141        else if (name.equals("type")) {
2142          this.type = new CodeableConcept();
2143          return this.type;
2144        }
2145        else if (name.equals("lotNumber")) {
2146          throw new FHIRException("Cannot call addChild on a primitive type Device.lotNumber");
2147        }
2148        else if (name.equals("manufacturer")) {
2149          throw new FHIRException("Cannot call addChild on a primitive type Device.manufacturer");
2150        }
2151        else if (name.equals("manufactureDate")) {
2152          throw new FHIRException("Cannot call addChild on a primitive type Device.manufactureDate");
2153        }
2154        else if (name.equals("expirationDate")) {
2155          throw new FHIRException("Cannot call addChild on a primitive type Device.expirationDate");
2156        }
2157        else if (name.equals("model")) {
2158          throw new FHIRException("Cannot call addChild on a primitive type Device.model");
2159        }
2160        else if (name.equals("version")) {
2161          throw new FHIRException("Cannot call addChild on a primitive type Device.version");
2162        }
2163        else if (name.equals("patient")) {
2164          this.patient = new Reference();
2165          return this.patient;
2166        }
2167        else if (name.equals("owner")) {
2168          this.owner = new Reference();
2169          return this.owner;
2170        }
2171        else if (name.equals("contact")) {
2172          return addContact();
2173        }
2174        else if (name.equals("location")) {
2175          this.location = new Reference();
2176          return this.location;
2177        }
2178        else if (name.equals("url")) {
2179          throw new FHIRException("Cannot call addChild on a primitive type Device.url");
2180        }
2181        else if (name.equals("note")) {
2182          return addNote();
2183        }
2184        else if (name.equals("safety")) {
2185          return addSafety();
2186        }
2187        else
2188          return super.addChild(name);
2189      }
2190
2191  public String fhirType() {
2192    return "Device";
2193
2194  }
2195
2196      public Device copy() {
2197        Device dst = new Device();
2198        copyValues(dst);
2199        if (identifier != null) {
2200          dst.identifier = new ArrayList<Identifier>();
2201          for (Identifier i : identifier)
2202            dst.identifier.add(i.copy());
2203        };
2204        dst.udi = udi == null ? null : udi.copy();
2205        dst.status = status == null ? null : status.copy();
2206        dst.type = type == null ? null : type.copy();
2207        dst.lotNumber = lotNumber == null ? null : lotNumber.copy();
2208        dst.manufacturer = manufacturer == null ? null : manufacturer.copy();
2209        dst.manufactureDate = manufactureDate == null ? null : manufactureDate.copy();
2210        dst.expirationDate = expirationDate == null ? null : expirationDate.copy();
2211        dst.model = model == null ? null : model.copy();
2212        dst.version = version == null ? null : version.copy();
2213        dst.patient = patient == null ? null : patient.copy();
2214        dst.owner = owner == null ? null : owner.copy();
2215        if (contact != null) {
2216          dst.contact = new ArrayList<ContactPoint>();
2217          for (ContactPoint i : contact)
2218            dst.contact.add(i.copy());
2219        };
2220        dst.location = location == null ? null : location.copy();
2221        dst.url = url == null ? null : url.copy();
2222        if (note != null) {
2223          dst.note = new ArrayList<Annotation>();
2224          for (Annotation i : note)
2225            dst.note.add(i.copy());
2226        };
2227        if (safety != null) {
2228          dst.safety = new ArrayList<CodeableConcept>();
2229          for (CodeableConcept i : safety)
2230            dst.safety.add(i.copy());
2231        };
2232        return dst;
2233      }
2234
2235      protected Device typedCopy() {
2236        return copy();
2237      }
2238
2239      @Override
2240      public boolean equalsDeep(Base other_) {
2241        if (!super.equalsDeep(other_))
2242          return false;
2243        if (!(other_ instanceof Device))
2244          return false;
2245        Device o = (Device) other_;
2246        return compareDeep(identifier, o.identifier, true) && compareDeep(udi, o.udi, true) && compareDeep(status, o.status, true)
2247           && compareDeep(type, o.type, true) && compareDeep(lotNumber, o.lotNumber, true) && compareDeep(manufacturer, o.manufacturer, true)
2248           && compareDeep(manufactureDate, o.manufactureDate, true) && compareDeep(expirationDate, o.expirationDate, true)
2249           && compareDeep(model, o.model, true) && compareDeep(version, o.version, true) && compareDeep(patient, o.patient, true)
2250           && compareDeep(owner, o.owner, true) && compareDeep(contact, o.contact, true) && compareDeep(location, o.location, true)
2251           && compareDeep(url, o.url, true) && compareDeep(note, o.note, true) && compareDeep(safety, o.safety, true)
2252          ;
2253      }
2254
2255      @Override
2256      public boolean equalsShallow(Base other_) {
2257        if (!super.equalsShallow(other_))
2258          return false;
2259        if (!(other_ instanceof Device))
2260          return false;
2261        Device o = (Device) other_;
2262        return compareValues(status, o.status, true) && compareValues(lotNumber, o.lotNumber, true) && compareValues(manufacturer, o.manufacturer, true)
2263           && compareValues(manufactureDate, o.manufactureDate, true) && compareValues(expirationDate, o.expirationDate, true)
2264           && compareValues(model, o.model, true) && compareValues(version, o.version, true) && compareValues(url, o.url, true)
2265          ;
2266      }
2267
2268      public boolean isEmpty() {
2269        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, udi, status
2270          , type, lotNumber, manufacturer, manufactureDate, expirationDate, model, version
2271          , patient, owner, contact, location, url, note, safety);
2272      }
2273
2274  @Override
2275  public ResourceType getResourceType() {
2276    return ResourceType.Device;
2277   }
2278
2279 /**
2280   * Search parameter: <b>udi-di</b>
2281   * <p>
2282   * Description: <b>The udi Device Identifier (DI)</b><br>
2283   * Type: <b>string</b><br>
2284   * Path: <b>Device.udi.deviceIdentifier</b><br>
2285   * </p>
2286   */
2287  @SearchParamDefinition(name="udi-di", path="Device.udi.deviceIdentifier", description="The udi Device Identifier (DI)", type="string" )
2288  public static final String SP_UDI_DI = "udi-di";
2289 /**
2290   * <b>Fluent Client</b> search parameter constant for <b>udi-di</b>
2291   * <p>
2292   * Description: <b>The udi Device Identifier (DI)</b><br>
2293   * Type: <b>string</b><br>
2294   * Path: <b>Device.udi.deviceIdentifier</b><br>
2295   * </p>
2296   */
2297  public static final ca.uhn.fhir.rest.gclient.StringClientParam UDI_DI = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_UDI_DI);
2298
2299 /**
2300   * Search parameter: <b>identifier</b>
2301   * <p>
2302   * Description: <b>Instance id from manufacturer, owner, and others</b><br>
2303   * Type: <b>token</b><br>
2304   * Path: <b>Device.identifier</b><br>
2305   * </p>
2306   */
2307  @SearchParamDefinition(name="identifier", path="Device.identifier", description="Instance id from manufacturer, owner, and others", type="token" )
2308  public static final String SP_IDENTIFIER = "identifier";
2309 /**
2310   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2311   * <p>
2312   * Description: <b>Instance id from manufacturer, owner, and others</b><br>
2313   * Type: <b>token</b><br>
2314   * Path: <b>Device.identifier</b><br>
2315   * </p>
2316   */
2317  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2318
2319 /**
2320   * Search parameter: <b>udi-carrier</b>
2321   * <p>
2322   * Description: <b>UDI Barcode (RFID or other technology) string either in HRF format or AIDC format converted to base64 string.</b><br>
2323   * Type: <b>string</b><br>
2324   * Path: <b>Device.udi.carrierHRF, Device.udi.carrierAIDC</b><br>
2325   * </p>
2326   */
2327  @SearchParamDefinition(name="udi-carrier", path="Device.udi.carrierHRF | Device.udi.carrierAIDC", description="UDI Barcode (RFID or other technology) string either in HRF format or AIDC format converted to base64 string.", type="string" )
2328  public static final String SP_UDI_CARRIER = "udi-carrier";
2329 /**
2330   * <b>Fluent Client</b> search parameter constant for <b>udi-carrier</b>
2331   * <p>
2332   * Description: <b>UDI Barcode (RFID or other technology) string either in HRF format or AIDC format converted to base64 string.</b><br>
2333   * Type: <b>string</b><br>
2334   * Path: <b>Device.udi.carrierHRF, Device.udi.carrierAIDC</b><br>
2335   * </p>
2336   */
2337  public static final ca.uhn.fhir.rest.gclient.StringClientParam UDI_CARRIER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_UDI_CARRIER);
2338
2339 /**
2340   * Search parameter: <b>device-name</b>
2341   * <p>
2342   * Description: <b>A server defined search that may match any of the string fields in the Device.udi.name  or Device.type.coding.display or  Device.type.text</b><br>
2343   * Type: <b>string</b><br>
2344   * Path: <b>Device.udi.name, Device.type.text, Device.type.coding.display</b><br>
2345   * </p>
2346   */
2347  @SearchParamDefinition(name="device-name", path="Device.udi.name | Device.type.text | Device.type.coding.display", description="A server defined search that may match any of the string fields in the Device.udi.name  or Device.type.coding.display or  Device.type.text", type="string" )
2348  public static final String SP_DEVICE_NAME = "device-name";
2349 /**
2350   * <b>Fluent Client</b> search parameter constant for <b>device-name</b>
2351   * <p>
2352   * Description: <b>A server defined search that may match any of the string fields in the Device.udi.name  or Device.type.coding.display or  Device.type.text</b><br>
2353   * Type: <b>string</b><br>
2354   * Path: <b>Device.udi.name, Device.type.text, Device.type.coding.display</b><br>
2355   * </p>
2356   */
2357  public static final ca.uhn.fhir.rest.gclient.StringClientParam DEVICE_NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DEVICE_NAME);
2358
2359 /**
2360   * Search parameter: <b>patient</b>
2361   * <p>
2362   * Description: <b>Patient information, if the resource is affixed to a person</b><br>
2363   * Type: <b>reference</b><br>
2364   * Path: <b>Device.patient</b><br>
2365   * </p>
2366   */
2367  @SearchParamDefinition(name="patient", path="Device.patient", description="Patient information, if the resource is affixed to a person", type="reference", target={Patient.class } )
2368  public static final String SP_PATIENT = "patient";
2369 /**
2370   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2371   * <p>
2372   * Description: <b>Patient information, if the resource is affixed to a person</b><br>
2373   * Type: <b>reference</b><br>
2374   * Path: <b>Device.patient</b><br>
2375   * </p>
2376   */
2377  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2378
2379/**
2380   * Constant for fluent queries to be used to add include statements. Specifies
2381   * the path value of "<b>Device:patient</b>".
2382   */
2383  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Device:patient").toLocked();
2384
2385 /**
2386   * Search parameter: <b>organization</b>
2387   * <p>
2388   * Description: <b>The organization responsible for the device</b><br>
2389   * Type: <b>reference</b><br>
2390   * Path: <b>Device.owner</b><br>
2391   * </p>
2392   */
2393  @SearchParamDefinition(name="organization", path="Device.owner", description="The organization responsible for the device", type="reference", target={Organization.class } )
2394  public static final String SP_ORGANIZATION = "organization";
2395 /**
2396   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
2397   * <p>
2398   * Description: <b>The organization responsible for the device</b><br>
2399   * Type: <b>reference</b><br>
2400   * Path: <b>Device.owner</b><br>
2401   * </p>
2402   */
2403  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
2404
2405/**
2406   * Constant for fluent queries to be used to add include statements. Specifies
2407   * the path value of "<b>Device:organization</b>".
2408   */
2409  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("Device:organization").toLocked();
2410
2411 /**
2412   * Search parameter: <b>model</b>
2413   * <p>
2414   * Description: <b>The model of the device</b><br>
2415   * Type: <b>string</b><br>
2416   * Path: <b>Device.model</b><br>
2417   * </p>
2418   */
2419  @SearchParamDefinition(name="model", path="Device.model", description="The model of the device", type="string" )
2420  public static final String SP_MODEL = "model";
2421 /**
2422   * <b>Fluent Client</b> search parameter constant for <b>model</b>
2423   * <p>
2424   * Description: <b>The model of the device</b><br>
2425   * Type: <b>string</b><br>
2426   * Path: <b>Device.model</b><br>
2427   * </p>
2428   */
2429  public static final ca.uhn.fhir.rest.gclient.StringClientParam MODEL = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_MODEL);
2430
2431 /**
2432   * Search parameter: <b>location</b>
2433   * <p>
2434   * Description: <b>A location, where the resource is found</b><br>
2435   * Type: <b>reference</b><br>
2436   * Path: <b>Device.location</b><br>
2437   * </p>
2438   */
2439  @SearchParamDefinition(name="location", path="Device.location", description="A location, where the resource is found", type="reference", target={Location.class } )
2440  public static final String SP_LOCATION = "location";
2441 /**
2442   * <b>Fluent Client</b> search parameter constant for <b>location</b>
2443   * <p>
2444   * Description: <b>A location, where the resource is found</b><br>
2445   * Type: <b>reference</b><br>
2446   * Path: <b>Device.location</b><br>
2447   * </p>
2448   */
2449  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
2450
2451/**
2452   * Constant for fluent queries to be used to add include statements. Specifies
2453   * the path value of "<b>Device:location</b>".
2454   */
2455  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("Device:location").toLocked();
2456
2457 /**
2458   * Search parameter: <b>type</b>
2459   * <p>
2460   * Description: <b>The type of the device</b><br>
2461   * Type: <b>token</b><br>
2462   * Path: <b>Device.type</b><br>
2463   * </p>
2464   */
2465  @SearchParamDefinition(name="type", path="Device.type", description="The type of the device", type="token" )
2466  public static final String SP_TYPE = "type";
2467 /**
2468   * <b>Fluent Client</b> search parameter constant for <b>type</b>
2469   * <p>
2470   * Description: <b>The type of the device</b><br>
2471   * Type: <b>token</b><br>
2472   * Path: <b>Device.type</b><br>
2473   * </p>
2474   */
2475  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
2476
2477 /**
2478   * Search parameter: <b>url</b>
2479   * <p>
2480   * Description: <b>Network address to contact device</b><br>
2481   * Type: <b>uri</b><br>
2482   * Path: <b>Device.url</b><br>
2483   * </p>
2484   */
2485  @SearchParamDefinition(name="url", path="Device.url", description="Network address to contact device", type="uri" )
2486  public static final String SP_URL = "url";
2487 /**
2488   * <b>Fluent Client</b> search parameter constant for <b>url</b>
2489   * <p>
2490   * Description: <b>Network address to contact device</b><br>
2491   * Type: <b>uri</b><br>
2492   * Path: <b>Device.url</b><br>
2493   * </p>
2494   */
2495  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
2496
2497 /**
2498   * Search parameter: <b>manufacturer</b>
2499   * <p>
2500   * Description: <b>The manufacturer of the device</b><br>
2501   * Type: <b>string</b><br>
2502   * Path: <b>Device.manufacturer</b><br>
2503   * </p>
2504   */
2505  @SearchParamDefinition(name="manufacturer", path="Device.manufacturer", description="The manufacturer of the device", type="string" )
2506  public static final String SP_MANUFACTURER = "manufacturer";
2507 /**
2508   * <b>Fluent Client</b> search parameter constant for <b>manufacturer</b>
2509   * <p>
2510   * Description: <b>The manufacturer of the device</b><br>
2511   * Type: <b>string</b><br>
2512   * Path: <b>Device.manufacturer</b><br>
2513   * </p>
2514   */
2515  public static final ca.uhn.fhir.rest.gclient.StringClientParam MANUFACTURER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_MANUFACTURER);
2516
2517 /**
2518   * Search parameter: <b>status</b>
2519   * <p>
2520   * Description: <b>active | inactive | entered-in-error | unknown</b><br>
2521   * Type: <b>token</b><br>
2522   * Path: <b>Device.status</b><br>
2523   * </p>
2524   */
2525  @SearchParamDefinition(name="status", path="Device.status", description="active | inactive | entered-in-error | unknown", type="token" )
2526  public static final String SP_STATUS = "status";
2527 /**
2528   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2529   * <p>
2530   * Description: <b>active | inactive | entered-in-error | unknown</b><br>
2531   * Type: <b>token</b><br>
2532   * Path: <b>Device.status</b><br>
2533   * </p>
2534   */
2535  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2536
2537
2538}
2539