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