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 Thu, Sep 13, 2018 09:04-0400 for FHIR v3.5.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 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. This is the catalog description of a device (not the specific instance).
047 */
048@ResourceDef(name="Device", profile="http://hl7.org/fhir/StructureDefinition/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    public enum DeviceNameType {
332        /**
333         * UDI Label name.
334         */
335        UDILABELNAME, 
336        /**
337         * User Friendly name.
338         */
339        USERFRIENDLYNAME, 
340        /**
341         * Patient Reported name.
342         */
343        PATIENTREPORTEDNAME, 
344        /**
345         * Manufacturer name.
346         */
347        MANUFACTURERNAME, 
348        /**
349         * Model name.
350         */
351        MODELNAME, 
352        /**
353         * other.
354         */
355        OTHER, 
356        /**
357         * added to help the parsers with the generic types
358         */
359        NULL;
360        public static DeviceNameType fromCode(String codeString) throws FHIRException {
361            if (codeString == null || "".equals(codeString))
362                return null;
363        if ("udi-label-name".equals(codeString))
364          return UDILABELNAME;
365        if ("user-friendly-name".equals(codeString))
366          return USERFRIENDLYNAME;
367        if ("patient-reported-name".equals(codeString))
368          return PATIENTREPORTEDNAME;
369        if ("manufacturer-name".equals(codeString))
370          return MANUFACTURERNAME;
371        if ("model-name".equals(codeString))
372          return MODELNAME;
373        if ("other".equals(codeString))
374          return OTHER;
375        if (Configuration.isAcceptInvalidEnums())
376          return null;
377        else
378          throw new FHIRException("Unknown DeviceNameType code '"+codeString+"'");
379        }
380        public String toCode() {
381          switch (this) {
382            case UDILABELNAME: return "udi-label-name";
383            case USERFRIENDLYNAME: return "user-friendly-name";
384            case PATIENTREPORTEDNAME: return "patient-reported-name";
385            case MANUFACTURERNAME: return "manufacturer-name";
386            case MODELNAME: return "model-name";
387            case OTHER: return "other";
388            default: return "?";
389          }
390        }
391        public String getSystem() {
392          switch (this) {
393            case UDILABELNAME: return "http://hl7.org/fhir/device-nametype";
394            case USERFRIENDLYNAME: return "http://hl7.org/fhir/device-nametype";
395            case PATIENTREPORTEDNAME: return "http://hl7.org/fhir/device-nametype";
396            case MANUFACTURERNAME: return "http://hl7.org/fhir/device-nametype";
397            case MODELNAME: return "http://hl7.org/fhir/device-nametype";
398            case OTHER: return "http://hl7.org/fhir/device-nametype";
399            default: return "?";
400          }
401        }
402        public String getDefinition() {
403          switch (this) {
404            case UDILABELNAME: return "UDI Label name.";
405            case USERFRIENDLYNAME: return "User Friendly name.";
406            case PATIENTREPORTEDNAME: return "Patient Reported name.";
407            case MANUFACTURERNAME: return "Manufacturer name.";
408            case MODELNAME: return "Model name.";
409            case OTHER: return "other.";
410            default: return "?";
411          }
412        }
413        public String getDisplay() {
414          switch (this) {
415            case UDILABELNAME: return "UDI Label name";
416            case USERFRIENDLYNAME: return "User Friendly name";
417            case PATIENTREPORTEDNAME: return "Patient Reported name";
418            case MANUFACTURERNAME: return "Manufacturer name";
419            case MODELNAME: return "Model name";
420            case OTHER: return "other";
421            default: return "?";
422          }
423        }
424    }
425
426  public static class DeviceNameTypeEnumFactory implements EnumFactory<DeviceNameType> {
427    public DeviceNameType fromCode(String codeString) throws IllegalArgumentException {
428      if (codeString == null || "".equals(codeString))
429            if (codeString == null || "".equals(codeString))
430                return null;
431        if ("udi-label-name".equals(codeString))
432          return DeviceNameType.UDILABELNAME;
433        if ("user-friendly-name".equals(codeString))
434          return DeviceNameType.USERFRIENDLYNAME;
435        if ("patient-reported-name".equals(codeString))
436          return DeviceNameType.PATIENTREPORTEDNAME;
437        if ("manufacturer-name".equals(codeString))
438          return DeviceNameType.MANUFACTURERNAME;
439        if ("model-name".equals(codeString))
440          return DeviceNameType.MODELNAME;
441        if ("other".equals(codeString))
442          return DeviceNameType.OTHER;
443        throw new IllegalArgumentException("Unknown DeviceNameType code '"+codeString+"'");
444        }
445        public Enumeration<DeviceNameType> fromType(Base code) throws FHIRException {
446          if (code == null)
447            return null;
448          if (code.isEmpty())
449            return new Enumeration<DeviceNameType>(this);
450          String codeString = ((PrimitiveType) code).asStringValue();
451          if (codeString == null || "".equals(codeString))
452            return null;
453        if ("udi-label-name".equals(codeString))
454          return new Enumeration<DeviceNameType>(this, DeviceNameType.UDILABELNAME);
455        if ("user-friendly-name".equals(codeString))
456          return new Enumeration<DeviceNameType>(this, DeviceNameType.USERFRIENDLYNAME);
457        if ("patient-reported-name".equals(codeString))
458          return new Enumeration<DeviceNameType>(this, DeviceNameType.PATIENTREPORTEDNAME);
459        if ("manufacturer-name".equals(codeString))
460          return new Enumeration<DeviceNameType>(this, DeviceNameType.MANUFACTURERNAME);
461        if ("model-name".equals(codeString))
462          return new Enumeration<DeviceNameType>(this, DeviceNameType.MODELNAME);
463        if ("other".equals(codeString))
464          return new Enumeration<DeviceNameType>(this, DeviceNameType.OTHER);
465        throw new FHIRException("Unknown DeviceNameType code '"+codeString+"'");
466        }
467    public String toCode(DeviceNameType code) {
468      if (code == DeviceNameType.UDILABELNAME)
469        return "udi-label-name";
470      if (code == DeviceNameType.USERFRIENDLYNAME)
471        return "user-friendly-name";
472      if (code == DeviceNameType.PATIENTREPORTEDNAME)
473        return "patient-reported-name";
474      if (code == DeviceNameType.MANUFACTURERNAME)
475        return "manufacturer-name";
476      if (code == DeviceNameType.MODELNAME)
477        return "model-name";
478      if (code == DeviceNameType.OTHER)
479        return "other";
480      return "?";
481      }
482    public String toSystem(DeviceNameType code) {
483      return code.getSystem();
484      }
485    }
486
487    @Block()
488    public static class DeviceUdiCarrierComponent extends BackboneElement implements IBaseBackboneElement {
489        /**
490         * 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.
491         */
492        @Child(name = "deviceIdentifier", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
493        @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." )
494        protected StringType deviceIdentifier;
495
496        /**
497         * Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :
4981) GS1: 
499http://hl7.org/fhir/NamingSystem/gs1-di, 
5002) HIBCC:
501http://hl7.org/fhir/NamingSystem/hibcc-dI, 
5023) ICCBBA for blood containers:
503http://hl7.org/fhir/NamingSystem/iccbba-blood-di, 
5044) ICCBA for other devices:
505http://hl7.org/fhir/NamingSystem/iccbba-other-di.
506         */
507        @Child(name = "issuer", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=false)
508        @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." )
509        protected UriType issuer;
510
511        /**
512         * 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.
513         */
514        @Child(name = "jurisdiction", type = {UriType.class}, order=3, min=0, max=1, modifier=false, summary=false)
515        @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." )
516        protected UriType jurisdiction;
517
518        /**
519         * 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.
520         */
521        @Child(name = "carrierAIDC", type = {Base64BinaryType.class}, order=4, min=0, max=1, modifier=false, summary=true)
522        @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." )
523        protected Base64BinaryType carrierAIDC;
524
525        /**
526         * The full UDI carrier as the human readable form (HRF) representation of the barcode string as printed on the packaging of the device.
527         */
528        @Child(name = "carrierHRF", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
529        @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." )
530        protected StringType carrierHRF;
531
532        /**
533         * A coded entry to indicate how the data was entered.
534         */
535        @Child(name = "entryType", type = {CodeType.class}, order=6, min=0, max=1, modifier=false, summary=false)
536        @Description(shortDefinition="barcode | rfid | manual +", formalDefinition="A coded entry to indicate how the data was entered." )
537        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/udi-entry-type")
538        protected Enumeration<UDIEntryType> entryType;
539
540        private static final long serialVersionUID = -191630425L;
541
542    /**
543     * Constructor
544     */
545      public DeviceUdiCarrierComponent() {
546        super();
547      }
548
549        /**
550         * @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
551         */
552        public StringType getDeviceIdentifierElement() { 
553          if (this.deviceIdentifier == null)
554            if (Configuration.errorOnAutoCreate())
555              throw new Error("Attempt to auto-create DeviceUdiCarrierComponent.deviceIdentifier");
556            else if (Configuration.doAutoCreate())
557              this.deviceIdentifier = new StringType(); // bb
558          return this.deviceIdentifier;
559        }
560
561        public boolean hasDeviceIdentifierElement() { 
562          return this.deviceIdentifier != null && !this.deviceIdentifier.isEmpty();
563        }
564
565        public boolean hasDeviceIdentifier() { 
566          return this.deviceIdentifier != null && !this.deviceIdentifier.isEmpty();
567        }
568
569        /**
570         * @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
571         */
572        public DeviceUdiCarrierComponent setDeviceIdentifierElement(StringType value) { 
573          this.deviceIdentifier = value;
574          return this;
575        }
576
577        /**
578         * @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.
579         */
580        public String getDeviceIdentifier() { 
581          return this.deviceIdentifier == null ? null : this.deviceIdentifier.getValue();
582        }
583
584        /**
585         * @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.
586         */
587        public DeviceUdiCarrierComponent setDeviceIdentifier(String value) { 
588          if (Utilities.noString(value))
589            this.deviceIdentifier = null;
590          else {
591            if (this.deviceIdentifier == null)
592              this.deviceIdentifier = new StringType();
593            this.deviceIdentifier.setValue(value);
594          }
595          return this;
596        }
597
598        /**
599         * @return {@link #issuer} (Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :
6001) GS1: 
601http://hl7.org/fhir/NamingSystem/gs1-di, 
6022) HIBCC:
603http://hl7.org/fhir/NamingSystem/hibcc-dI, 
6043) ICCBBA for blood containers:
605http://hl7.org/fhir/NamingSystem/iccbba-blood-di, 
6064) ICCBA for other devices:
607http://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
608         */
609        public UriType getIssuerElement() { 
610          if (this.issuer == null)
611            if (Configuration.errorOnAutoCreate())
612              throw new Error("Attempt to auto-create DeviceUdiCarrierComponent.issuer");
613            else if (Configuration.doAutoCreate())
614              this.issuer = new UriType(); // bb
615          return this.issuer;
616        }
617
618        public boolean hasIssuerElement() { 
619          return this.issuer != null && !this.issuer.isEmpty();
620        }
621
622        public boolean hasIssuer() { 
623          return this.issuer != null && !this.issuer.isEmpty();
624        }
625
626        /**
627         * @param value {@link #issuer} (Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :
6281) GS1: 
629http://hl7.org/fhir/NamingSystem/gs1-di, 
6302) HIBCC:
631http://hl7.org/fhir/NamingSystem/hibcc-dI, 
6323) ICCBBA for blood containers:
633http://hl7.org/fhir/NamingSystem/iccbba-blood-di, 
6344) ICCBA for other devices:
635http://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
636         */
637        public DeviceUdiCarrierComponent setIssuerElement(UriType value) { 
638          this.issuer = value;
639          return this;
640        }
641
642        /**
643         * @return Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :
6441) GS1: 
645http://hl7.org/fhir/NamingSystem/gs1-di, 
6462) HIBCC:
647http://hl7.org/fhir/NamingSystem/hibcc-dI, 
6483) ICCBBA for blood containers:
649http://hl7.org/fhir/NamingSystem/iccbba-blood-di, 
6504) ICCBA for other devices:
651http://hl7.org/fhir/NamingSystem/iccbba-other-di.
652         */
653        public String getIssuer() { 
654          return this.issuer == null ? null : this.issuer.getValue();
655        }
656
657        /**
658         * @param value Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :
6591) GS1: 
660http://hl7.org/fhir/NamingSystem/gs1-di, 
6612) HIBCC:
662http://hl7.org/fhir/NamingSystem/hibcc-dI, 
6633) ICCBBA for blood containers:
664http://hl7.org/fhir/NamingSystem/iccbba-blood-di, 
6654) ICCBA for other devices:
666http://hl7.org/fhir/NamingSystem/iccbba-other-di.
667         */
668        public DeviceUdiCarrierComponent setIssuer(String value) { 
669          if (Utilities.noString(value))
670            this.issuer = null;
671          else {
672            if (this.issuer == null)
673              this.issuer = new UriType();
674            this.issuer.setValue(value);
675          }
676          return this;
677        }
678
679        /**
680         * @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
681         */
682        public UriType getJurisdictionElement() { 
683          if (this.jurisdiction == null)
684            if (Configuration.errorOnAutoCreate())
685              throw new Error("Attempt to auto-create DeviceUdiCarrierComponent.jurisdiction");
686            else if (Configuration.doAutoCreate())
687              this.jurisdiction = new UriType(); // bb
688          return this.jurisdiction;
689        }
690
691        public boolean hasJurisdictionElement() { 
692          return this.jurisdiction != null && !this.jurisdiction.isEmpty();
693        }
694
695        public boolean hasJurisdiction() { 
696          return this.jurisdiction != null && !this.jurisdiction.isEmpty();
697        }
698
699        /**
700         * @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
701         */
702        public DeviceUdiCarrierComponent setJurisdictionElement(UriType value) { 
703          this.jurisdiction = value;
704          return this;
705        }
706
707        /**
708         * @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.
709         */
710        public String getJurisdiction() { 
711          return this.jurisdiction == null ? null : this.jurisdiction.getValue();
712        }
713
714        /**
715         * @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.
716         */
717        public DeviceUdiCarrierComponent setJurisdiction(String value) { 
718          if (Utilities.noString(value))
719            this.jurisdiction = null;
720          else {
721            if (this.jurisdiction == null)
722              this.jurisdiction = new UriType();
723            this.jurisdiction.setValue(value);
724          }
725          return this;
726        }
727
728        /**
729         * @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
730         */
731        public Base64BinaryType getCarrierAIDCElement() { 
732          if (this.carrierAIDC == null)
733            if (Configuration.errorOnAutoCreate())
734              throw new Error("Attempt to auto-create DeviceUdiCarrierComponent.carrierAIDC");
735            else if (Configuration.doAutoCreate())
736              this.carrierAIDC = new Base64BinaryType(); // bb
737          return this.carrierAIDC;
738        }
739
740        public boolean hasCarrierAIDCElement() { 
741          return this.carrierAIDC != null && !this.carrierAIDC.isEmpty();
742        }
743
744        public boolean hasCarrierAIDC() { 
745          return this.carrierAIDC != null && !this.carrierAIDC.isEmpty();
746        }
747
748        /**
749         * @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
750         */
751        public DeviceUdiCarrierComponent setCarrierAIDCElement(Base64BinaryType value) { 
752          this.carrierAIDC = value;
753          return this;
754        }
755
756        /**
757         * @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.
758         */
759        public byte[] getCarrierAIDC() { 
760          return this.carrierAIDC == null ? null : this.carrierAIDC.getValue();
761        }
762
763        /**
764         * @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.
765         */
766        public DeviceUdiCarrierComponent setCarrierAIDC(byte[] value) { 
767          if (value == null)
768            this.carrierAIDC = null;
769          else {
770            if (this.carrierAIDC == null)
771              this.carrierAIDC = new Base64BinaryType();
772            this.carrierAIDC.setValue(value);
773          }
774          return this;
775        }
776
777        /**
778         * @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
779         */
780        public StringType getCarrierHRFElement() { 
781          if (this.carrierHRF == null)
782            if (Configuration.errorOnAutoCreate())
783              throw new Error("Attempt to auto-create DeviceUdiCarrierComponent.carrierHRF");
784            else if (Configuration.doAutoCreate())
785              this.carrierHRF = new StringType(); // bb
786          return this.carrierHRF;
787        }
788
789        public boolean hasCarrierHRFElement() { 
790          return this.carrierHRF != null && !this.carrierHRF.isEmpty();
791        }
792
793        public boolean hasCarrierHRF() { 
794          return this.carrierHRF != null && !this.carrierHRF.isEmpty();
795        }
796
797        /**
798         * @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
799         */
800        public DeviceUdiCarrierComponent setCarrierHRFElement(StringType value) { 
801          this.carrierHRF = value;
802          return this;
803        }
804
805        /**
806         * @return The full UDI carrier as the human readable form (HRF) representation of the barcode string as printed on the packaging of the device.
807         */
808        public String getCarrierHRF() { 
809          return this.carrierHRF == null ? null : this.carrierHRF.getValue();
810        }
811
812        /**
813         * @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.
814         */
815        public DeviceUdiCarrierComponent setCarrierHRF(String value) { 
816          if (Utilities.noString(value))
817            this.carrierHRF = null;
818          else {
819            if (this.carrierHRF == null)
820              this.carrierHRF = new StringType();
821            this.carrierHRF.setValue(value);
822          }
823          return this;
824        }
825
826        /**
827         * @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
828         */
829        public Enumeration<UDIEntryType> getEntryTypeElement() { 
830          if (this.entryType == null)
831            if (Configuration.errorOnAutoCreate())
832              throw new Error("Attempt to auto-create DeviceUdiCarrierComponent.entryType");
833            else if (Configuration.doAutoCreate())
834              this.entryType = new Enumeration<UDIEntryType>(new UDIEntryTypeEnumFactory()); // bb
835          return this.entryType;
836        }
837
838        public boolean hasEntryTypeElement() { 
839          return this.entryType != null && !this.entryType.isEmpty();
840        }
841
842        public boolean hasEntryType() { 
843          return this.entryType != null && !this.entryType.isEmpty();
844        }
845
846        /**
847         * @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
848         */
849        public DeviceUdiCarrierComponent setEntryTypeElement(Enumeration<UDIEntryType> value) { 
850          this.entryType = value;
851          return this;
852        }
853
854        /**
855         * @return A coded entry to indicate how the data was entered.
856         */
857        public UDIEntryType getEntryType() { 
858          return this.entryType == null ? null : this.entryType.getValue();
859        }
860
861        /**
862         * @param value A coded entry to indicate how the data was entered.
863         */
864        public DeviceUdiCarrierComponent setEntryType(UDIEntryType value) { 
865          if (value == null)
866            this.entryType = null;
867          else {
868            if (this.entryType == null)
869              this.entryType = new Enumeration<UDIEntryType>(new UDIEntryTypeEnumFactory());
870            this.entryType.setValue(value);
871          }
872          return this;
873        }
874
875        protected void listChildren(List<Property> children) {
876          super.listChildren(children);
877          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));
878          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));
879          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));
880          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));
881          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));
882          children.add(new Property("entryType", "code", "A coded entry to indicate how the data was entered.", 0, 1, entryType));
883        }
884
885        @Override
886        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
887          switch (_hash) {
888          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);
889          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);
890          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);
891          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);
892          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);
893          case -479362356: /*entryType*/  return new Property("entryType", "code", "A coded entry to indicate how the data was entered.", 0, 1, entryType);
894          default: return super.getNamedProperty(_hash, _name, _checkValid);
895          }
896
897        }
898
899      @Override
900      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
901        switch (hash) {
902        case 1322005407: /*deviceIdentifier*/ return this.deviceIdentifier == null ? new Base[0] : new Base[] {this.deviceIdentifier}; // StringType
903        case -1179159879: /*issuer*/ return this.issuer == null ? new Base[0] : new Base[] {this.issuer}; // UriType
904        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : new Base[] {this.jurisdiction}; // UriType
905        case -768521825: /*carrierAIDC*/ return this.carrierAIDC == null ? new Base[0] : new Base[] {this.carrierAIDC}; // Base64BinaryType
906        case 806499972: /*carrierHRF*/ return this.carrierHRF == null ? new Base[0] : new Base[] {this.carrierHRF}; // StringType
907        case -479362356: /*entryType*/ return this.entryType == null ? new Base[0] : new Base[] {this.entryType}; // Enumeration<UDIEntryType>
908        default: return super.getProperty(hash, name, checkValid);
909        }
910
911      }
912
913      @Override
914      public Base setProperty(int hash, String name, Base value) throws FHIRException {
915        switch (hash) {
916        case 1322005407: // deviceIdentifier
917          this.deviceIdentifier = castToString(value); // StringType
918          return value;
919        case -1179159879: // issuer
920          this.issuer = castToUri(value); // UriType
921          return value;
922        case -507075711: // jurisdiction
923          this.jurisdiction = castToUri(value); // UriType
924          return value;
925        case -768521825: // carrierAIDC
926          this.carrierAIDC = castToBase64Binary(value); // Base64BinaryType
927          return value;
928        case 806499972: // carrierHRF
929          this.carrierHRF = castToString(value); // StringType
930          return value;
931        case -479362356: // entryType
932          value = new UDIEntryTypeEnumFactory().fromType(castToCode(value));
933          this.entryType = (Enumeration) value; // Enumeration<UDIEntryType>
934          return value;
935        default: return super.setProperty(hash, name, value);
936        }
937
938      }
939
940      @Override
941      public Base setProperty(String name, Base value) throws FHIRException {
942        if (name.equals("deviceIdentifier")) {
943          this.deviceIdentifier = castToString(value); // StringType
944        } else if (name.equals("issuer")) {
945          this.issuer = castToUri(value); // UriType
946        } else if (name.equals("jurisdiction")) {
947          this.jurisdiction = castToUri(value); // UriType
948        } else if (name.equals("carrierAIDC")) {
949          this.carrierAIDC = castToBase64Binary(value); // Base64BinaryType
950        } else if (name.equals("carrierHRF")) {
951          this.carrierHRF = castToString(value); // StringType
952        } else if (name.equals("entryType")) {
953          value = new UDIEntryTypeEnumFactory().fromType(castToCode(value));
954          this.entryType = (Enumeration) value; // Enumeration<UDIEntryType>
955        } else
956          return super.setProperty(name, value);
957        return value;
958      }
959
960      @Override
961      public Base makeProperty(int hash, String name) throws FHIRException {
962        switch (hash) {
963        case 1322005407:  return getDeviceIdentifierElement();
964        case -1179159879:  return getIssuerElement();
965        case -507075711:  return getJurisdictionElement();
966        case -768521825:  return getCarrierAIDCElement();
967        case 806499972:  return getCarrierHRFElement();
968        case -479362356:  return getEntryTypeElement();
969        default: return super.makeProperty(hash, name);
970        }
971
972      }
973
974      @Override
975      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
976        switch (hash) {
977        case 1322005407: /*deviceIdentifier*/ return new String[] {"string"};
978        case -1179159879: /*issuer*/ return new String[] {"uri"};
979        case -507075711: /*jurisdiction*/ return new String[] {"uri"};
980        case -768521825: /*carrierAIDC*/ return new String[] {"base64Binary"};
981        case 806499972: /*carrierHRF*/ return new String[] {"string"};
982        case -479362356: /*entryType*/ return new String[] {"code"};
983        default: return super.getTypesForProperty(hash, name);
984        }
985
986      }
987
988      @Override
989      public Base addChild(String name) throws FHIRException {
990        if (name.equals("deviceIdentifier")) {
991          throw new FHIRException("Cannot call addChild on a primitive type Device.deviceIdentifier");
992        }
993        else if (name.equals("issuer")) {
994          throw new FHIRException("Cannot call addChild on a primitive type Device.issuer");
995        }
996        else if (name.equals("jurisdiction")) {
997          throw new FHIRException("Cannot call addChild on a primitive type Device.jurisdiction");
998        }
999        else if (name.equals("carrierAIDC")) {
1000          throw new FHIRException("Cannot call addChild on a primitive type Device.carrierAIDC");
1001        }
1002        else if (name.equals("carrierHRF")) {
1003          throw new FHIRException("Cannot call addChild on a primitive type Device.carrierHRF");
1004        }
1005        else if (name.equals("entryType")) {
1006          throw new FHIRException("Cannot call addChild on a primitive type Device.entryType");
1007        }
1008        else
1009          return super.addChild(name);
1010      }
1011
1012      public DeviceUdiCarrierComponent copy() {
1013        DeviceUdiCarrierComponent dst = new DeviceUdiCarrierComponent();
1014        copyValues(dst);
1015        dst.deviceIdentifier = deviceIdentifier == null ? null : deviceIdentifier.copy();
1016        dst.issuer = issuer == null ? null : issuer.copy();
1017        dst.jurisdiction = jurisdiction == null ? null : jurisdiction.copy();
1018        dst.carrierAIDC = carrierAIDC == null ? null : carrierAIDC.copy();
1019        dst.carrierHRF = carrierHRF == null ? null : carrierHRF.copy();
1020        dst.entryType = entryType == null ? null : entryType.copy();
1021        return dst;
1022      }
1023
1024      @Override
1025      public boolean equalsDeep(Base other_) {
1026        if (!super.equalsDeep(other_))
1027          return false;
1028        if (!(other_ instanceof DeviceUdiCarrierComponent))
1029          return false;
1030        DeviceUdiCarrierComponent o = (DeviceUdiCarrierComponent) other_;
1031        return compareDeep(deviceIdentifier, o.deviceIdentifier, true) && compareDeep(issuer, o.issuer, true)
1032           && compareDeep(jurisdiction, o.jurisdiction, true) && compareDeep(carrierAIDC, o.carrierAIDC, true)
1033           && compareDeep(carrierHRF, o.carrierHRF, true) && compareDeep(entryType, o.entryType, true);
1034      }
1035
1036      @Override
1037      public boolean equalsShallow(Base other_) {
1038        if (!super.equalsShallow(other_))
1039          return false;
1040        if (!(other_ instanceof DeviceUdiCarrierComponent))
1041          return false;
1042        DeviceUdiCarrierComponent o = (DeviceUdiCarrierComponent) other_;
1043        return compareValues(deviceIdentifier, o.deviceIdentifier, true) && compareValues(issuer, o.issuer, true)
1044           && compareValues(jurisdiction, o.jurisdiction, true) && compareValues(carrierAIDC, o.carrierAIDC, true)
1045           && compareValues(carrierHRF, o.carrierHRF, true) && compareValues(entryType, o.entryType, true);
1046      }
1047
1048      public boolean isEmpty() {
1049        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(deviceIdentifier, issuer, jurisdiction
1050          , carrierAIDC, carrierHRF, entryType);
1051      }
1052
1053  public String fhirType() {
1054    return "Device.udiCarrier";
1055
1056  }
1057
1058  }
1059
1060    @Block()
1061    public static class DeviceDeviceNameComponent extends BackboneElement implements IBaseBackboneElement {
1062        /**
1063         * The name of the device.
1064         */
1065        @Child(name = "name", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1066        @Description(shortDefinition="The name of the device", formalDefinition="The name of the device." )
1067        protected StringType name;
1068
1069        /**
1070         * The type of deviceName.
1071UDILabelName | UserFriendlyName | PatientReportedName | ManufactureDeviceName | ModelName.
1072         */
1073        @Child(name = "type", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=false)
1074        @Description(shortDefinition="udi-label-name | user-friendly-name | patient-reported-name | manufacturer-name | model-name | other", formalDefinition="The type of deviceName.\nUDILabelName | UserFriendlyName | PatientReportedName | ManufactureDeviceName | ModelName." )
1075        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-nametype")
1076        protected Enumeration<DeviceNameType> type;
1077
1078        private static final long serialVersionUID = 918983440L;
1079
1080    /**
1081     * Constructor
1082     */
1083      public DeviceDeviceNameComponent() {
1084        super();
1085      }
1086
1087    /**
1088     * Constructor
1089     */
1090      public DeviceDeviceNameComponent(StringType name, Enumeration<DeviceNameType> type) {
1091        super();
1092        this.name = name;
1093        this.type = type;
1094      }
1095
1096        /**
1097         * @return {@link #name} (The name of the device.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1098         */
1099        public StringType getNameElement() { 
1100          if (this.name == null)
1101            if (Configuration.errorOnAutoCreate())
1102              throw new Error("Attempt to auto-create DeviceDeviceNameComponent.name");
1103            else if (Configuration.doAutoCreate())
1104              this.name = new StringType(); // bb
1105          return this.name;
1106        }
1107
1108        public boolean hasNameElement() { 
1109          return this.name != null && !this.name.isEmpty();
1110        }
1111
1112        public boolean hasName() { 
1113          return this.name != null && !this.name.isEmpty();
1114        }
1115
1116        /**
1117         * @param value {@link #name} (The name of the device.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1118         */
1119        public DeviceDeviceNameComponent setNameElement(StringType value) { 
1120          this.name = value;
1121          return this;
1122        }
1123
1124        /**
1125         * @return The name of the device.
1126         */
1127        public String getName() { 
1128          return this.name == null ? null : this.name.getValue();
1129        }
1130
1131        /**
1132         * @param value The name of the device.
1133         */
1134        public DeviceDeviceNameComponent setName(String value) { 
1135            if (this.name == null)
1136              this.name = new StringType();
1137            this.name.setValue(value);
1138          return this;
1139        }
1140
1141        /**
1142         * @return {@link #type} (The type of deviceName.
1143UDILabelName | UserFriendlyName | PatientReportedName | ManufactureDeviceName | ModelName.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1144         */
1145        public Enumeration<DeviceNameType> getTypeElement() { 
1146          if (this.type == null)
1147            if (Configuration.errorOnAutoCreate())
1148              throw new Error("Attempt to auto-create DeviceDeviceNameComponent.type");
1149            else if (Configuration.doAutoCreate())
1150              this.type = new Enumeration<DeviceNameType>(new DeviceNameTypeEnumFactory()); // bb
1151          return this.type;
1152        }
1153
1154        public boolean hasTypeElement() { 
1155          return this.type != null && !this.type.isEmpty();
1156        }
1157
1158        public boolean hasType() { 
1159          return this.type != null && !this.type.isEmpty();
1160        }
1161
1162        /**
1163         * @param value {@link #type} (The type of deviceName.
1164UDILabelName | UserFriendlyName | PatientReportedName | ManufactureDeviceName | ModelName.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1165         */
1166        public DeviceDeviceNameComponent setTypeElement(Enumeration<DeviceNameType> value) { 
1167          this.type = value;
1168          return this;
1169        }
1170
1171        /**
1172         * @return The type of deviceName.
1173UDILabelName | UserFriendlyName | PatientReportedName | ManufactureDeviceName | ModelName.
1174         */
1175        public DeviceNameType getType() { 
1176          return this.type == null ? null : this.type.getValue();
1177        }
1178
1179        /**
1180         * @param value The type of deviceName.
1181UDILabelName | UserFriendlyName | PatientReportedName | ManufactureDeviceName | ModelName.
1182         */
1183        public DeviceDeviceNameComponent setType(DeviceNameType value) { 
1184            if (this.type == null)
1185              this.type = new Enumeration<DeviceNameType>(new DeviceNameTypeEnumFactory());
1186            this.type.setValue(value);
1187          return this;
1188        }
1189
1190        protected void listChildren(List<Property> children) {
1191          super.listChildren(children);
1192          children.add(new Property("name", "string", "The name of the device.", 0, 1, name));
1193          children.add(new Property("type", "code", "The type of deviceName.\nUDILabelName | UserFriendlyName | PatientReportedName | ManufactureDeviceName | ModelName.", 0, 1, type));
1194        }
1195
1196        @Override
1197        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1198          switch (_hash) {
1199          case 3373707: /*name*/  return new Property("name", "string", "The name of the device.", 0, 1, name);
1200          case 3575610: /*type*/  return new Property("type", "code", "The type of deviceName.\nUDILabelName | UserFriendlyName | PatientReportedName | ManufactureDeviceName | ModelName.", 0, 1, type);
1201          default: return super.getNamedProperty(_hash, _name, _checkValid);
1202          }
1203
1204        }
1205
1206      @Override
1207      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1208        switch (hash) {
1209        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
1210        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<DeviceNameType>
1211        default: return super.getProperty(hash, name, checkValid);
1212        }
1213
1214      }
1215
1216      @Override
1217      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1218        switch (hash) {
1219        case 3373707: // name
1220          this.name = castToString(value); // StringType
1221          return value;
1222        case 3575610: // type
1223          value = new DeviceNameTypeEnumFactory().fromType(castToCode(value));
1224          this.type = (Enumeration) value; // Enumeration<DeviceNameType>
1225          return value;
1226        default: return super.setProperty(hash, name, value);
1227        }
1228
1229      }
1230
1231      @Override
1232      public Base setProperty(String name, Base value) throws FHIRException {
1233        if (name.equals("name")) {
1234          this.name = castToString(value); // StringType
1235        } else if (name.equals("type")) {
1236          value = new DeviceNameTypeEnumFactory().fromType(castToCode(value));
1237          this.type = (Enumeration) value; // Enumeration<DeviceNameType>
1238        } else
1239          return super.setProperty(name, value);
1240        return value;
1241      }
1242
1243      @Override
1244      public Base makeProperty(int hash, String name) throws FHIRException {
1245        switch (hash) {
1246        case 3373707:  return getNameElement();
1247        case 3575610:  return getTypeElement();
1248        default: return super.makeProperty(hash, name);
1249        }
1250
1251      }
1252
1253      @Override
1254      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1255        switch (hash) {
1256        case 3373707: /*name*/ return new String[] {"string"};
1257        case 3575610: /*type*/ return new String[] {"code"};
1258        default: return super.getTypesForProperty(hash, name);
1259        }
1260
1261      }
1262
1263      @Override
1264      public Base addChild(String name) throws FHIRException {
1265        if (name.equals("name")) {
1266          throw new FHIRException("Cannot call addChild on a primitive type Device.name");
1267        }
1268        else if (name.equals("type")) {
1269          throw new FHIRException("Cannot call addChild on a primitive type Device.type");
1270        }
1271        else
1272          return super.addChild(name);
1273      }
1274
1275      public DeviceDeviceNameComponent copy() {
1276        DeviceDeviceNameComponent dst = new DeviceDeviceNameComponent();
1277        copyValues(dst);
1278        dst.name = name == null ? null : name.copy();
1279        dst.type = type == null ? null : type.copy();
1280        return dst;
1281      }
1282
1283      @Override
1284      public boolean equalsDeep(Base other_) {
1285        if (!super.equalsDeep(other_))
1286          return false;
1287        if (!(other_ instanceof DeviceDeviceNameComponent))
1288          return false;
1289        DeviceDeviceNameComponent o = (DeviceDeviceNameComponent) other_;
1290        return compareDeep(name, o.name, true) && compareDeep(type, o.type, true);
1291      }
1292
1293      @Override
1294      public boolean equalsShallow(Base other_) {
1295        if (!super.equalsShallow(other_))
1296          return false;
1297        if (!(other_ instanceof DeviceDeviceNameComponent))
1298          return false;
1299        DeviceDeviceNameComponent o = (DeviceDeviceNameComponent) other_;
1300        return compareValues(name, o.name, true) && compareValues(type, o.type, true);
1301      }
1302
1303      public boolean isEmpty() {
1304        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, type);
1305      }
1306
1307  public String fhirType() {
1308    return "Device.deviceName";
1309
1310  }
1311
1312  }
1313
1314    @Block()
1315    public static class DeviceSpecializationComponent extends BackboneElement implements IBaseBackboneElement {
1316        /**
1317         * The standard that is used to operate and communicate.
1318         */
1319        @Child(name = "systemType", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
1320        @Description(shortDefinition="The standard that is used to operate and communicate", formalDefinition="The standard that is used to operate and communicate." )
1321        protected CodeableConcept systemType;
1322
1323        /**
1324         * The version of the standard that is used to operate and communicate.
1325         */
1326        @Child(name = "version", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1327        @Description(shortDefinition="The version of the standard that is used to operate and communicate", formalDefinition="The version of the standard that is used to operate and communicate." )
1328        protected StringType version;
1329
1330        private static final long serialVersionUID = 1557342629L;
1331
1332    /**
1333     * Constructor
1334     */
1335      public DeviceSpecializationComponent() {
1336        super();
1337      }
1338
1339    /**
1340     * Constructor
1341     */
1342      public DeviceSpecializationComponent(CodeableConcept systemType) {
1343        super();
1344        this.systemType = systemType;
1345      }
1346
1347        /**
1348         * @return {@link #systemType} (The standard that is used to operate and communicate.)
1349         */
1350        public CodeableConcept getSystemType() { 
1351          if (this.systemType == null)
1352            if (Configuration.errorOnAutoCreate())
1353              throw new Error("Attempt to auto-create DeviceSpecializationComponent.systemType");
1354            else if (Configuration.doAutoCreate())
1355              this.systemType = new CodeableConcept(); // cc
1356          return this.systemType;
1357        }
1358
1359        public boolean hasSystemType() { 
1360          return this.systemType != null && !this.systemType.isEmpty();
1361        }
1362
1363        /**
1364         * @param value {@link #systemType} (The standard that is used to operate and communicate.)
1365         */
1366        public DeviceSpecializationComponent setSystemType(CodeableConcept value) { 
1367          this.systemType = value;
1368          return this;
1369        }
1370
1371        /**
1372         * @return {@link #version} (The version of the standard that is used to operate and communicate.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
1373         */
1374        public StringType getVersionElement() { 
1375          if (this.version == null)
1376            if (Configuration.errorOnAutoCreate())
1377              throw new Error("Attempt to auto-create DeviceSpecializationComponent.version");
1378            else if (Configuration.doAutoCreate())
1379              this.version = new StringType(); // bb
1380          return this.version;
1381        }
1382
1383        public boolean hasVersionElement() { 
1384          return this.version != null && !this.version.isEmpty();
1385        }
1386
1387        public boolean hasVersion() { 
1388          return this.version != null && !this.version.isEmpty();
1389        }
1390
1391        /**
1392         * @param value {@link #version} (The version of the standard that is used to operate and communicate.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
1393         */
1394        public DeviceSpecializationComponent setVersionElement(StringType value) { 
1395          this.version = value;
1396          return this;
1397        }
1398
1399        /**
1400         * @return The version of the standard that is used to operate and communicate.
1401         */
1402        public String getVersion() { 
1403          return this.version == null ? null : this.version.getValue();
1404        }
1405
1406        /**
1407         * @param value The version of the standard that is used to operate and communicate.
1408         */
1409        public DeviceSpecializationComponent setVersion(String value) { 
1410          if (Utilities.noString(value))
1411            this.version = null;
1412          else {
1413            if (this.version == null)
1414              this.version = new StringType();
1415            this.version.setValue(value);
1416          }
1417          return this;
1418        }
1419
1420        protected void listChildren(List<Property> children) {
1421          super.listChildren(children);
1422          children.add(new Property("systemType", "CodeableConcept", "The standard that is used to operate and communicate.", 0, 1, systemType));
1423          children.add(new Property("version", "string", "The version of the standard that is used to operate and communicate.", 0, 1, version));
1424        }
1425
1426        @Override
1427        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1428          switch (_hash) {
1429          case 642893321: /*systemType*/  return new Property("systemType", "CodeableConcept", "The standard that is used to operate and communicate.", 0, 1, systemType);
1430          case 351608024: /*version*/  return new Property("version", "string", "The version of the standard that is used to operate and communicate.", 0, 1, version);
1431          default: return super.getNamedProperty(_hash, _name, _checkValid);
1432          }
1433
1434        }
1435
1436      @Override
1437      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1438        switch (hash) {
1439        case 642893321: /*systemType*/ return this.systemType == null ? new Base[0] : new Base[] {this.systemType}; // CodeableConcept
1440        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
1441        default: return super.getProperty(hash, name, checkValid);
1442        }
1443
1444      }
1445
1446      @Override
1447      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1448        switch (hash) {
1449        case 642893321: // systemType
1450          this.systemType = castToCodeableConcept(value); // CodeableConcept
1451          return value;
1452        case 351608024: // version
1453          this.version = castToString(value); // StringType
1454          return value;
1455        default: return super.setProperty(hash, name, value);
1456        }
1457
1458      }
1459
1460      @Override
1461      public Base setProperty(String name, Base value) throws FHIRException {
1462        if (name.equals("systemType")) {
1463          this.systemType = castToCodeableConcept(value); // CodeableConcept
1464        } else if (name.equals("version")) {
1465          this.version = castToString(value); // StringType
1466        } else
1467          return super.setProperty(name, value);
1468        return value;
1469      }
1470
1471      @Override
1472      public Base makeProperty(int hash, String name) throws FHIRException {
1473        switch (hash) {
1474        case 642893321:  return getSystemType(); 
1475        case 351608024:  return getVersionElement();
1476        default: return super.makeProperty(hash, name);
1477        }
1478
1479      }
1480
1481      @Override
1482      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1483        switch (hash) {
1484        case 642893321: /*systemType*/ return new String[] {"CodeableConcept"};
1485        case 351608024: /*version*/ return new String[] {"string"};
1486        default: return super.getTypesForProperty(hash, name);
1487        }
1488
1489      }
1490
1491      @Override
1492      public Base addChild(String name) throws FHIRException {
1493        if (name.equals("systemType")) {
1494          this.systemType = new CodeableConcept();
1495          return this.systemType;
1496        }
1497        else if (name.equals("version")) {
1498          throw new FHIRException("Cannot call addChild on a primitive type Device.version");
1499        }
1500        else
1501          return super.addChild(name);
1502      }
1503
1504      public DeviceSpecializationComponent copy() {
1505        DeviceSpecializationComponent dst = new DeviceSpecializationComponent();
1506        copyValues(dst);
1507        dst.systemType = systemType == null ? null : systemType.copy();
1508        dst.version = version == null ? null : version.copy();
1509        return dst;
1510      }
1511
1512      @Override
1513      public boolean equalsDeep(Base other_) {
1514        if (!super.equalsDeep(other_))
1515          return false;
1516        if (!(other_ instanceof DeviceSpecializationComponent))
1517          return false;
1518        DeviceSpecializationComponent o = (DeviceSpecializationComponent) other_;
1519        return compareDeep(systemType, o.systemType, true) && compareDeep(version, o.version, true);
1520      }
1521
1522      @Override
1523      public boolean equalsShallow(Base other_) {
1524        if (!super.equalsShallow(other_))
1525          return false;
1526        if (!(other_ instanceof DeviceSpecializationComponent))
1527          return false;
1528        DeviceSpecializationComponent o = (DeviceSpecializationComponent) other_;
1529        return compareValues(version, o.version, true);
1530      }
1531
1532      public boolean isEmpty() {
1533        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(systemType, version);
1534      }
1535
1536  public String fhirType() {
1537    return "Device.specialization";
1538
1539  }
1540
1541  }
1542
1543    @Block()
1544    public static class DeviceVersionComponent extends BackboneElement implements IBaseBackboneElement {
1545        /**
1546         * The type of the device version.
1547         */
1548        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
1549        @Description(shortDefinition="The type of the device version", formalDefinition="The type of the device version." )
1550        protected CodeableConcept type;
1551
1552        /**
1553         * A single component of the device version.
1554         */
1555        @Child(name = "component", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=false)
1556        @Description(shortDefinition="A single component of the device version", formalDefinition="A single component of the device version." )
1557        protected Identifier component;
1558
1559        /**
1560         * The version text.
1561         */
1562        @Child(name = "value", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=false)
1563        @Description(shortDefinition="The version text", formalDefinition="The version text." )
1564        protected StringType value;
1565
1566        private static final long serialVersionUID = 645214295L;
1567
1568    /**
1569     * Constructor
1570     */
1571      public DeviceVersionComponent() {
1572        super();
1573      }
1574
1575    /**
1576     * Constructor
1577     */
1578      public DeviceVersionComponent(StringType value) {
1579        super();
1580        this.value = value;
1581      }
1582
1583        /**
1584         * @return {@link #type} (The type of the device version.)
1585         */
1586        public CodeableConcept getType() { 
1587          if (this.type == null)
1588            if (Configuration.errorOnAutoCreate())
1589              throw new Error("Attempt to auto-create DeviceVersionComponent.type");
1590            else if (Configuration.doAutoCreate())
1591              this.type = new CodeableConcept(); // cc
1592          return this.type;
1593        }
1594
1595        public boolean hasType() { 
1596          return this.type != null && !this.type.isEmpty();
1597        }
1598
1599        /**
1600         * @param value {@link #type} (The type of the device version.)
1601         */
1602        public DeviceVersionComponent setType(CodeableConcept value) { 
1603          this.type = value;
1604          return this;
1605        }
1606
1607        /**
1608         * @return {@link #component} (A single component of the device version.)
1609         */
1610        public Identifier getComponent() { 
1611          if (this.component == null)
1612            if (Configuration.errorOnAutoCreate())
1613              throw new Error("Attempt to auto-create DeviceVersionComponent.component");
1614            else if (Configuration.doAutoCreate())
1615              this.component = new Identifier(); // cc
1616          return this.component;
1617        }
1618
1619        public boolean hasComponent() { 
1620          return this.component != null && !this.component.isEmpty();
1621        }
1622
1623        /**
1624         * @param value {@link #component} (A single component of the device version.)
1625         */
1626        public DeviceVersionComponent setComponent(Identifier value) { 
1627          this.component = value;
1628          return this;
1629        }
1630
1631        /**
1632         * @return {@link #value} (The version text.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
1633         */
1634        public StringType getValueElement() { 
1635          if (this.value == null)
1636            if (Configuration.errorOnAutoCreate())
1637              throw new Error("Attempt to auto-create DeviceVersionComponent.value");
1638            else if (Configuration.doAutoCreate())
1639              this.value = new StringType(); // bb
1640          return this.value;
1641        }
1642
1643        public boolean hasValueElement() { 
1644          return this.value != null && !this.value.isEmpty();
1645        }
1646
1647        public boolean hasValue() { 
1648          return this.value != null && !this.value.isEmpty();
1649        }
1650
1651        /**
1652         * @param value {@link #value} (The version text.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
1653         */
1654        public DeviceVersionComponent setValueElement(StringType value) { 
1655          this.value = value;
1656          return this;
1657        }
1658
1659        /**
1660         * @return The version text.
1661         */
1662        public String getValue() { 
1663          return this.value == null ? null : this.value.getValue();
1664        }
1665
1666        /**
1667         * @param value The version text.
1668         */
1669        public DeviceVersionComponent setValue(String value) { 
1670            if (this.value == null)
1671              this.value = new StringType();
1672            this.value.setValue(value);
1673          return this;
1674        }
1675
1676        protected void listChildren(List<Property> children) {
1677          super.listChildren(children);
1678          children.add(new Property("type", "CodeableConcept", "The type of the device version.", 0, 1, type));
1679          children.add(new Property("component", "Identifier", "A single component of the device version.", 0, 1, component));
1680          children.add(new Property("value", "string", "The version text.", 0, 1, value));
1681        }
1682
1683        @Override
1684        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1685          switch (_hash) {
1686          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of the device version.", 0, 1, type);
1687          case -1399907075: /*component*/  return new Property("component", "Identifier", "A single component of the device version.", 0, 1, component);
1688          case 111972721: /*value*/  return new Property("value", "string", "The version text.", 0, 1, value);
1689          default: return super.getNamedProperty(_hash, _name, _checkValid);
1690          }
1691
1692        }
1693
1694      @Override
1695      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1696        switch (hash) {
1697        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1698        case -1399907075: /*component*/ return this.component == null ? new Base[0] : new Base[] {this.component}; // Identifier
1699        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType
1700        default: return super.getProperty(hash, name, checkValid);
1701        }
1702
1703      }
1704
1705      @Override
1706      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1707        switch (hash) {
1708        case 3575610: // type
1709          this.type = castToCodeableConcept(value); // CodeableConcept
1710          return value;
1711        case -1399907075: // component
1712          this.component = castToIdentifier(value); // Identifier
1713          return value;
1714        case 111972721: // value
1715          this.value = castToString(value); // StringType
1716          return value;
1717        default: return super.setProperty(hash, name, value);
1718        }
1719
1720      }
1721
1722      @Override
1723      public Base setProperty(String name, Base value) throws FHIRException {
1724        if (name.equals("type")) {
1725          this.type = castToCodeableConcept(value); // CodeableConcept
1726        } else if (name.equals("component")) {
1727          this.component = castToIdentifier(value); // Identifier
1728        } else if (name.equals("value")) {
1729          this.value = castToString(value); // StringType
1730        } else
1731          return super.setProperty(name, value);
1732        return value;
1733      }
1734
1735      @Override
1736      public Base makeProperty(int hash, String name) throws FHIRException {
1737        switch (hash) {
1738        case 3575610:  return getType(); 
1739        case -1399907075:  return getComponent(); 
1740        case 111972721:  return getValueElement();
1741        default: return super.makeProperty(hash, name);
1742        }
1743
1744      }
1745
1746      @Override
1747      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1748        switch (hash) {
1749        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1750        case -1399907075: /*component*/ return new String[] {"Identifier"};
1751        case 111972721: /*value*/ return new String[] {"string"};
1752        default: return super.getTypesForProperty(hash, name);
1753        }
1754
1755      }
1756
1757      @Override
1758      public Base addChild(String name) throws FHIRException {
1759        if (name.equals("type")) {
1760          this.type = new CodeableConcept();
1761          return this.type;
1762        }
1763        else if (name.equals("component")) {
1764          this.component = new Identifier();
1765          return this.component;
1766        }
1767        else if (name.equals("value")) {
1768          throw new FHIRException("Cannot call addChild on a primitive type Device.value");
1769        }
1770        else
1771          return super.addChild(name);
1772      }
1773
1774      public DeviceVersionComponent copy() {
1775        DeviceVersionComponent dst = new DeviceVersionComponent();
1776        copyValues(dst);
1777        dst.type = type == null ? null : type.copy();
1778        dst.component = component == null ? null : component.copy();
1779        dst.value = value == null ? null : value.copy();
1780        return dst;
1781      }
1782
1783      @Override
1784      public boolean equalsDeep(Base other_) {
1785        if (!super.equalsDeep(other_))
1786          return false;
1787        if (!(other_ instanceof DeviceVersionComponent))
1788          return false;
1789        DeviceVersionComponent o = (DeviceVersionComponent) other_;
1790        return compareDeep(type, o.type, true) && compareDeep(component, o.component, true) && compareDeep(value, o.value, true)
1791          ;
1792      }
1793
1794      @Override
1795      public boolean equalsShallow(Base other_) {
1796        if (!super.equalsShallow(other_))
1797          return false;
1798        if (!(other_ instanceof DeviceVersionComponent))
1799          return false;
1800        DeviceVersionComponent o = (DeviceVersionComponent) other_;
1801        return compareValues(value, o.value, true);
1802      }
1803
1804      public boolean isEmpty() {
1805        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, component, value);
1806      }
1807
1808  public String fhirType() {
1809    return "Device.version";
1810
1811  }
1812
1813  }
1814
1815    @Block()
1816    public static class DevicePropertyComponent extends BackboneElement implements IBaseBackboneElement {
1817        /**
1818         * Code that specifies the property DeviceDefinitionPropetyCode (Extensible).
1819         */
1820        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
1821        @Description(shortDefinition="Code that specifies the property DeviceDefinitionPropetyCode (Extensible)", formalDefinition="Code that specifies the property DeviceDefinitionPropetyCode (Extensible)." )
1822        protected CodeableConcept type;
1823
1824        /**
1825         * Property value as a quantity.
1826         */
1827        @Child(name = "valueQuanity", type = {Quantity.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1828        @Description(shortDefinition="Property value as a quantity", formalDefinition="Property value as a quantity." )
1829        protected List<Quantity> valueQuanity;
1830
1831        /**
1832         * Property value as a code, e.g., NTP4 (synced to NTP).
1833         */
1834        @Child(name = "valueCode", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1835        @Description(shortDefinition="Property value as a code, e.g., NTP4 (synced to NTP)", formalDefinition="Property value as a code, e.g., NTP4 (synced to NTP)." )
1836        protected List<CodeableConcept> valueCode;
1837
1838        private static final long serialVersionUID = 1035620625L;
1839
1840    /**
1841     * Constructor
1842     */
1843      public DevicePropertyComponent() {
1844        super();
1845      }
1846
1847    /**
1848     * Constructor
1849     */
1850      public DevicePropertyComponent(CodeableConcept type) {
1851        super();
1852        this.type = type;
1853      }
1854
1855        /**
1856         * @return {@link #type} (Code that specifies the property DeviceDefinitionPropetyCode (Extensible).)
1857         */
1858        public CodeableConcept getType() { 
1859          if (this.type == null)
1860            if (Configuration.errorOnAutoCreate())
1861              throw new Error("Attempt to auto-create DevicePropertyComponent.type");
1862            else if (Configuration.doAutoCreate())
1863              this.type = new CodeableConcept(); // cc
1864          return this.type;
1865        }
1866
1867        public boolean hasType() { 
1868          return this.type != null && !this.type.isEmpty();
1869        }
1870
1871        /**
1872         * @param value {@link #type} (Code that specifies the property DeviceDefinitionPropetyCode (Extensible).)
1873         */
1874        public DevicePropertyComponent setType(CodeableConcept value) { 
1875          this.type = value;
1876          return this;
1877        }
1878
1879        /**
1880         * @return {@link #valueQuanity} (Property value as a quantity.)
1881         */
1882        public List<Quantity> getValueQuanity() { 
1883          if (this.valueQuanity == null)
1884            this.valueQuanity = new ArrayList<Quantity>();
1885          return this.valueQuanity;
1886        }
1887
1888        /**
1889         * @return Returns a reference to <code>this</code> for easy method chaining
1890         */
1891        public DevicePropertyComponent setValueQuanity(List<Quantity> theValueQuanity) { 
1892          this.valueQuanity = theValueQuanity;
1893          return this;
1894        }
1895
1896        public boolean hasValueQuanity() { 
1897          if (this.valueQuanity == null)
1898            return false;
1899          for (Quantity item : this.valueQuanity)
1900            if (!item.isEmpty())
1901              return true;
1902          return false;
1903        }
1904
1905        public Quantity addValueQuanity() { //3
1906          Quantity t = new Quantity();
1907          if (this.valueQuanity == null)
1908            this.valueQuanity = new ArrayList<Quantity>();
1909          this.valueQuanity.add(t);
1910          return t;
1911        }
1912
1913        public DevicePropertyComponent addValueQuanity(Quantity t) { //3
1914          if (t == null)
1915            return this;
1916          if (this.valueQuanity == null)
1917            this.valueQuanity = new ArrayList<Quantity>();
1918          this.valueQuanity.add(t);
1919          return this;
1920        }
1921
1922        /**
1923         * @return The first repetition of repeating field {@link #valueQuanity}, creating it if it does not already exist
1924         */
1925        public Quantity getValueQuanityFirstRep() { 
1926          if (getValueQuanity().isEmpty()) {
1927            addValueQuanity();
1928          }
1929          return getValueQuanity().get(0);
1930        }
1931
1932        /**
1933         * @return {@link #valueCode} (Property value as a code, e.g., NTP4 (synced to NTP).)
1934         */
1935        public List<CodeableConcept> getValueCode() { 
1936          if (this.valueCode == null)
1937            this.valueCode = new ArrayList<CodeableConcept>();
1938          return this.valueCode;
1939        }
1940
1941        /**
1942         * @return Returns a reference to <code>this</code> for easy method chaining
1943         */
1944        public DevicePropertyComponent setValueCode(List<CodeableConcept> theValueCode) { 
1945          this.valueCode = theValueCode;
1946          return this;
1947        }
1948
1949        public boolean hasValueCode() { 
1950          if (this.valueCode == null)
1951            return false;
1952          for (CodeableConcept item : this.valueCode)
1953            if (!item.isEmpty())
1954              return true;
1955          return false;
1956        }
1957
1958        public CodeableConcept addValueCode() { //3
1959          CodeableConcept t = new CodeableConcept();
1960          if (this.valueCode == null)
1961            this.valueCode = new ArrayList<CodeableConcept>();
1962          this.valueCode.add(t);
1963          return t;
1964        }
1965
1966        public DevicePropertyComponent addValueCode(CodeableConcept t) { //3
1967          if (t == null)
1968            return this;
1969          if (this.valueCode == null)
1970            this.valueCode = new ArrayList<CodeableConcept>();
1971          this.valueCode.add(t);
1972          return this;
1973        }
1974
1975        /**
1976         * @return The first repetition of repeating field {@link #valueCode}, creating it if it does not already exist
1977         */
1978        public CodeableConcept getValueCodeFirstRep() { 
1979          if (getValueCode().isEmpty()) {
1980            addValueCode();
1981          }
1982          return getValueCode().get(0);
1983        }
1984
1985        protected void listChildren(List<Property> children) {
1986          super.listChildren(children);
1987          children.add(new Property("type", "CodeableConcept", "Code that specifies the property DeviceDefinitionPropetyCode (Extensible).", 0, 1, type));
1988          children.add(new Property("valueQuanity", "Quantity", "Property value as a quantity.", 0, java.lang.Integer.MAX_VALUE, valueQuanity));
1989          children.add(new Property("valueCode", "CodeableConcept", "Property value as a code, e.g., NTP4 (synced to NTP).", 0, java.lang.Integer.MAX_VALUE, valueCode));
1990        }
1991
1992        @Override
1993        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1994          switch (_hash) {
1995          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Code that specifies the property DeviceDefinitionPropetyCode (Extensible).", 0, 1, type);
1996          case 1319984908: /*valueQuanity*/  return new Property("valueQuanity", "Quantity", "Property value as a quantity.", 0, java.lang.Integer.MAX_VALUE, valueQuanity);
1997          case -766209282: /*valueCode*/  return new Property("valueCode", "CodeableConcept", "Property value as a code, e.g., NTP4 (synced to NTP).", 0, java.lang.Integer.MAX_VALUE, valueCode);
1998          default: return super.getNamedProperty(_hash, _name, _checkValid);
1999          }
2000
2001        }
2002
2003      @Override
2004      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2005        switch (hash) {
2006        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2007        case 1319984908: /*valueQuanity*/ return this.valueQuanity == null ? new Base[0] : this.valueQuanity.toArray(new Base[this.valueQuanity.size()]); // Quantity
2008        case -766209282: /*valueCode*/ return this.valueCode == null ? new Base[0] : this.valueCode.toArray(new Base[this.valueCode.size()]); // CodeableConcept
2009        default: return super.getProperty(hash, name, checkValid);
2010        }
2011
2012      }
2013
2014      @Override
2015      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2016        switch (hash) {
2017        case 3575610: // type
2018          this.type = castToCodeableConcept(value); // CodeableConcept
2019          return value;
2020        case 1319984908: // valueQuanity
2021          this.getValueQuanity().add(castToQuantity(value)); // Quantity
2022          return value;
2023        case -766209282: // valueCode
2024          this.getValueCode().add(castToCodeableConcept(value)); // CodeableConcept
2025          return value;
2026        default: return super.setProperty(hash, name, value);
2027        }
2028
2029      }
2030
2031      @Override
2032      public Base setProperty(String name, Base value) throws FHIRException {
2033        if (name.equals("type")) {
2034          this.type = castToCodeableConcept(value); // CodeableConcept
2035        } else if (name.equals("valueQuanity")) {
2036          this.getValueQuanity().add(castToQuantity(value));
2037        } else if (name.equals("valueCode")) {
2038          this.getValueCode().add(castToCodeableConcept(value));
2039        } else
2040          return super.setProperty(name, value);
2041        return value;
2042      }
2043
2044      @Override
2045      public Base makeProperty(int hash, String name) throws FHIRException {
2046        switch (hash) {
2047        case 3575610:  return getType(); 
2048        case 1319984908:  return addValueQuanity(); 
2049        case -766209282:  return addValueCode(); 
2050        default: return super.makeProperty(hash, name);
2051        }
2052
2053      }
2054
2055      @Override
2056      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2057        switch (hash) {
2058        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2059        case 1319984908: /*valueQuanity*/ return new String[] {"Quantity"};
2060        case -766209282: /*valueCode*/ return new String[] {"CodeableConcept"};
2061        default: return super.getTypesForProperty(hash, name);
2062        }
2063
2064      }
2065
2066      @Override
2067      public Base addChild(String name) throws FHIRException {
2068        if (name.equals("type")) {
2069          this.type = new CodeableConcept();
2070          return this.type;
2071        }
2072        else if (name.equals("valueQuanity")) {
2073          return addValueQuanity();
2074        }
2075        else if (name.equals("valueCode")) {
2076          return addValueCode();
2077        }
2078        else
2079          return super.addChild(name);
2080      }
2081
2082      public DevicePropertyComponent copy() {
2083        DevicePropertyComponent dst = new DevicePropertyComponent();
2084        copyValues(dst);
2085        dst.type = type == null ? null : type.copy();
2086        if (valueQuanity != null) {
2087          dst.valueQuanity = new ArrayList<Quantity>();
2088          for (Quantity i : valueQuanity)
2089            dst.valueQuanity.add(i.copy());
2090        };
2091        if (valueCode != null) {
2092          dst.valueCode = new ArrayList<CodeableConcept>();
2093          for (CodeableConcept i : valueCode)
2094            dst.valueCode.add(i.copy());
2095        };
2096        return dst;
2097      }
2098
2099      @Override
2100      public boolean equalsDeep(Base other_) {
2101        if (!super.equalsDeep(other_))
2102          return false;
2103        if (!(other_ instanceof DevicePropertyComponent))
2104          return false;
2105        DevicePropertyComponent o = (DevicePropertyComponent) other_;
2106        return compareDeep(type, o.type, true) && compareDeep(valueQuanity, o.valueQuanity, true) && compareDeep(valueCode, o.valueCode, true)
2107          ;
2108      }
2109
2110      @Override
2111      public boolean equalsShallow(Base other_) {
2112        if (!super.equalsShallow(other_))
2113          return false;
2114        if (!(other_ instanceof DevicePropertyComponent))
2115          return false;
2116        DevicePropertyComponent o = (DevicePropertyComponent) other_;
2117        return true;
2118      }
2119
2120      public boolean isEmpty() {
2121        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, valueQuanity, valueCode
2122          );
2123      }
2124
2125  public String fhirType() {
2126    return "Device.property";
2127
2128  }
2129
2130  }
2131
2132    /**
2133     * Unique instance identifiers assigned to a device by manufacturers other organizations or owners.
2134     */
2135    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2136    @Description(shortDefinition="Instance identifier", formalDefinition="Unique instance identifiers assigned to a device by manufacturers other organizations or owners." )
2137    protected List<Identifier> identifier;
2138
2139    /**
2140     * The reference to the definition for the device.
2141     */
2142    @Child(name = "definition", type = {DeviceDefinition.class}, order=1, min=0, max=1, modifier=false, summary=false)
2143    @Description(shortDefinition="The reference to the definition for the device", formalDefinition="The reference to the definition for the device." )
2144    protected Reference definition;
2145
2146    /**
2147     * The actual object that is the target of the reference (The reference to the definition for the device.)
2148     */
2149    protected DeviceDefinition definitionTarget;
2150
2151    /**
2152     * Unique device identifier (UDI) assigned to device label or package.  Note that the Device may include multiple udiCarriers as it either may include just the udiCarrier for the jurisdiction it is sold, or for multiple jurisdictions it could have been sold.
2153     */
2154    @Child(name = "udiCarrier", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2155    @Description(shortDefinition="Unique Device Identifier (UDI) Barcode string", formalDefinition="Unique device identifier (UDI) assigned to device label or package.  Note that the Device may include multiple udiCarriers as it either may include just the udiCarrier for the jurisdiction it is sold, or for multiple jurisdictions it could have been sold." )
2156    protected List<DeviceUdiCarrierComponent> udiCarrier;
2157
2158    /**
2159     * Status of the Device availability.
2160     */
2161    @Child(name = "status", type = {CodeType.class}, order=3, min=0, max=1, modifier=true, summary=true)
2162    @Description(shortDefinition="active | inactive | entered-in-error | unknown", formalDefinition="Status of the Device availability." )
2163    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-status")
2164    protected Enumeration<FHIRDeviceStatus> status;
2165
2166    /**
2167     * Reason for the dtatus of the Device availability.
2168     */
2169    @Child(name = "statusReason", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2170    @Description(shortDefinition="online | paused | standby | offline | not-ready | transduc-discon | hw-discon | off", formalDefinition="Reason for the dtatus of the Device availability." )
2171    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-status-reason")
2172    protected List<CodeableConcept> statusReason;
2173
2174    /**
2175     * The distinct identification code required by §1271.290(c) for a human cell, tissue, or cellular and tissue-based product regulated as a device.
2176     */
2177    @Child(name = "distinctIdentificationCode", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
2178    @Description(shortDefinition="The distinct identification code for a biological product regulated as a device", formalDefinition="The distinct identification code required by §1271.290(c) for a human cell, tissue, or cellular and tissue-based product regulated as a device." )
2179    protected StringType distinctIdentificationCode;
2180
2181    /**
2182     * A name of the manufacturer.
2183     */
2184    @Child(name = "manufacturer", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=false)
2185    @Description(shortDefinition="Name of device manufacturer", formalDefinition="A name of the manufacturer." )
2186    protected StringType manufacturer;
2187
2188    /**
2189     * The date and time when the device was manufactured.
2190     */
2191    @Child(name = "manufactureDate", type = {DateTimeType.class}, order=7, min=0, max=1, modifier=false, summary=false)
2192    @Description(shortDefinition="Date when the device was made", formalDefinition="The date and time when the device was manufactured." )
2193    protected DateTimeType manufactureDate;
2194
2195    /**
2196     * The date and time beyond which this device is no longer valid or should not be used (if applicable).
2197     */
2198    @Child(name = "expirationDate", type = {DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=false)
2199    @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)." )
2200    protected DateTimeType expirationDate;
2201
2202    /**
2203     * Lot number assigned by the manufacturer.
2204     */
2205    @Child(name = "lotNumber", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=false)
2206    @Description(shortDefinition="Lot number of manufacture", formalDefinition="Lot number assigned by the manufacturer." )
2207    protected StringType lotNumber;
2208
2209    /**
2210     * The serial number assigned by the organization when the device was manufactured.
2211     */
2212    @Child(name = "serialNumber", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=false)
2213    @Description(shortDefinition="Serial number assigned by the manufacturer", formalDefinition="The serial number assigned by the organization when the device was manufactured." )
2214    protected StringType serialNumber;
2215
2216    /**
2217     * This represents the manufacturer's name of the device as provided by the device, from a UDI label, or by a person describing the Device.  This typically would be used when a person provides the name(s) or when the device represents one of the names available from DeviceDefinition.
2218     */
2219    @Child(name = "deviceName", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2220    @Description(shortDefinition="The name of the device as given by the manufacturer", formalDefinition="This represents the manufacturer's name of the device as provided by the device, from a UDI label, or by a person describing the Device.  This typically would be used when a person provides the name(s) or when the device represents one of the names available from DeviceDefinition." )
2221    protected List<DeviceDeviceNameComponent> deviceName;
2222
2223    /**
2224     * The model number for the device.
2225     */
2226    @Child(name = "modelNumber", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=false)
2227    @Description(shortDefinition="The model number for the device", formalDefinition="The model number for the device." )
2228    protected StringType modelNumber;
2229
2230    /**
2231     * The part number of thedevice.
2232     */
2233    @Child(name = "partNumber", type = {StringType.class}, order=13, min=0, max=1, modifier=false, summary=false)
2234    @Description(shortDefinition="The part number of the device", formalDefinition="The part number of thedevice." )
2235    protected StringType partNumber;
2236
2237    /**
2238     * The kind or type of device.
2239     */
2240    @Child(name = "type", type = {CodeableConcept.class}, order=14, min=0, max=1, modifier=false, summary=false)
2241    @Description(shortDefinition="The kind or type of device", formalDefinition="The kind or type of device." )
2242    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-kind")
2243    protected CodeableConcept type;
2244
2245    /**
2246     * The capabilities supported on a  device, the standards to which the device conforms for a particular purpose, and used for the communication.
2247     */
2248    @Child(name = "specialization", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2249    @Description(shortDefinition="The capabilities supported on a  device, the standards to which the device conforms for a particular purpose, and used for the communication", formalDefinition="The capabilities supported on a  device, the standards to which the device conforms for a particular purpose, and used for the communication." )
2250    protected List<DeviceSpecializationComponent> specialization;
2251
2252    /**
2253     * The actual design of the device or software version running on the device.
2254     */
2255    @Child(name = "version", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2256    @Description(shortDefinition="The actual design of the device or software version running on the device", formalDefinition="The actual design of the device or software version running on the device." )
2257    protected List<DeviceVersionComponent> version;
2258
2259    /**
2260     * The actual configuration settings of a device as it actually operates, e.g., regulation status, time properties.
2261     */
2262    @Child(name = "property", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2263    @Description(shortDefinition="The actual configuration settings of a device as it actually operates, e.g., regulation status, time properties", formalDefinition="The actual configuration settings of a device as it actually operates, e.g., regulation status, time properties." )
2264    protected List<DevicePropertyComponent> property;
2265
2266    /**
2267     * Patient information, If the device is affixed to a person.
2268     */
2269    @Child(name = "patient", type = {Patient.class}, order=18, min=0, max=1, modifier=false, summary=false)
2270    @Description(shortDefinition="Patient to whom Device is affixed", formalDefinition="Patient information, If the device is affixed to a person." )
2271    protected Reference patient;
2272
2273    /**
2274     * The actual object that is the target of the reference (Patient information, If the device is affixed to a person.)
2275     */
2276    protected Patient patientTarget;
2277
2278    /**
2279     * An organization that is responsible for the provision and ongoing maintenance of the device.
2280     */
2281    @Child(name = "owner", type = {Organization.class}, order=19, min=0, max=1, modifier=false, summary=false)
2282    @Description(shortDefinition="Organization responsible for device", formalDefinition="An organization that is responsible for the provision and ongoing maintenance of the device." )
2283    protected Reference owner;
2284
2285    /**
2286     * The actual object that is the target of the reference (An organization that is responsible for the provision and ongoing maintenance of the device.)
2287     */
2288    protected Organization ownerTarget;
2289
2290    /**
2291     * Contact details for an organization or a particular human that is responsible for the device.
2292     */
2293    @Child(name = "contact", type = {ContactPoint.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2294    @Description(shortDefinition="Details for human/organization for support", formalDefinition="Contact details for an organization or a particular human that is responsible for the device." )
2295    protected List<ContactPoint> contact;
2296
2297    /**
2298     * The place where the device can be found.
2299     */
2300    @Child(name = "location", type = {Location.class}, order=21, min=0, max=1, modifier=false, summary=false)
2301    @Description(shortDefinition="Where the device is found", formalDefinition="The place where the device can be found." )
2302    protected Reference location;
2303
2304    /**
2305     * The actual object that is the target of the reference (The place where the device can be found.)
2306     */
2307    protected Location locationTarget;
2308
2309    /**
2310     * A network address on which the device may be contacted directly.
2311     */
2312    @Child(name = "url", type = {UriType.class}, order=22, min=0, max=1, modifier=false, summary=false)
2313    @Description(shortDefinition="Network address to contact device", formalDefinition="A network address on which the device may be contacted directly." )
2314    protected UriType url;
2315
2316    /**
2317     * Descriptive information, usage information or implantation information that is not captured in an existing element.
2318     */
2319    @Child(name = "note", type = {Annotation.class}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2320    @Description(shortDefinition="Device notes and comments", formalDefinition="Descriptive information, usage information or implantation information that is not captured in an existing element." )
2321    protected List<Annotation> note;
2322
2323    /**
2324     * Provides additional safety characteristics about a medical device.  For example devices containing latex.
2325     */
2326    @Child(name = "safety", type = {CodeableConcept.class}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2327    @Description(shortDefinition="Safety Characteristics of Device", formalDefinition="Provides additional safety characteristics about a medical device.  For example devices containing latex." )
2328    protected List<CodeableConcept> safety;
2329
2330    /**
2331     * The parent device.
2332     */
2333    @Child(name = "parent", type = {Device.class}, order=25, min=0, max=1, modifier=false, summary=false)
2334    @Description(shortDefinition="The parent device", formalDefinition="The parent device." )
2335    protected Reference parent;
2336
2337    /**
2338     * The actual object that is the target of the reference (The parent device.)
2339     */
2340    protected Device parentTarget;
2341
2342    private static final long serialVersionUID = -53001649L;
2343
2344  /**
2345   * Constructor
2346   */
2347    public Device() {
2348      super();
2349    }
2350
2351    /**
2352     * @return {@link #identifier} (Unique instance identifiers assigned to a device by manufacturers other organizations or owners.)
2353     */
2354    public List<Identifier> getIdentifier() { 
2355      if (this.identifier == null)
2356        this.identifier = new ArrayList<Identifier>();
2357      return this.identifier;
2358    }
2359
2360    /**
2361     * @return Returns a reference to <code>this</code> for easy method chaining
2362     */
2363    public Device setIdentifier(List<Identifier> theIdentifier) { 
2364      this.identifier = theIdentifier;
2365      return this;
2366    }
2367
2368    public boolean hasIdentifier() { 
2369      if (this.identifier == null)
2370        return false;
2371      for (Identifier item : this.identifier)
2372        if (!item.isEmpty())
2373          return true;
2374      return false;
2375    }
2376
2377    public Identifier addIdentifier() { //3
2378      Identifier t = new Identifier();
2379      if (this.identifier == null)
2380        this.identifier = new ArrayList<Identifier>();
2381      this.identifier.add(t);
2382      return t;
2383    }
2384
2385    public Device addIdentifier(Identifier t) { //3
2386      if (t == null)
2387        return this;
2388      if (this.identifier == null)
2389        this.identifier = new ArrayList<Identifier>();
2390      this.identifier.add(t);
2391      return this;
2392    }
2393
2394    /**
2395     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
2396     */
2397    public Identifier getIdentifierFirstRep() { 
2398      if (getIdentifier().isEmpty()) {
2399        addIdentifier();
2400      }
2401      return getIdentifier().get(0);
2402    }
2403
2404    /**
2405     * @return {@link #definition} (The reference to the definition for the device.)
2406     */
2407    public Reference getDefinition() { 
2408      if (this.definition == null)
2409        if (Configuration.errorOnAutoCreate())
2410          throw new Error("Attempt to auto-create Device.definition");
2411        else if (Configuration.doAutoCreate())
2412          this.definition = new Reference(); // cc
2413      return this.definition;
2414    }
2415
2416    public boolean hasDefinition() { 
2417      return this.definition != null && !this.definition.isEmpty();
2418    }
2419
2420    /**
2421     * @param value {@link #definition} (The reference to the definition for the device.)
2422     */
2423    public Device setDefinition(Reference value) { 
2424      this.definition = value;
2425      return this;
2426    }
2427
2428    /**
2429     * @return {@link #definition} 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 reference to the definition for the device.)
2430     */
2431    public DeviceDefinition getDefinitionTarget() { 
2432      if (this.definitionTarget == null)
2433        if (Configuration.errorOnAutoCreate())
2434          throw new Error("Attempt to auto-create Device.definition");
2435        else if (Configuration.doAutoCreate())
2436          this.definitionTarget = new DeviceDefinition(); // aa
2437      return this.definitionTarget;
2438    }
2439
2440    /**
2441     * @param value {@link #definition} 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 reference to the definition for the device.)
2442     */
2443    public Device setDefinitionTarget(DeviceDefinition value) { 
2444      this.definitionTarget = value;
2445      return this;
2446    }
2447
2448    /**
2449     * @return {@link #udiCarrier} (Unique device identifier (UDI) assigned to device label or package.  Note that the Device may include multiple udiCarriers as it either may include just the udiCarrier for the jurisdiction it is sold, or for multiple jurisdictions it could have been sold.)
2450     */
2451    public List<DeviceUdiCarrierComponent> getUdiCarrier() { 
2452      if (this.udiCarrier == null)
2453        this.udiCarrier = new ArrayList<DeviceUdiCarrierComponent>();
2454      return this.udiCarrier;
2455    }
2456
2457    /**
2458     * @return Returns a reference to <code>this</code> for easy method chaining
2459     */
2460    public Device setUdiCarrier(List<DeviceUdiCarrierComponent> theUdiCarrier) { 
2461      this.udiCarrier = theUdiCarrier;
2462      return this;
2463    }
2464
2465    public boolean hasUdiCarrier() { 
2466      if (this.udiCarrier == null)
2467        return false;
2468      for (DeviceUdiCarrierComponent item : this.udiCarrier)
2469        if (!item.isEmpty())
2470          return true;
2471      return false;
2472    }
2473
2474    public DeviceUdiCarrierComponent addUdiCarrier() { //3
2475      DeviceUdiCarrierComponent t = new DeviceUdiCarrierComponent();
2476      if (this.udiCarrier == null)
2477        this.udiCarrier = new ArrayList<DeviceUdiCarrierComponent>();
2478      this.udiCarrier.add(t);
2479      return t;
2480    }
2481
2482    public Device addUdiCarrier(DeviceUdiCarrierComponent t) { //3
2483      if (t == null)
2484        return this;
2485      if (this.udiCarrier == null)
2486        this.udiCarrier = new ArrayList<DeviceUdiCarrierComponent>();
2487      this.udiCarrier.add(t);
2488      return this;
2489    }
2490
2491    /**
2492     * @return The first repetition of repeating field {@link #udiCarrier}, creating it if it does not already exist
2493     */
2494    public DeviceUdiCarrierComponent getUdiCarrierFirstRep() { 
2495      if (getUdiCarrier().isEmpty()) {
2496        addUdiCarrier();
2497      }
2498      return getUdiCarrier().get(0);
2499    }
2500
2501    /**
2502     * @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
2503     */
2504    public Enumeration<FHIRDeviceStatus> getStatusElement() { 
2505      if (this.status == null)
2506        if (Configuration.errorOnAutoCreate())
2507          throw new Error("Attempt to auto-create Device.status");
2508        else if (Configuration.doAutoCreate())
2509          this.status = new Enumeration<FHIRDeviceStatus>(new FHIRDeviceStatusEnumFactory()); // bb
2510      return this.status;
2511    }
2512
2513    public boolean hasStatusElement() { 
2514      return this.status != null && !this.status.isEmpty();
2515    }
2516
2517    public boolean hasStatus() { 
2518      return this.status != null && !this.status.isEmpty();
2519    }
2520
2521    /**
2522     * @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
2523     */
2524    public Device setStatusElement(Enumeration<FHIRDeviceStatus> value) { 
2525      this.status = value;
2526      return this;
2527    }
2528
2529    /**
2530     * @return Status of the Device availability.
2531     */
2532    public FHIRDeviceStatus getStatus() { 
2533      return this.status == null ? null : this.status.getValue();
2534    }
2535
2536    /**
2537     * @param value Status of the Device availability.
2538     */
2539    public Device setStatus(FHIRDeviceStatus value) { 
2540      if (value == null)
2541        this.status = null;
2542      else {
2543        if (this.status == null)
2544          this.status = new Enumeration<FHIRDeviceStatus>(new FHIRDeviceStatusEnumFactory());
2545        this.status.setValue(value);
2546      }
2547      return this;
2548    }
2549
2550    /**
2551     * @return {@link #statusReason} (Reason for the dtatus of the Device availability.)
2552     */
2553    public List<CodeableConcept> getStatusReason() { 
2554      if (this.statusReason == null)
2555        this.statusReason = new ArrayList<CodeableConcept>();
2556      return this.statusReason;
2557    }
2558
2559    /**
2560     * @return Returns a reference to <code>this</code> for easy method chaining
2561     */
2562    public Device setStatusReason(List<CodeableConcept> theStatusReason) { 
2563      this.statusReason = theStatusReason;
2564      return this;
2565    }
2566
2567    public boolean hasStatusReason() { 
2568      if (this.statusReason == null)
2569        return false;
2570      for (CodeableConcept item : this.statusReason)
2571        if (!item.isEmpty())
2572          return true;
2573      return false;
2574    }
2575
2576    public CodeableConcept addStatusReason() { //3
2577      CodeableConcept t = new CodeableConcept();
2578      if (this.statusReason == null)
2579        this.statusReason = new ArrayList<CodeableConcept>();
2580      this.statusReason.add(t);
2581      return t;
2582    }
2583
2584    public Device addStatusReason(CodeableConcept t) { //3
2585      if (t == null)
2586        return this;
2587      if (this.statusReason == null)
2588        this.statusReason = new ArrayList<CodeableConcept>();
2589      this.statusReason.add(t);
2590      return this;
2591    }
2592
2593    /**
2594     * @return The first repetition of repeating field {@link #statusReason}, creating it if it does not already exist
2595     */
2596    public CodeableConcept getStatusReasonFirstRep() { 
2597      if (getStatusReason().isEmpty()) {
2598        addStatusReason();
2599      }
2600      return getStatusReason().get(0);
2601    }
2602
2603    /**
2604     * @return {@link #distinctIdentificationCode} (The distinct identification code required by §1271.290(c) for a human cell, tissue, or cellular and tissue-based product regulated as a device.). This is the underlying object with id, value and extensions. The accessor "getDistinctIdentificationCode" gives direct access to the value
2605     */
2606    public StringType getDistinctIdentificationCodeElement() { 
2607      if (this.distinctIdentificationCode == null)
2608        if (Configuration.errorOnAutoCreate())
2609          throw new Error("Attempt to auto-create Device.distinctIdentificationCode");
2610        else if (Configuration.doAutoCreate())
2611          this.distinctIdentificationCode = new StringType(); // bb
2612      return this.distinctIdentificationCode;
2613    }
2614
2615    public boolean hasDistinctIdentificationCodeElement() { 
2616      return this.distinctIdentificationCode != null && !this.distinctIdentificationCode.isEmpty();
2617    }
2618
2619    public boolean hasDistinctIdentificationCode() { 
2620      return this.distinctIdentificationCode != null && !this.distinctIdentificationCode.isEmpty();
2621    }
2622
2623    /**
2624     * @param value {@link #distinctIdentificationCode} (The distinct identification code required by §1271.290(c) for a human cell, tissue, or cellular and tissue-based product regulated as a device.). This is the underlying object with id, value and extensions. The accessor "getDistinctIdentificationCode" gives direct access to the value
2625     */
2626    public Device setDistinctIdentificationCodeElement(StringType value) { 
2627      this.distinctIdentificationCode = value;
2628      return this;
2629    }
2630
2631    /**
2632     * @return The distinct identification code required by §1271.290(c) for a human cell, tissue, or cellular and tissue-based product regulated as a device.
2633     */
2634    public String getDistinctIdentificationCode() { 
2635      return this.distinctIdentificationCode == null ? null : this.distinctIdentificationCode.getValue();
2636    }
2637
2638    /**
2639     * @param value The distinct identification code required by §1271.290(c) for a human cell, tissue, or cellular and tissue-based product regulated as a device.
2640     */
2641    public Device setDistinctIdentificationCode(String value) { 
2642      if (Utilities.noString(value))
2643        this.distinctIdentificationCode = null;
2644      else {
2645        if (this.distinctIdentificationCode == null)
2646          this.distinctIdentificationCode = new StringType();
2647        this.distinctIdentificationCode.setValue(value);
2648      }
2649      return this;
2650    }
2651
2652    /**
2653     * @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
2654     */
2655    public StringType getManufacturerElement() { 
2656      if (this.manufacturer == null)
2657        if (Configuration.errorOnAutoCreate())
2658          throw new Error("Attempt to auto-create Device.manufacturer");
2659        else if (Configuration.doAutoCreate())
2660          this.manufacturer = new StringType(); // bb
2661      return this.manufacturer;
2662    }
2663
2664    public boolean hasManufacturerElement() { 
2665      return this.manufacturer != null && !this.manufacturer.isEmpty();
2666    }
2667
2668    public boolean hasManufacturer() { 
2669      return this.manufacturer != null && !this.manufacturer.isEmpty();
2670    }
2671
2672    /**
2673     * @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
2674     */
2675    public Device setManufacturerElement(StringType value) { 
2676      this.manufacturer = value;
2677      return this;
2678    }
2679
2680    /**
2681     * @return A name of the manufacturer.
2682     */
2683    public String getManufacturer() { 
2684      return this.manufacturer == null ? null : this.manufacturer.getValue();
2685    }
2686
2687    /**
2688     * @param value A name of the manufacturer.
2689     */
2690    public Device setManufacturer(String value) { 
2691      if (Utilities.noString(value))
2692        this.manufacturer = null;
2693      else {
2694        if (this.manufacturer == null)
2695          this.manufacturer = new StringType();
2696        this.manufacturer.setValue(value);
2697      }
2698      return this;
2699    }
2700
2701    /**
2702     * @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
2703     */
2704    public DateTimeType getManufactureDateElement() { 
2705      if (this.manufactureDate == null)
2706        if (Configuration.errorOnAutoCreate())
2707          throw new Error("Attempt to auto-create Device.manufactureDate");
2708        else if (Configuration.doAutoCreate())
2709          this.manufactureDate = new DateTimeType(); // bb
2710      return this.manufactureDate;
2711    }
2712
2713    public boolean hasManufactureDateElement() { 
2714      return this.manufactureDate != null && !this.manufactureDate.isEmpty();
2715    }
2716
2717    public boolean hasManufactureDate() { 
2718      return this.manufactureDate != null && !this.manufactureDate.isEmpty();
2719    }
2720
2721    /**
2722     * @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
2723     */
2724    public Device setManufactureDateElement(DateTimeType value) { 
2725      this.manufactureDate = value;
2726      return this;
2727    }
2728
2729    /**
2730     * @return The date and time when the device was manufactured.
2731     */
2732    public Date getManufactureDate() { 
2733      return this.manufactureDate == null ? null : this.manufactureDate.getValue();
2734    }
2735
2736    /**
2737     * @param value The date and time when the device was manufactured.
2738     */
2739    public Device setManufactureDate(Date value) { 
2740      if (value == null)
2741        this.manufactureDate = null;
2742      else {
2743        if (this.manufactureDate == null)
2744          this.manufactureDate = new DateTimeType();
2745        this.manufactureDate.setValue(value);
2746      }
2747      return this;
2748    }
2749
2750    /**
2751     * @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
2752     */
2753    public DateTimeType getExpirationDateElement() { 
2754      if (this.expirationDate == null)
2755        if (Configuration.errorOnAutoCreate())
2756          throw new Error("Attempt to auto-create Device.expirationDate");
2757        else if (Configuration.doAutoCreate())
2758          this.expirationDate = new DateTimeType(); // bb
2759      return this.expirationDate;
2760    }
2761
2762    public boolean hasExpirationDateElement() { 
2763      return this.expirationDate != null && !this.expirationDate.isEmpty();
2764    }
2765
2766    public boolean hasExpirationDate() { 
2767      return this.expirationDate != null && !this.expirationDate.isEmpty();
2768    }
2769
2770    /**
2771     * @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
2772     */
2773    public Device setExpirationDateElement(DateTimeType value) { 
2774      this.expirationDate = value;
2775      return this;
2776    }
2777
2778    /**
2779     * @return The date and time beyond which this device is no longer valid or should not be used (if applicable).
2780     */
2781    public Date getExpirationDate() { 
2782      return this.expirationDate == null ? null : this.expirationDate.getValue();
2783    }
2784
2785    /**
2786     * @param value The date and time beyond which this device is no longer valid or should not be used (if applicable).
2787     */
2788    public Device setExpirationDate(Date value) { 
2789      if (value == null)
2790        this.expirationDate = null;
2791      else {
2792        if (this.expirationDate == null)
2793          this.expirationDate = new DateTimeType();
2794        this.expirationDate.setValue(value);
2795      }
2796      return this;
2797    }
2798
2799    /**
2800     * @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
2801     */
2802    public StringType getLotNumberElement() { 
2803      if (this.lotNumber == null)
2804        if (Configuration.errorOnAutoCreate())
2805          throw new Error("Attempt to auto-create Device.lotNumber");
2806        else if (Configuration.doAutoCreate())
2807          this.lotNumber = new StringType(); // bb
2808      return this.lotNumber;
2809    }
2810
2811    public boolean hasLotNumberElement() { 
2812      return this.lotNumber != null && !this.lotNumber.isEmpty();
2813    }
2814
2815    public boolean hasLotNumber() { 
2816      return this.lotNumber != null && !this.lotNumber.isEmpty();
2817    }
2818
2819    /**
2820     * @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
2821     */
2822    public Device setLotNumberElement(StringType value) { 
2823      this.lotNumber = value;
2824      return this;
2825    }
2826
2827    /**
2828     * @return Lot number assigned by the manufacturer.
2829     */
2830    public String getLotNumber() { 
2831      return this.lotNumber == null ? null : this.lotNumber.getValue();
2832    }
2833
2834    /**
2835     * @param value Lot number assigned by the manufacturer.
2836     */
2837    public Device setLotNumber(String value) { 
2838      if (Utilities.noString(value))
2839        this.lotNumber = null;
2840      else {
2841        if (this.lotNumber == null)
2842          this.lotNumber = new StringType();
2843        this.lotNumber.setValue(value);
2844      }
2845      return this;
2846    }
2847
2848    /**
2849     * @return {@link #serialNumber} (The serial number assigned by the organization when the device was manufactured.). This is the underlying object with id, value and extensions. The accessor "getSerialNumber" gives direct access to the value
2850     */
2851    public StringType getSerialNumberElement() { 
2852      if (this.serialNumber == null)
2853        if (Configuration.errorOnAutoCreate())
2854          throw new Error("Attempt to auto-create Device.serialNumber");
2855        else if (Configuration.doAutoCreate())
2856          this.serialNumber = new StringType(); // bb
2857      return this.serialNumber;
2858    }
2859
2860    public boolean hasSerialNumberElement() { 
2861      return this.serialNumber != null && !this.serialNumber.isEmpty();
2862    }
2863
2864    public boolean hasSerialNumber() { 
2865      return this.serialNumber != null && !this.serialNumber.isEmpty();
2866    }
2867
2868    /**
2869     * @param value {@link #serialNumber} (The serial number assigned by the organization when the device was manufactured.). This is the underlying object with id, value and extensions. The accessor "getSerialNumber" gives direct access to the value
2870     */
2871    public Device setSerialNumberElement(StringType value) { 
2872      this.serialNumber = value;
2873      return this;
2874    }
2875
2876    /**
2877     * @return The serial number assigned by the organization when the device was manufactured.
2878     */
2879    public String getSerialNumber() { 
2880      return this.serialNumber == null ? null : this.serialNumber.getValue();
2881    }
2882
2883    /**
2884     * @param value The serial number assigned by the organization when the device was manufactured.
2885     */
2886    public Device setSerialNumber(String value) { 
2887      if (Utilities.noString(value))
2888        this.serialNumber = null;
2889      else {
2890        if (this.serialNumber == null)
2891          this.serialNumber = new StringType();
2892        this.serialNumber.setValue(value);
2893      }
2894      return this;
2895    }
2896
2897    /**
2898     * @return {@link #deviceName} (This represents the manufacturer's name of the device as provided by the device, from a UDI label, or by a person describing the Device.  This typically would be used when a person provides the name(s) or when the device represents one of the names available from DeviceDefinition.)
2899     */
2900    public List<DeviceDeviceNameComponent> getDeviceName() { 
2901      if (this.deviceName == null)
2902        this.deviceName = new ArrayList<DeviceDeviceNameComponent>();
2903      return this.deviceName;
2904    }
2905
2906    /**
2907     * @return Returns a reference to <code>this</code> for easy method chaining
2908     */
2909    public Device setDeviceName(List<DeviceDeviceNameComponent> theDeviceName) { 
2910      this.deviceName = theDeviceName;
2911      return this;
2912    }
2913
2914    public boolean hasDeviceName() { 
2915      if (this.deviceName == null)
2916        return false;
2917      for (DeviceDeviceNameComponent item : this.deviceName)
2918        if (!item.isEmpty())
2919          return true;
2920      return false;
2921    }
2922
2923    public DeviceDeviceNameComponent addDeviceName() { //3
2924      DeviceDeviceNameComponent t = new DeviceDeviceNameComponent();
2925      if (this.deviceName == null)
2926        this.deviceName = new ArrayList<DeviceDeviceNameComponent>();
2927      this.deviceName.add(t);
2928      return t;
2929    }
2930
2931    public Device addDeviceName(DeviceDeviceNameComponent t) { //3
2932      if (t == null)
2933        return this;
2934      if (this.deviceName == null)
2935        this.deviceName = new ArrayList<DeviceDeviceNameComponent>();
2936      this.deviceName.add(t);
2937      return this;
2938    }
2939
2940    /**
2941     * @return The first repetition of repeating field {@link #deviceName}, creating it if it does not already exist
2942     */
2943    public DeviceDeviceNameComponent getDeviceNameFirstRep() { 
2944      if (getDeviceName().isEmpty()) {
2945        addDeviceName();
2946      }
2947      return getDeviceName().get(0);
2948    }
2949
2950    /**
2951     * @return {@link #modelNumber} (The model number for the device.). This is the underlying object with id, value and extensions. The accessor "getModelNumber" gives direct access to the value
2952     */
2953    public StringType getModelNumberElement() { 
2954      if (this.modelNumber == null)
2955        if (Configuration.errorOnAutoCreate())
2956          throw new Error("Attempt to auto-create Device.modelNumber");
2957        else if (Configuration.doAutoCreate())
2958          this.modelNumber = new StringType(); // bb
2959      return this.modelNumber;
2960    }
2961
2962    public boolean hasModelNumberElement() { 
2963      return this.modelNumber != null && !this.modelNumber.isEmpty();
2964    }
2965
2966    public boolean hasModelNumber() { 
2967      return this.modelNumber != null && !this.modelNumber.isEmpty();
2968    }
2969
2970    /**
2971     * @param value {@link #modelNumber} (The model number for the device.). This is the underlying object with id, value and extensions. The accessor "getModelNumber" gives direct access to the value
2972     */
2973    public Device setModelNumberElement(StringType value) { 
2974      this.modelNumber = value;
2975      return this;
2976    }
2977
2978    /**
2979     * @return The model number for the device.
2980     */
2981    public String getModelNumber() { 
2982      return this.modelNumber == null ? null : this.modelNumber.getValue();
2983    }
2984
2985    /**
2986     * @param value The model number for the device.
2987     */
2988    public Device setModelNumber(String value) { 
2989      if (Utilities.noString(value))
2990        this.modelNumber = null;
2991      else {
2992        if (this.modelNumber == null)
2993          this.modelNumber = new StringType();
2994        this.modelNumber.setValue(value);
2995      }
2996      return this;
2997    }
2998
2999    /**
3000     * @return {@link #partNumber} (The part number of thedevice.). This is the underlying object with id, value and extensions. The accessor "getPartNumber" gives direct access to the value
3001     */
3002    public StringType getPartNumberElement() { 
3003      if (this.partNumber == null)
3004        if (Configuration.errorOnAutoCreate())
3005          throw new Error("Attempt to auto-create Device.partNumber");
3006        else if (Configuration.doAutoCreate())
3007          this.partNumber = new StringType(); // bb
3008      return this.partNumber;
3009    }
3010
3011    public boolean hasPartNumberElement() { 
3012      return this.partNumber != null && !this.partNumber.isEmpty();
3013    }
3014
3015    public boolean hasPartNumber() { 
3016      return this.partNumber != null && !this.partNumber.isEmpty();
3017    }
3018
3019    /**
3020     * @param value {@link #partNumber} (The part number of thedevice.). This is the underlying object with id, value and extensions. The accessor "getPartNumber" gives direct access to the value
3021     */
3022    public Device setPartNumberElement(StringType value) { 
3023      this.partNumber = value;
3024      return this;
3025    }
3026
3027    /**
3028     * @return The part number of thedevice.
3029     */
3030    public String getPartNumber() { 
3031      return this.partNumber == null ? null : this.partNumber.getValue();
3032    }
3033
3034    /**
3035     * @param value The part number of thedevice.
3036     */
3037    public Device setPartNumber(String value) { 
3038      if (Utilities.noString(value))
3039        this.partNumber = null;
3040      else {
3041        if (this.partNumber == null)
3042          this.partNumber = new StringType();
3043        this.partNumber.setValue(value);
3044      }
3045      return this;
3046    }
3047
3048    /**
3049     * @return {@link #type} (The kind or type of device.)
3050     */
3051    public CodeableConcept getType() { 
3052      if (this.type == null)
3053        if (Configuration.errorOnAutoCreate())
3054          throw new Error("Attempt to auto-create Device.type");
3055        else if (Configuration.doAutoCreate())
3056          this.type = new CodeableConcept(); // cc
3057      return this.type;
3058    }
3059
3060    public boolean hasType() { 
3061      return this.type != null && !this.type.isEmpty();
3062    }
3063
3064    /**
3065     * @param value {@link #type} (The kind or type of device.)
3066     */
3067    public Device setType(CodeableConcept value) { 
3068      this.type = value;
3069      return this;
3070    }
3071
3072    /**
3073     * @return {@link #specialization} (The capabilities supported on a  device, the standards to which the device conforms for a particular purpose, and used for the communication.)
3074     */
3075    public List<DeviceSpecializationComponent> getSpecialization() { 
3076      if (this.specialization == null)
3077        this.specialization = new ArrayList<DeviceSpecializationComponent>();
3078      return this.specialization;
3079    }
3080
3081    /**
3082     * @return Returns a reference to <code>this</code> for easy method chaining
3083     */
3084    public Device setSpecialization(List<DeviceSpecializationComponent> theSpecialization) { 
3085      this.specialization = theSpecialization;
3086      return this;
3087    }
3088
3089    public boolean hasSpecialization() { 
3090      if (this.specialization == null)
3091        return false;
3092      for (DeviceSpecializationComponent item : this.specialization)
3093        if (!item.isEmpty())
3094          return true;
3095      return false;
3096    }
3097
3098    public DeviceSpecializationComponent addSpecialization() { //3
3099      DeviceSpecializationComponent t = new DeviceSpecializationComponent();
3100      if (this.specialization == null)
3101        this.specialization = new ArrayList<DeviceSpecializationComponent>();
3102      this.specialization.add(t);
3103      return t;
3104    }
3105
3106    public Device addSpecialization(DeviceSpecializationComponent t) { //3
3107      if (t == null)
3108        return this;
3109      if (this.specialization == null)
3110        this.specialization = new ArrayList<DeviceSpecializationComponent>();
3111      this.specialization.add(t);
3112      return this;
3113    }
3114
3115    /**
3116     * @return The first repetition of repeating field {@link #specialization}, creating it if it does not already exist
3117     */
3118    public DeviceSpecializationComponent getSpecializationFirstRep() { 
3119      if (getSpecialization().isEmpty()) {
3120        addSpecialization();
3121      }
3122      return getSpecialization().get(0);
3123    }
3124
3125    /**
3126     * @return {@link #version} (The actual design of the device or software version running on the device.)
3127     */
3128    public List<DeviceVersionComponent> getVersion() { 
3129      if (this.version == null)
3130        this.version = new ArrayList<DeviceVersionComponent>();
3131      return this.version;
3132    }
3133
3134    /**
3135     * @return Returns a reference to <code>this</code> for easy method chaining
3136     */
3137    public Device setVersion(List<DeviceVersionComponent> theVersion) { 
3138      this.version = theVersion;
3139      return this;
3140    }
3141
3142    public boolean hasVersion() { 
3143      if (this.version == null)
3144        return false;
3145      for (DeviceVersionComponent item : this.version)
3146        if (!item.isEmpty())
3147          return true;
3148      return false;
3149    }
3150
3151    public DeviceVersionComponent addVersion() { //3
3152      DeviceVersionComponent t = new DeviceVersionComponent();
3153      if (this.version == null)
3154        this.version = new ArrayList<DeviceVersionComponent>();
3155      this.version.add(t);
3156      return t;
3157    }
3158
3159    public Device addVersion(DeviceVersionComponent t) { //3
3160      if (t == null)
3161        return this;
3162      if (this.version == null)
3163        this.version = new ArrayList<DeviceVersionComponent>();
3164      this.version.add(t);
3165      return this;
3166    }
3167
3168    /**
3169     * @return The first repetition of repeating field {@link #version}, creating it if it does not already exist
3170     */
3171    public DeviceVersionComponent getVersionFirstRep() { 
3172      if (getVersion().isEmpty()) {
3173        addVersion();
3174      }
3175      return getVersion().get(0);
3176    }
3177
3178    /**
3179     * @return {@link #property} (The actual configuration settings of a device as it actually operates, e.g., regulation status, time properties.)
3180     */
3181    public List<DevicePropertyComponent> getProperty() { 
3182      if (this.property == null)
3183        this.property = new ArrayList<DevicePropertyComponent>();
3184      return this.property;
3185    }
3186
3187    /**
3188     * @return Returns a reference to <code>this</code> for easy method chaining
3189     */
3190    public Device setProperty(List<DevicePropertyComponent> theProperty) { 
3191      this.property = theProperty;
3192      return this;
3193    }
3194
3195    public boolean hasProperty() { 
3196      if (this.property == null)
3197        return false;
3198      for (DevicePropertyComponent item : this.property)
3199        if (!item.isEmpty())
3200          return true;
3201      return false;
3202    }
3203
3204    public DevicePropertyComponent addProperty() { //3
3205      DevicePropertyComponent t = new DevicePropertyComponent();
3206      if (this.property == null)
3207        this.property = new ArrayList<DevicePropertyComponent>();
3208      this.property.add(t);
3209      return t;
3210    }
3211
3212    public Device addProperty(DevicePropertyComponent t) { //3
3213      if (t == null)
3214        return this;
3215      if (this.property == null)
3216        this.property = new ArrayList<DevicePropertyComponent>();
3217      this.property.add(t);
3218      return this;
3219    }
3220
3221    /**
3222     * @return The first repetition of repeating field {@link #property}, creating it if it does not already exist
3223     */
3224    public DevicePropertyComponent getPropertyFirstRep() { 
3225      if (getProperty().isEmpty()) {
3226        addProperty();
3227      }
3228      return getProperty().get(0);
3229    }
3230
3231    /**
3232     * @return {@link #patient} (Patient information, If the device is affixed to a person.)
3233     */
3234    public Reference getPatient() { 
3235      if (this.patient == null)
3236        if (Configuration.errorOnAutoCreate())
3237          throw new Error("Attempt to auto-create Device.patient");
3238        else if (Configuration.doAutoCreate())
3239          this.patient = new Reference(); // cc
3240      return this.patient;
3241    }
3242
3243    public boolean hasPatient() { 
3244      return this.patient != null && !this.patient.isEmpty();
3245    }
3246
3247    /**
3248     * @param value {@link #patient} (Patient information, If the device is affixed to a person.)
3249     */
3250    public Device setPatient(Reference value) { 
3251      this.patient = value;
3252      return this;
3253    }
3254
3255    /**
3256     * @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.)
3257     */
3258    public Patient getPatientTarget() { 
3259      if (this.patientTarget == null)
3260        if (Configuration.errorOnAutoCreate())
3261          throw new Error("Attempt to auto-create Device.patient");
3262        else if (Configuration.doAutoCreate())
3263          this.patientTarget = new Patient(); // aa
3264      return this.patientTarget;
3265    }
3266
3267    /**
3268     * @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.)
3269     */
3270    public Device setPatientTarget(Patient value) { 
3271      this.patientTarget = value;
3272      return this;
3273    }
3274
3275    /**
3276     * @return {@link #owner} (An organization that is responsible for the provision and ongoing maintenance of the device.)
3277     */
3278    public Reference getOwner() { 
3279      if (this.owner == null)
3280        if (Configuration.errorOnAutoCreate())
3281          throw new Error("Attempt to auto-create Device.owner");
3282        else if (Configuration.doAutoCreate())
3283          this.owner = new Reference(); // cc
3284      return this.owner;
3285    }
3286
3287    public boolean hasOwner() { 
3288      return this.owner != null && !this.owner.isEmpty();
3289    }
3290
3291    /**
3292     * @param value {@link #owner} (An organization that is responsible for the provision and ongoing maintenance of the device.)
3293     */
3294    public Device setOwner(Reference value) { 
3295      this.owner = value;
3296      return this;
3297    }
3298
3299    /**
3300     * @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.)
3301     */
3302    public Organization getOwnerTarget() { 
3303      if (this.ownerTarget == null)
3304        if (Configuration.errorOnAutoCreate())
3305          throw new Error("Attempt to auto-create Device.owner");
3306        else if (Configuration.doAutoCreate())
3307          this.ownerTarget = new Organization(); // aa
3308      return this.ownerTarget;
3309    }
3310
3311    /**
3312     * @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.)
3313     */
3314    public Device setOwnerTarget(Organization value) { 
3315      this.ownerTarget = value;
3316      return this;
3317    }
3318
3319    /**
3320     * @return {@link #contact} (Contact details for an organization or a particular human that is responsible for the device.)
3321     */
3322    public List<ContactPoint> getContact() { 
3323      if (this.contact == null)
3324        this.contact = new ArrayList<ContactPoint>();
3325      return this.contact;
3326    }
3327
3328    /**
3329     * @return Returns a reference to <code>this</code> for easy method chaining
3330     */
3331    public Device setContact(List<ContactPoint> theContact) { 
3332      this.contact = theContact;
3333      return this;
3334    }
3335
3336    public boolean hasContact() { 
3337      if (this.contact == null)
3338        return false;
3339      for (ContactPoint item : this.contact)
3340        if (!item.isEmpty())
3341          return true;
3342      return false;
3343    }
3344
3345    public ContactPoint addContact() { //3
3346      ContactPoint t = new ContactPoint();
3347      if (this.contact == null)
3348        this.contact = new ArrayList<ContactPoint>();
3349      this.contact.add(t);
3350      return t;
3351    }
3352
3353    public Device addContact(ContactPoint t) { //3
3354      if (t == null)
3355        return this;
3356      if (this.contact == null)
3357        this.contact = new ArrayList<ContactPoint>();
3358      this.contact.add(t);
3359      return this;
3360    }
3361
3362    /**
3363     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist
3364     */
3365    public ContactPoint getContactFirstRep() { 
3366      if (getContact().isEmpty()) {
3367        addContact();
3368      }
3369      return getContact().get(0);
3370    }
3371
3372    /**
3373     * @return {@link #location} (The place where the device can be found.)
3374     */
3375    public Reference getLocation() { 
3376      if (this.location == null)
3377        if (Configuration.errorOnAutoCreate())
3378          throw new Error("Attempt to auto-create Device.location");
3379        else if (Configuration.doAutoCreate())
3380          this.location = new Reference(); // cc
3381      return this.location;
3382    }
3383
3384    public boolean hasLocation() { 
3385      return this.location != null && !this.location.isEmpty();
3386    }
3387
3388    /**
3389     * @param value {@link #location} (The place where the device can be found.)
3390     */
3391    public Device setLocation(Reference value) { 
3392      this.location = value;
3393      return this;
3394    }
3395
3396    /**
3397     * @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.)
3398     */
3399    public Location getLocationTarget() { 
3400      if (this.locationTarget == null)
3401        if (Configuration.errorOnAutoCreate())
3402          throw new Error("Attempt to auto-create Device.location");
3403        else if (Configuration.doAutoCreate())
3404          this.locationTarget = new Location(); // aa
3405      return this.locationTarget;
3406    }
3407
3408    /**
3409     * @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.)
3410     */
3411    public Device setLocationTarget(Location value) { 
3412      this.locationTarget = value;
3413      return this;
3414    }
3415
3416    /**
3417     * @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
3418     */
3419    public UriType getUrlElement() { 
3420      if (this.url == null)
3421        if (Configuration.errorOnAutoCreate())
3422          throw new Error("Attempt to auto-create Device.url");
3423        else if (Configuration.doAutoCreate())
3424          this.url = new UriType(); // bb
3425      return this.url;
3426    }
3427
3428    public boolean hasUrlElement() { 
3429      return this.url != null && !this.url.isEmpty();
3430    }
3431
3432    public boolean hasUrl() { 
3433      return this.url != null && !this.url.isEmpty();
3434    }
3435
3436    /**
3437     * @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
3438     */
3439    public Device setUrlElement(UriType value) { 
3440      this.url = value;
3441      return this;
3442    }
3443
3444    /**
3445     * @return A network address on which the device may be contacted directly.
3446     */
3447    public String getUrl() { 
3448      return this.url == null ? null : this.url.getValue();
3449    }
3450
3451    /**
3452     * @param value A network address on which the device may be contacted directly.
3453     */
3454    public Device setUrl(String value) { 
3455      if (Utilities.noString(value))
3456        this.url = null;
3457      else {
3458        if (this.url == null)
3459          this.url = new UriType();
3460        this.url.setValue(value);
3461      }
3462      return this;
3463    }
3464
3465    /**
3466     * @return {@link #note} (Descriptive information, usage information or implantation information that is not captured in an existing element.)
3467     */
3468    public List<Annotation> getNote() { 
3469      if (this.note == null)
3470        this.note = new ArrayList<Annotation>();
3471      return this.note;
3472    }
3473
3474    /**
3475     * @return Returns a reference to <code>this</code> for easy method chaining
3476     */
3477    public Device setNote(List<Annotation> theNote) { 
3478      this.note = theNote;
3479      return this;
3480    }
3481
3482    public boolean hasNote() { 
3483      if (this.note == null)
3484        return false;
3485      for (Annotation item : this.note)
3486        if (!item.isEmpty())
3487          return true;
3488      return false;
3489    }
3490
3491    public Annotation addNote() { //3
3492      Annotation t = new Annotation();
3493      if (this.note == null)
3494        this.note = new ArrayList<Annotation>();
3495      this.note.add(t);
3496      return t;
3497    }
3498
3499    public Device addNote(Annotation t) { //3
3500      if (t == null)
3501        return this;
3502      if (this.note == null)
3503        this.note = new ArrayList<Annotation>();
3504      this.note.add(t);
3505      return this;
3506    }
3507
3508    /**
3509     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
3510     */
3511    public Annotation getNoteFirstRep() { 
3512      if (getNote().isEmpty()) {
3513        addNote();
3514      }
3515      return getNote().get(0);
3516    }
3517
3518    /**
3519     * @return {@link #safety} (Provides additional safety characteristics about a medical device.  For example devices containing latex.)
3520     */
3521    public List<CodeableConcept> getSafety() { 
3522      if (this.safety == null)
3523        this.safety = new ArrayList<CodeableConcept>();
3524      return this.safety;
3525    }
3526
3527    /**
3528     * @return Returns a reference to <code>this</code> for easy method chaining
3529     */
3530    public Device setSafety(List<CodeableConcept> theSafety) { 
3531      this.safety = theSafety;
3532      return this;
3533    }
3534
3535    public boolean hasSafety() { 
3536      if (this.safety == null)
3537        return false;
3538      for (CodeableConcept item : this.safety)
3539        if (!item.isEmpty())
3540          return true;
3541      return false;
3542    }
3543
3544    public CodeableConcept addSafety() { //3
3545      CodeableConcept t = new CodeableConcept();
3546      if (this.safety == null)
3547        this.safety = new ArrayList<CodeableConcept>();
3548      this.safety.add(t);
3549      return t;
3550    }
3551
3552    public Device addSafety(CodeableConcept t) { //3
3553      if (t == null)
3554        return this;
3555      if (this.safety == null)
3556        this.safety = new ArrayList<CodeableConcept>();
3557      this.safety.add(t);
3558      return this;
3559    }
3560
3561    /**
3562     * @return The first repetition of repeating field {@link #safety}, creating it if it does not already exist
3563     */
3564    public CodeableConcept getSafetyFirstRep() { 
3565      if (getSafety().isEmpty()) {
3566        addSafety();
3567      }
3568      return getSafety().get(0);
3569    }
3570
3571    /**
3572     * @return {@link #parent} (The parent device.)
3573     */
3574    public Reference getParent() { 
3575      if (this.parent == null)
3576        if (Configuration.errorOnAutoCreate())
3577          throw new Error("Attempt to auto-create Device.parent");
3578        else if (Configuration.doAutoCreate())
3579          this.parent = new Reference(); // cc
3580      return this.parent;
3581    }
3582
3583    public boolean hasParent() { 
3584      return this.parent != null && !this.parent.isEmpty();
3585    }
3586
3587    /**
3588     * @param value {@link #parent} (The parent device.)
3589     */
3590    public Device setParent(Reference value) { 
3591      this.parent = value;
3592      return this;
3593    }
3594
3595    /**
3596     * @return {@link #parent} 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 parent device.)
3597     */
3598    public Device getParentTarget() { 
3599      if (this.parentTarget == null)
3600        if (Configuration.errorOnAutoCreate())
3601          throw new Error("Attempt to auto-create Device.parent");
3602        else if (Configuration.doAutoCreate())
3603          this.parentTarget = new Device(); // aa
3604      return this.parentTarget;
3605    }
3606
3607    /**
3608     * @param value {@link #parent} 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 parent device.)
3609     */
3610    public Device setParentTarget(Device value) { 
3611      this.parentTarget = value;
3612      return this;
3613    }
3614
3615      protected void listChildren(List<Property> children) {
3616        super.listChildren(children);
3617        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));
3618        children.add(new Property("definition", "Reference(DeviceDefinition)", "The reference to the definition for the device.", 0, 1, definition));
3619        children.add(new Property("udiCarrier", "", "Unique device identifier (UDI) assigned to device label or package.  Note that the Device may include multiple udiCarriers as it either may include just the udiCarrier for the jurisdiction it is sold, or for multiple jurisdictions it could have been sold.", 0, java.lang.Integer.MAX_VALUE, udiCarrier));
3620        children.add(new Property("status", "code", "Status of the Device availability.", 0, 1, status));
3621        children.add(new Property("statusReason", "CodeableConcept", "Reason for the dtatus of the Device availability.", 0, java.lang.Integer.MAX_VALUE, statusReason));
3622        children.add(new Property("distinctIdentificationCode", "string", "The distinct identification code required by §1271.290(c) for a human cell, tissue, or cellular and tissue-based product regulated as a device.", 0, 1, distinctIdentificationCode));
3623        children.add(new Property("manufacturer", "string", "A name of the manufacturer.", 0, 1, manufacturer));
3624        children.add(new Property("manufactureDate", "dateTime", "The date and time when the device was manufactured.", 0, 1, manufactureDate));
3625        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));
3626        children.add(new Property("lotNumber", "string", "Lot number assigned by the manufacturer.", 0, 1, lotNumber));
3627        children.add(new Property("serialNumber", "string", "The serial number assigned by the organization when the device was manufactured.", 0, 1, serialNumber));
3628        children.add(new Property("deviceName", "", "This represents the manufacturer's name of the device as provided by the device, from a UDI label, or by a person describing the Device.  This typically would be used when a person provides the name(s) or when the device represents one of the names available from DeviceDefinition.", 0, java.lang.Integer.MAX_VALUE, deviceName));
3629        children.add(new Property("modelNumber", "string", "The model number for the device.", 0, 1, modelNumber));
3630        children.add(new Property("partNumber", "string", "The part number of thedevice.", 0, 1, partNumber));
3631        children.add(new Property("type", "CodeableConcept", "The kind or type of device.", 0, 1, type));
3632        children.add(new Property("specialization", "", "The capabilities supported on a  device, the standards to which the device conforms for a particular purpose, and used for the communication.", 0, java.lang.Integer.MAX_VALUE, specialization));
3633        children.add(new Property("version", "", "The actual design of the device or software version running on the device.", 0, java.lang.Integer.MAX_VALUE, version));
3634        children.add(new Property("property", "", "The actual configuration settings of a device as it actually operates, e.g., regulation status, time properties.", 0, java.lang.Integer.MAX_VALUE, property));
3635        children.add(new Property("patient", "Reference(Patient)", "Patient information, If the device is affixed to a person.", 0, 1, patient));
3636        children.add(new Property("owner", "Reference(Organization)", "An organization that is responsible for the provision and ongoing maintenance of the device.", 0, 1, owner));
3637        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));
3638        children.add(new Property("location", "Reference(Location)", "The place where the device can be found.", 0, 1, location));
3639        children.add(new Property("url", "uri", "A network address on which the device may be contacted directly.", 0, 1, url));
3640        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));
3641        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));
3642        children.add(new Property("parent", "Reference(Device)", "The parent device.", 0, 1, parent));
3643      }
3644
3645      @Override
3646      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3647        switch (_hash) {
3648        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);
3649        case -1014418093: /*definition*/  return new Property("definition", "Reference(DeviceDefinition)", "The reference to the definition for the device.", 0, 1, definition);
3650        case -1343558178: /*udiCarrier*/  return new Property("udiCarrier", "", "Unique device identifier (UDI) assigned to device label or package.  Note that the Device may include multiple udiCarriers as it either may include just the udiCarrier for the jurisdiction it is sold, or for multiple jurisdictions it could have been sold.", 0, java.lang.Integer.MAX_VALUE, udiCarrier);
3651        case -892481550: /*status*/  return new Property("status", "code", "Status of the Device availability.", 0, 1, status);
3652        case 2051346646: /*statusReason*/  return new Property("statusReason", "CodeableConcept", "Reason for the dtatus of the Device availability.", 0, java.lang.Integer.MAX_VALUE, statusReason);
3653        case -952360553: /*distinctIdentificationCode*/  return new Property("distinctIdentificationCode", "string", "The distinct identification code required by §1271.290(c) for a human cell, tissue, or cellular and tissue-based product regulated as a device.", 0, 1, distinctIdentificationCode);
3654        case -1969347631: /*manufacturer*/  return new Property("manufacturer", "string", "A name of the manufacturer.", 0, 1, manufacturer);
3655        case 416714767: /*manufactureDate*/  return new Property("manufactureDate", "dateTime", "The date and time when the device was manufactured.", 0, 1, manufactureDate);
3656        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);
3657        case 462547450: /*lotNumber*/  return new Property("lotNumber", "string", "Lot number assigned by the manufacturer.", 0, 1, lotNumber);
3658        case 83787357: /*serialNumber*/  return new Property("serialNumber", "string", "The serial number assigned by the organization when the device was manufactured.", 0, 1, serialNumber);
3659        case 780988929: /*deviceName*/  return new Property("deviceName", "", "This represents the manufacturer's name of the device as provided by the device, from a UDI label, or by a person describing the Device.  This typically would be used when a person provides the name(s) or when the device represents one of the names available from DeviceDefinition.", 0, java.lang.Integer.MAX_VALUE, deviceName);
3660        case 346619858: /*modelNumber*/  return new Property("modelNumber", "string", "The model number for the device.", 0, 1, modelNumber);
3661        case -731502308: /*partNumber*/  return new Property("partNumber", "string", "The part number of thedevice.", 0, 1, partNumber);
3662        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The kind or type of device.", 0, 1, type);
3663        case 682815883: /*specialization*/  return new Property("specialization", "", "The capabilities supported on a  device, the standards to which the device conforms for a particular purpose, and used for the communication.", 0, java.lang.Integer.MAX_VALUE, specialization);
3664        case 351608024: /*version*/  return new Property("version", "", "The actual design of the device or software version running on the device.", 0, java.lang.Integer.MAX_VALUE, version);
3665        case -993141291: /*property*/  return new Property("property", "", "The actual configuration settings of a device as it actually operates, e.g., regulation status, time properties.", 0, java.lang.Integer.MAX_VALUE, property);
3666        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "Patient information, If the device is affixed to a person.", 0, 1, patient);
3667        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);
3668        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);
3669        case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "The place where the device can be found.", 0, 1, location);
3670        case 116079: /*url*/  return new Property("url", "uri", "A network address on which the device may be contacted directly.", 0, 1, url);
3671        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);
3672        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);
3673        case -995424086: /*parent*/  return new Property("parent", "Reference(Device)", "The parent device.", 0, 1, parent);
3674        default: return super.getNamedProperty(_hash, _name, _checkValid);
3675        }
3676
3677      }
3678
3679      @Override
3680      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3681        switch (hash) {
3682        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3683        case -1014418093: /*definition*/ return this.definition == null ? new Base[0] : new Base[] {this.definition}; // Reference
3684        case -1343558178: /*udiCarrier*/ return this.udiCarrier == null ? new Base[0] : this.udiCarrier.toArray(new Base[this.udiCarrier.size()]); // DeviceUdiCarrierComponent
3685        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<FHIRDeviceStatus>
3686        case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : this.statusReason.toArray(new Base[this.statusReason.size()]); // CodeableConcept
3687        case -952360553: /*distinctIdentificationCode*/ return this.distinctIdentificationCode == null ? new Base[0] : new Base[] {this.distinctIdentificationCode}; // StringType
3688        case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : new Base[] {this.manufacturer}; // StringType
3689        case 416714767: /*manufactureDate*/ return this.manufactureDate == null ? new Base[0] : new Base[] {this.manufactureDate}; // DateTimeType
3690        case -668811523: /*expirationDate*/ return this.expirationDate == null ? new Base[0] : new Base[] {this.expirationDate}; // DateTimeType
3691        case 462547450: /*lotNumber*/ return this.lotNumber == null ? new Base[0] : new Base[] {this.lotNumber}; // StringType
3692        case 83787357: /*serialNumber*/ return this.serialNumber == null ? new Base[0] : new Base[] {this.serialNumber}; // StringType
3693        case 780988929: /*deviceName*/ return this.deviceName == null ? new Base[0] : this.deviceName.toArray(new Base[this.deviceName.size()]); // DeviceDeviceNameComponent
3694        case 346619858: /*modelNumber*/ return this.modelNumber == null ? new Base[0] : new Base[] {this.modelNumber}; // StringType
3695        case -731502308: /*partNumber*/ return this.partNumber == null ? new Base[0] : new Base[] {this.partNumber}; // StringType
3696        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3697        case 682815883: /*specialization*/ return this.specialization == null ? new Base[0] : this.specialization.toArray(new Base[this.specialization.size()]); // DeviceSpecializationComponent
3698        case 351608024: /*version*/ return this.version == null ? new Base[0] : this.version.toArray(new Base[this.version.size()]); // DeviceVersionComponent
3699        case -993141291: /*property*/ return this.property == null ? new Base[0] : this.property.toArray(new Base[this.property.size()]); // DevicePropertyComponent
3700        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
3701        case 106164915: /*owner*/ return this.owner == null ? new Base[0] : new Base[] {this.owner}; // Reference
3702        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactPoint
3703        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
3704        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
3705        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
3706        case -909893934: /*safety*/ return this.safety == null ? new Base[0] : this.safety.toArray(new Base[this.safety.size()]); // CodeableConcept
3707        case -995424086: /*parent*/ return this.parent == null ? new Base[0] : new Base[] {this.parent}; // Reference
3708        default: return super.getProperty(hash, name, checkValid);
3709        }
3710
3711      }
3712
3713      @Override
3714      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3715        switch (hash) {
3716        case -1618432855: // identifier
3717          this.getIdentifier().add(castToIdentifier(value)); // Identifier
3718          return value;
3719        case -1014418093: // definition
3720          this.definition = castToReference(value); // Reference
3721          return value;
3722        case -1343558178: // udiCarrier
3723          this.getUdiCarrier().add((DeviceUdiCarrierComponent) value); // DeviceUdiCarrierComponent
3724          return value;
3725        case -892481550: // status
3726          value = new FHIRDeviceStatusEnumFactory().fromType(castToCode(value));
3727          this.status = (Enumeration) value; // Enumeration<FHIRDeviceStatus>
3728          return value;
3729        case 2051346646: // statusReason
3730          this.getStatusReason().add(castToCodeableConcept(value)); // CodeableConcept
3731          return value;
3732        case -952360553: // distinctIdentificationCode
3733          this.distinctIdentificationCode = castToString(value); // StringType
3734          return value;
3735        case -1969347631: // manufacturer
3736          this.manufacturer = castToString(value); // StringType
3737          return value;
3738        case 416714767: // manufactureDate
3739          this.manufactureDate = castToDateTime(value); // DateTimeType
3740          return value;
3741        case -668811523: // expirationDate
3742          this.expirationDate = castToDateTime(value); // DateTimeType
3743          return value;
3744        case 462547450: // lotNumber
3745          this.lotNumber = castToString(value); // StringType
3746          return value;
3747        case 83787357: // serialNumber
3748          this.serialNumber = castToString(value); // StringType
3749          return value;
3750        case 780988929: // deviceName
3751          this.getDeviceName().add((DeviceDeviceNameComponent) value); // DeviceDeviceNameComponent
3752          return value;
3753        case 346619858: // modelNumber
3754          this.modelNumber = castToString(value); // StringType
3755          return value;
3756        case -731502308: // partNumber
3757          this.partNumber = castToString(value); // StringType
3758          return value;
3759        case 3575610: // type
3760          this.type = castToCodeableConcept(value); // CodeableConcept
3761          return value;
3762        case 682815883: // specialization
3763          this.getSpecialization().add((DeviceSpecializationComponent) value); // DeviceSpecializationComponent
3764          return value;
3765        case 351608024: // version
3766          this.getVersion().add((DeviceVersionComponent) value); // DeviceVersionComponent
3767          return value;
3768        case -993141291: // property
3769          this.getProperty().add((DevicePropertyComponent) value); // DevicePropertyComponent
3770          return value;
3771        case -791418107: // patient
3772          this.patient = castToReference(value); // Reference
3773          return value;
3774        case 106164915: // owner
3775          this.owner = castToReference(value); // Reference
3776          return value;
3777        case 951526432: // contact
3778          this.getContact().add(castToContactPoint(value)); // ContactPoint
3779          return value;
3780        case 1901043637: // location
3781          this.location = castToReference(value); // Reference
3782          return value;
3783        case 116079: // url
3784          this.url = castToUri(value); // UriType
3785          return value;
3786        case 3387378: // note
3787          this.getNote().add(castToAnnotation(value)); // Annotation
3788          return value;
3789        case -909893934: // safety
3790          this.getSafety().add(castToCodeableConcept(value)); // CodeableConcept
3791          return value;
3792        case -995424086: // parent
3793          this.parent = castToReference(value); // Reference
3794          return value;
3795        default: return super.setProperty(hash, name, value);
3796        }
3797
3798      }
3799
3800      @Override
3801      public Base setProperty(String name, Base value) throws FHIRException {
3802        if (name.equals("identifier")) {
3803          this.getIdentifier().add(castToIdentifier(value));
3804        } else if (name.equals("definition")) {
3805          this.definition = castToReference(value); // Reference
3806        } else if (name.equals("udiCarrier")) {
3807          this.getUdiCarrier().add((DeviceUdiCarrierComponent) value);
3808        } else if (name.equals("status")) {
3809          value = new FHIRDeviceStatusEnumFactory().fromType(castToCode(value));
3810          this.status = (Enumeration) value; // Enumeration<FHIRDeviceStatus>
3811        } else if (name.equals("statusReason")) {
3812          this.getStatusReason().add(castToCodeableConcept(value));
3813        } else if (name.equals("distinctIdentificationCode")) {
3814          this.distinctIdentificationCode = castToString(value); // StringType
3815        } else if (name.equals("manufacturer")) {
3816          this.manufacturer = castToString(value); // StringType
3817        } else if (name.equals("manufactureDate")) {
3818          this.manufactureDate = castToDateTime(value); // DateTimeType
3819        } else if (name.equals("expirationDate")) {
3820          this.expirationDate = castToDateTime(value); // DateTimeType
3821        } else if (name.equals("lotNumber")) {
3822          this.lotNumber = castToString(value); // StringType
3823        } else if (name.equals("serialNumber")) {
3824          this.serialNumber = castToString(value); // StringType
3825        } else if (name.equals("deviceName")) {
3826          this.getDeviceName().add((DeviceDeviceNameComponent) value);
3827        } else if (name.equals("modelNumber")) {
3828          this.modelNumber = castToString(value); // StringType
3829        } else if (name.equals("partNumber")) {
3830          this.partNumber = castToString(value); // StringType
3831        } else if (name.equals("type")) {
3832          this.type = castToCodeableConcept(value); // CodeableConcept
3833        } else if (name.equals("specialization")) {
3834          this.getSpecialization().add((DeviceSpecializationComponent) value);
3835        } else if (name.equals("version")) {
3836          this.getVersion().add((DeviceVersionComponent) value);
3837        } else if (name.equals("property")) {
3838          this.getProperty().add((DevicePropertyComponent) value);
3839        } else if (name.equals("patient")) {
3840          this.patient = castToReference(value); // Reference
3841        } else if (name.equals("owner")) {
3842          this.owner = castToReference(value); // Reference
3843        } else if (name.equals("contact")) {
3844          this.getContact().add(castToContactPoint(value));
3845        } else if (name.equals("location")) {
3846          this.location = castToReference(value); // Reference
3847        } else if (name.equals("url")) {
3848          this.url = castToUri(value); // UriType
3849        } else if (name.equals("note")) {
3850          this.getNote().add(castToAnnotation(value));
3851        } else if (name.equals("safety")) {
3852          this.getSafety().add(castToCodeableConcept(value));
3853        } else if (name.equals("parent")) {
3854          this.parent = castToReference(value); // Reference
3855        } else
3856          return super.setProperty(name, value);
3857        return value;
3858      }
3859
3860      @Override
3861      public Base makeProperty(int hash, String name) throws FHIRException {
3862        switch (hash) {
3863        case -1618432855:  return addIdentifier(); 
3864        case -1014418093:  return getDefinition(); 
3865        case -1343558178:  return addUdiCarrier(); 
3866        case -892481550:  return getStatusElement();
3867        case 2051346646:  return addStatusReason(); 
3868        case -952360553:  return getDistinctIdentificationCodeElement();
3869        case -1969347631:  return getManufacturerElement();
3870        case 416714767:  return getManufactureDateElement();
3871        case -668811523:  return getExpirationDateElement();
3872        case 462547450:  return getLotNumberElement();
3873        case 83787357:  return getSerialNumberElement();
3874        case 780988929:  return addDeviceName(); 
3875        case 346619858:  return getModelNumberElement();
3876        case -731502308:  return getPartNumberElement();
3877        case 3575610:  return getType(); 
3878        case 682815883:  return addSpecialization(); 
3879        case 351608024:  return addVersion(); 
3880        case -993141291:  return addProperty(); 
3881        case -791418107:  return getPatient(); 
3882        case 106164915:  return getOwner(); 
3883        case 951526432:  return addContact(); 
3884        case 1901043637:  return getLocation(); 
3885        case 116079:  return getUrlElement();
3886        case 3387378:  return addNote(); 
3887        case -909893934:  return addSafety(); 
3888        case -995424086:  return getParent(); 
3889        default: return super.makeProperty(hash, name);
3890        }
3891
3892      }
3893
3894      @Override
3895      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3896        switch (hash) {
3897        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3898        case -1014418093: /*definition*/ return new String[] {"Reference"};
3899        case -1343558178: /*udiCarrier*/ return new String[] {};
3900        case -892481550: /*status*/ return new String[] {"code"};
3901        case 2051346646: /*statusReason*/ return new String[] {"CodeableConcept"};
3902        case -952360553: /*distinctIdentificationCode*/ return new String[] {"string"};
3903        case -1969347631: /*manufacturer*/ return new String[] {"string"};
3904        case 416714767: /*manufactureDate*/ return new String[] {"dateTime"};
3905        case -668811523: /*expirationDate*/ return new String[] {"dateTime"};
3906        case 462547450: /*lotNumber*/ return new String[] {"string"};
3907        case 83787357: /*serialNumber*/ return new String[] {"string"};
3908        case 780988929: /*deviceName*/ return new String[] {};
3909        case 346619858: /*modelNumber*/ return new String[] {"string"};
3910        case -731502308: /*partNumber*/ return new String[] {"string"};
3911        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3912        case 682815883: /*specialization*/ return new String[] {};
3913        case 351608024: /*version*/ return new String[] {};
3914        case -993141291: /*property*/ return new String[] {};
3915        case -791418107: /*patient*/ return new String[] {"Reference"};
3916        case 106164915: /*owner*/ return new String[] {"Reference"};
3917        case 951526432: /*contact*/ return new String[] {"ContactPoint"};
3918        case 1901043637: /*location*/ return new String[] {"Reference"};
3919        case 116079: /*url*/ return new String[] {"uri"};
3920        case 3387378: /*note*/ return new String[] {"Annotation"};
3921        case -909893934: /*safety*/ return new String[] {"CodeableConcept"};
3922        case -995424086: /*parent*/ return new String[] {"Reference"};
3923        default: return super.getTypesForProperty(hash, name);
3924        }
3925
3926      }
3927
3928      @Override
3929      public Base addChild(String name) throws FHIRException {
3930        if (name.equals("identifier")) {
3931          return addIdentifier();
3932        }
3933        else if (name.equals("definition")) {
3934          this.definition = new Reference();
3935          return this.definition;
3936        }
3937        else if (name.equals("udiCarrier")) {
3938          return addUdiCarrier();
3939        }
3940        else if (name.equals("status")) {
3941          throw new FHIRException("Cannot call addChild on a primitive type Device.status");
3942        }
3943        else if (name.equals("statusReason")) {
3944          return addStatusReason();
3945        }
3946        else if (name.equals("distinctIdentificationCode")) {
3947          throw new FHIRException("Cannot call addChild on a primitive type Device.distinctIdentificationCode");
3948        }
3949        else if (name.equals("manufacturer")) {
3950          throw new FHIRException("Cannot call addChild on a primitive type Device.manufacturer");
3951        }
3952        else if (name.equals("manufactureDate")) {
3953          throw new FHIRException("Cannot call addChild on a primitive type Device.manufactureDate");
3954        }
3955        else if (name.equals("expirationDate")) {
3956          throw new FHIRException("Cannot call addChild on a primitive type Device.expirationDate");
3957        }
3958        else if (name.equals("lotNumber")) {
3959          throw new FHIRException("Cannot call addChild on a primitive type Device.lotNumber");
3960        }
3961        else if (name.equals("serialNumber")) {
3962          throw new FHIRException("Cannot call addChild on a primitive type Device.serialNumber");
3963        }
3964        else if (name.equals("deviceName")) {
3965          return addDeviceName();
3966        }
3967        else if (name.equals("modelNumber")) {
3968          throw new FHIRException("Cannot call addChild on a primitive type Device.modelNumber");
3969        }
3970        else if (name.equals("partNumber")) {
3971          throw new FHIRException("Cannot call addChild on a primitive type Device.partNumber");
3972        }
3973        else if (name.equals("type")) {
3974          this.type = new CodeableConcept();
3975          return this.type;
3976        }
3977        else if (name.equals("specialization")) {
3978          return addSpecialization();
3979        }
3980        else if (name.equals("version")) {
3981          return addVersion();
3982        }
3983        else if (name.equals("property")) {
3984          return addProperty();
3985        }
3986        else if (name.equals("patient")) {
3987          this.patient = new Reference();
3988          return this.patient;
3989        }
3990        else if (name.equals("owner")) {
3991          this.owner = new Reference();
3992          return this.owner;
3993        }
3994        else if (name.equals("contact")) {
3995          return addContact();
3996        }
3997        else if (name.equals("location")) {
3998          this.location = new Reference();
3999          return this.location;
4000        }
4001        else if (name.equals("url")) {
4002          throw new FHIRException("Cannot call addChild on a primitive type Device.url");
4003        }
4004        else if (name.equals("note")) {
4005          return addNote();
4006        }
4007        else if (name.equals("safety")) {
4008          return addSafety();
4009        }
4010        else if (name.equals("parent")) {
4011          this.parent = new Reference();
4012          return this.parent;
4013        }
4014        else
4015          return super.addChild(name);
4016      }
4017
4018  public String fhirType() {
4019    return "Device";
4020
4021  }
4022
4023      public Device copy() {
4024        Device dst = new Device();
4025        copyValues(dst);
4026        if (identifier != null) {
4027          dst.identifier = new ArrayList<Identifier>();
4028          for (Identifier i : identifier)
4029            dst.identifier.add(i.copy());
4030        };
4031        dst.definition = definition == null ? null : definition.copy();
4032        if (udiCarrier != null) {
4033          dst.udiCarrier = new ArrayList<DeviceUdiCarrierComponent>();
4034          for (DeviceUdiCarrierComponent i : udiCarrier)
4035            dst.udiCarrier.add(i.copy());
4036        };
4037        dst.status = status == null ? null : status.copy();
4038        if (statusReason != null) {
4039          dst.statusReason = new ArrayList<CodeableConcept>();
4040          for (CodeableConcept i : statusReason)
4041            dst.statusReason.add(i.copy());
4042        };
4043        dst.distinctIdentificationCode = distinctIdentificationCode == null ? null : distinctIdentificationCode.copy();
4044        dst.manufacturer = manufacturer == null ? null : manufacturer.copy();
4045        dst.manufactureDate = manufactureDate == null ? null : manufactureDate.copy();
4046        dst.expirationDate = expirationDate == null ? null : expirationDate.copy();
4047        dst.lotNumber = lotNumber == null ? null : lotNumber.copy();
4048        dst.serialNumber = serialNumber == null ? null : serialNumber.copy();
4049        if (deviceName != null) {
4050          dst.deviceName = new ArrayList<DeviceDeviceNameComponent>();
4051          for (DeviceDeviceNameComponent i : deviceName)
4052            dst.deviceName.add(i.copy());
4053        };
4054        dst.modelNumber = modelNumber == null ? null : modelNumber.copy();
4055        dst.partNumber = partNumber == null ? null : partNumber.copy();
4056        dst.type = type == null ? null : type.copy();
4057        if (specialization != null) {
4058          dst.specialization = new ArrayList<DeviceSpecializationComponent>();
4059          for (DeviceSpecializationComponent i : specialization)
4060            dst.specialization.add(i.copy());
4061        };
4062        if (version != null) {
4063          dst.version = new ArrayList<DeviceVersionComponent>();
4064          for (DeviceVersionComponent i : version)
4065            dst.version.add(i.copy());
4066        };
4067        if (property != null) {
4068          dst.property = new ArrayList<DevicePropertyComponent>();
4069          for (DevicePropertyComponent i : property)
4070            dst.property.add(i.copy());
4071        };
4072        dst.patient = patient == null ? null : patient.copy();
4073        dst.owner = owner == null ? null : owner.copy();
4074        if (contact != null) {
4075          dst.contact = new ArrayList<ContactPoint>();
4076          for (ContactPoint i : contact)
4077            dst.contact.add(i.copy());
4078        };
4079        dst.location = location == null ? null : location.copy();
4080        dst.url = url == null ? null : url.copy();
4081        if (note != null) {
4082          dst.note = new ArrayList<Annotation>();
4083          for (Annotation i : note)
4084            dst.note.add(i.copy());
4085        };
4086        if (safety != null) {
4087          dst.safety = new ArrayList<CodeableConcept>();
4088          for (CodeableConcept i : safety)
4089            dst.safety.add(i.copy());
4090        };
4091        dst.parent = parent == null ? null : parent.copy();
4092        return dst;
4093      }
4094
4095      protected Device typedCopy() {
4096        return copy();
4097      }
4098
4099      @Override
4100      public boolean equalsDeep(Base other_) {
4101        if (!super.equalsDeep(other_))
4102          return false;
4103        if (!(other_ instanceof Device))
4104          return false;
4105        Device o = (Device) other_;
4106        return compareDeep(identifier, o.identifier, true) && compareDeep(definition, o.definition, true)
4107           && compareDeep(udiCarrier, o.udiCarrier, true) && compareDeep(status, o.status, true) && compareDeep(statusReason, o.statusReason, true)
4108           && compareDeep(distinctIdentificationCode, o.distinctIdentificationCode, true) && compareDeep(manufacturer, o.manufacturer, true)
4109           && compareDeep(manufactureDate, o.manufactureDate, true) && compareDeep(expirationDate, o.expirationDate, true)
4110           && compareDeep(lotNumber, o.lotNumber, true) && compareDeep(serialNumber, o.serialNumber, true)
4111           && compareDeep(deviceName, o.deviceName, true) && compareDeep(modelNumber, o.modelNumber, true)
4112           && compareDeep(partNumber, o.partNumber, true) && compareDeep(type, o.type, true) && compareDeep(specialization, o.specialization, true)
4113           && compareDeep(version, o.version, true) && compareDeep(property, o.property, true) && compareDeep(patient, o.patient, true)
4114           && compareDeep(owner, o.owner, true) && compareDeep(contact, o.contact, true) && compareDeep(location, o.location, true)
4115           && compareDeep(url, o.url, true) && compareDeep(note, o.note, true) && compareDeep(safety, o.safety, true)
4116           && compareDeep(parent, o.parent, true);
4117      }
4118
4119      @Override
4120      public boolean equalsShallow(Base other_) {
4121        if (!super.equalsShallow(other_))
4122          return false;
4123        if (!(other_ instanceof Device))
4124          return false;
4125        Device o = (Device) other_;
4126        return compareValues(status, o.status, true) && compareValues(distinctIdentificationCode, o.distinctIdentificationCode, true)
4127           && compareValues(manufacturer, o.manufacturer, true) && compareValues(manufactureDate, o.manufactureDate, true)
4128           && compareValues(expirationDate, o.expirationDate, true) && compareValues(lotNumber, o.lotNumber, true)
4129           && compareValues(serialNumber, o.serialNumber, true) && compareValues(modelNumber, o.modelNumber, true)
4130           && compareValues(partNumber, o.partNumber, true) && compareValues(url, o.url, true);
4131      }
4132
4133      public boolean isEmpty() {
4134        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, definition, udiCarrier
4135          , status, statusReason, distinctIdentificationCode, manufacturer, manufactureDate
4136          , expirationDate, lotNumber, serialNumber, deviceName, modelNumber, partNumber, type
4137          , specialization, version, property, patient, owner, contact, location, url
4138          , note, safety, parent);
4139      }
4140
4141  @Override
4142  public ResourceType getResourceType() {
4143    return ResourceType.Device;
4144   }
4145
4146 /**
4147   * Search parameter: <b>udi-di</b>
4148   * <p>
4149   * Description: <b>The udi Device Identifier (DI)</b><br>
4150   * Type: <b>string</b><br>
4151   * Path: <b></b><br>
4152   * </p>
4153   */
4154  @SearchParamDefinition(name="udi-di", path="", description="The udi Device Identifier (DI)", type="string" )
4155  public static final String SP_UDI_DI = "udi-di";
4156 /**
4157   * <b>Fluent Client</b> search parameter constant for <b>udi-di</b>
4158   * <p>
4159   * Description: <b>The udi Device Identifier (DI)</b><br>
4160   * Type: <b>string</b><br>
4161   * Path: <b></b><br>
4162   * </p>
4163   */
4164  public static final ca.uhn.fhir.rest.gclient.StringClientParam UDI_DI = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_UDI_DI);
4165
4166 /**
4167   * Search parameter: <b>identifier</b>
4168   * <p>
4169   * Description: <b>Instance id from manufacturer, owner, and others</b><br>
4170   * Type: <b>token</b><br>
4171   * Path: <b>Device.identifier</b><br>
4172   * </p>
4173   */
4174  @SearchParamDefinition(name="identifier", path="Device.identifier", description="Instance id from manufacturer, owner, and others", type="token" )
4175  public static final String SP_IDENTIFIER = "identifier";
4176 /**
4177   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4178   * <p>
4179   * Description: <b>Instance id from manufacturer, owner, and others</b><br>
4180   * Type: <b>token</b><br>
4181   * Path: <b>Device.identifier</b><br>
4182   * </p>
4183   */
4184  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
4185
4186 /**
4187   * Search parameter: <b>udi-carrier</b>
4188   * <p>
4189   * Description: <b>UDI Barcode (RFID or other technology) string either in HRF format or AIDC format converted to base64 string.</b><br>
4190   * Type: <b>string</b><br>
4191   * Path: <b></b><br>
4192   * </p>
4193   */
4194  @SearchParamDefinition(name="udi-carrier", path="", description="UDI Barcode (RFID or other technology) string either in HRF format or AIDC format converted to base64 string.", type="string" )
4195  public static final String SP_UDI_CARRIER = "udi-carrier";
4196 /**
4197   * <b>Fluent Client</b> search parameter constant for <b>udi-carrier</b>
4198   * <p>
4199   * Description: <b>UDI Barcode (RFID or other technology) string either in HRF format or AIDC format converted to base64 string.</b><br>
4200   * Type: <b>string</b><br>
4201   * Path: <b></b><br>
4202   * </p>
4203   */
4204  public static final ca.uhn.fhir.rest.gclient.StringClientParam UDI_CARRIER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_UDI_CARRIER);
4205
4206 /**
4207   * Search parameter: <b>device-name</b>
4208   * <p>
4209   * 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>
4210   * Type: <b>string</b><br>
4211   * Path: <b>Device.type.text, Device.type.coding.display</b><br>
4212   * </p>
4213   */
4214  @SearchParamDefinition(name="device-name", path="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" )
4215  public static final String SP_DEVICE_NAME = "device-name";
4216 /**
4217   * <b>Fluent Client</b> search parameter constant for <b>device-name</b>
4218   * <p>
4219   * 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>
4220   * Type: <b>string</b><br>
4221   * Path: <b>Device.type.text, Device.type.coding.display</b><br>
4222   * </p>
4223   */
4224  public static final ca.uhn.fhir.rest.gclient.StringClientParam DEVICE_NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DEVICE_NAME);
4225
4226 /**
4227   * Search parameter: <b>patient</b>
4228   * <p>
4229   * Description: <b>Patient information, if the resource is affixed to a person</b><br>
4230   * Type: <b>reference</b><br>
4231   * Path: <b>Device.patient</b><br>
4232   * </p>
4233   */
4234  @SearchParamDefinition(name="patient", path="Device.patient", description="Patient information, if the resource is affixed to a person", type="reference", target={Patient.class } )
4235  public static final String SP_PATIENT = "patient";
4236 /**
4237   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
4238   * <p>
4239   * Description: <b>Patient information, if the resource is affixed to a person</b><br>
4240   * Type: <b>reference</b><br>
4241   * Path: <b>Device.patient</b><br>
4242   * </p>
4243   */
4244  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
4245
4246/**
4247   * Constant for fluent queries to be used to add include statements. Specifies
4248   * the path value of "<b>Device:patient</b>".
4249   */
4250  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Device:patient").toLocked();
4251
4252 /**
4253   * Search parameter: <b>organization</b>
4254   * <p>
4255   * Description: <b>The organization responsible for the device</b><br>
4256   * Type: <b>reference</b><br>
4257   * Path: <b>Device.owner</b><br>
4258   * </p>
4259   */
4260  @SearchParamDefinition(name="organization", path="Device.owner", description="The organization responsible for the device", type="reference", target={Organization.class } )
4261  public static final String SP_ORGANIZATION = "organization";
4262 /**
4263   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
4264   * <p>
4265   * Description: <b>The organization responsible for the device</b><br>
4266   * Type: <b>reference</b><br>
4267   * Path: <b>Device.owner</b><br>
4268   * </p>
4269   */
4270  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
4271
4272/**
4273   * Constant for fluent queries to be used to add include statements. Specifies
4274   * the path value of "<b>Device:organization</b>".
4275   */
4276  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("Device:organization").toLocked();
4277
4278 /**
4279   * Search parameter: <b>model</b>
4280   * <p>
4281   * Description: <b>The model of the device</b><br>
4282   * Type: <b>string</b><br>
4283   * Path: <b></b><br>
4284   * </p>
4285   */
4286  @SearchParamDefinition(name="model", path="", description="The model of the device", type="string" )
4287  public static final String SP_MODEL = "model";
4288 /**
4289   * <b>Fluent Client</b> search parameter constant for <b>model</b>
4290   * <p>
4291   * Description: <b>The model of the device</b><br>
4292   * Type: <b>string</b><br>
4293   * Path: <b></b><br>
4294   * </p>
4295   */
4296  public static final ca.uhn.fhir.rest.gclient.StringClientParam MODEL = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_MODEL);
4297
4298 /**
4299   * Search parameter: <b>location</b>
4300   * <p>
4301   * Description: <b>A location, where the resource is found</b><br>
4302   * Type: <b>reference</b><br>
4303   * Path: <b>Device.location</b><br>
4304   * </p>
4305   */
4306  @SearchParamDefinition(name="location", path="Device.location", description="A location, where the resource is found", type="reference", target={Location.class } )
4307  public static final String SP_LOCATION = "location";
4308 /**
4309   * <b>Fluent Client</b> search parameter constant for <b>location</b>
4310   * <p>
4311   * Description: <b>A location, where the resource is found</b><br>
4312   * Type: <b>reference</b><br>
4313   * Path: <b>Device.location</b><br>
4314   * </p>
4315   */
4316  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
4317
4318/**
4319   * Constant for fluent queries to be used to add include statements. Specifies
4320   * the path value of "<b>Device:location</b>".
4321   */
4322  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("Device:location").toLocked();
4323
4324 /**
4325   * Search parameter: <b>type</b>
4326   * <p>
4327   * Description: <b>The type of the device</b><br>
4328   * Type: <b>token</b><br>
4329   * Path: <b>Device.type</b><br>
4330   * </p>
4331   */
4332  @SearchParamDefinition(name="type", path="Device.type", description="The type of the device", type="token" )
4333  public static final String SP_TYPE = "type";
4334 /**
4335   * <b>Fluent Client</b> search parameter constant for <b>type</b>
4336   * <p>
4337   * Description: <b>The type of the device</b><br>
4338   * Type: <b>token</b><br>
4339   * Path: <b>Device.type</b><br>
4340   * </p>
4341   */
4342  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
4343
4344 /**
4345   * Search parameter: <b>url</b>
4346   * <p>
4347   * Description: <b>Network address to contact device</b><br>
4348   * Type: <b>uri</b><br>
4349   * Path: <b>Device.url</b><br>
4350   * </p>
4351   */
4352  @SearchParamDefinition(name="url", path="Device.url", description="Network address to contact device", type="uri" )
4353  public static final String SP_URL = "url";
4354 /**
4355   * <b>Fluent Client</b> search parameter constant for <b>url</b>
4356   * <p>
4357   * Description: <b>Network address to contact device</b><br>
4358   * Type: <b>uri</b><br>
4359   * Path: <b>Device.url</b><br>
4360   * </p>
4361   */
4362  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
4363
4364 /**
4365   * Search parameter: <b>manufacturer</b>
4366   * <p>
4367   * Description: <b>The manufacturer of the device</b><br>
4368   * Type: <b>string</b><br>
4369   * Path: <b>Device.manufacturer</b><br>
4370   * </p>
4371   */
4372  @SearchParamDefinition(name="manufacturer", path="Device.manufacturer", description="The manufacturer of the device", type="string" )
4373  public static final String SP_MANUFACTURER = "manufacturer";
4374 /**
4375   * <b>Fluent Client</b> search parameter constant for <b>manufacturer</b>
4376   * <p>
4377   * Description: <b>The manufacturer of the device</b><br>
4378   * Type: <b>string</b><br>
4379   * Path: <b>Device.manufacturer</b><br>
4380   * </p>
4381   */
4382  public static final ca.uhn.fhir.rest.gclient.StringClientParam MANUFACTURER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_MANUFACTURER);
4383
4384 /**
4385   * Search parameter: <b>status</b>
4386   * <p>
4387   * Description: <b>active | inactive | entered-in-error | unknown</b><br>
4388   * Type: <b>token</b><br>
4389   * Path: <b>Device.status</b><br>
4390   * </p>
4391   */
4392  @SearchParamDefinition(name="status", path="Device.status", description="active | inactive | entered-in-error | unknown", type="token" )
4393  public static final String SP_STATUS = "status";
4394 /**
4395   * <b>Fluent Client</b> search parameter constant for <b>status</b>
4396   * <p>
4397   * Description: <b>active | inactive | entered-in-error | unknown</b><br>
4398   * Type: <b>token</b><br>
4399   * Path: <b>Device.status</b><br>
4400   * </p>
4401   */
4402  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
4403
4404
4405}
4406