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