001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Fri, Jul 15, 2022 11:20+1000 for FHIR v5.0.0-snapshot2
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * This resource describes the properties (regulated, has real time clock, etc.), adminstrative (manufacturer name, model number, serial number, firmware, etc), and type (knee replacement, blood pressure cuff, MRI, etc.) of a physical unit (these values do not change much within a given module, for example the serail number, manufacturer name, and model number). An actual unit may consist of several modules in a distinct hierarchy and these are represented by multiple Device resources and bound through the 'parent' element.
052 */
053@ResourceDef(name="Device", profile="http://hl7.org/fhir/StructureDefinition/Device")
054public class Device extends DomainResource {
055
056    public enum FHIRDeviceStatus {
057        /**
058         * The device is available for use.  Note: For *implanted devices*  this means that the device is implanted in the patient.
059         */
060        ACTIVE, 
061        /**
062         * 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.
063         */
064        INACTIVE, 
065        /**
066         * The device was entered in error and voided.
067         */
068        ENTEREDINERROR, 
069        /**
070         * added to help the parsers with the generic types
071         */
072        NULL;
073        public static FHIRDeviceStatus fromCode(String codeString) throws FHIRException {
074            if (codeString == null || "".equals(codeString))
075                return null;
076        if ("active".equals(codeString))
077          return ACTIVE;
078        if ("inactive".equals(codeString))
079          return INACTIVE;
080        if ("entered-in-error".equals(codeString))
081          return ENTEREDINERROR;
082        if (Configuration.isAcceptInvalidEnums())
083          return null;
084        else
085          throw new FHIRException("Unknown FHIRDeviceStatus code '"+codeString+"'");
086        }
087        public String toCode() {
088          switch (this) {
089            case ACTIVE: return "active";
090            case INACTIVE: return "inactive";
091            case ENTEREDINERROR: return "entered-in-error";
092            case NULL: return null;
093            default: return "?";
094          }
095        }
096        public String getSystem() {
097          switch (this) {
098            case ACTIVE: return "http://hl7.org/fhir/device-status";
099            case INACTIVE: return "http://hl7.org/fhir/device-status";
100            case ENTEREDINERROR: return "http://hl7.org/fhir/device-status";
101            case NULL: return null;
102            default: return "?";
103          }
104        }
105        public String getDefinition() {
106          switch (this) {
107            case ACTIVE: return "The device is available for use.  Note: For *implanted devices*  this means that the device is implanted in the patient.";
108            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.";
109            case ENTEREDINERROR: return "The device was entered in error and voided.";
110            case NULL: return null;
111            default: return "?";
112          }
113        }
114        public String getDisplay() {
115          switch (this) {
116            case ACTIVE: return "Active";
117            case INACTIVE: return "Inactive";
118            case ENTEREDINERROR: return "Entered in Error";
119            case NULL: return null;
120            default: return "?";
121          }
122        }
123    }
124
125  public static class FHIRDeviceStatusEnumFactory implements EnumFactory<FHIRDeviceStatus> {
126    public FHIRDeviceStatus fromCode(String codeString) throws IllegalArgumentException {
127      if (codeString == null || "".equals(codeString))
128            if (codeString == null || "".equals(codeString))
129                return null;
130        if ("active".equals(codeString))
131          return FHIRDeviceStatus.ACTIVE;
132        if ("inactive".equals(codeString))
133          return FHIRDeviceStatus.INACTIVE;
134        if ("entered-in-error".equals(codeString))
135          return FHIRDeviceStatus.ENTEREDINERROR;
136        throw new IllegalArgumentException("Unknown FHIRDeviceStatus code '"+codeString+"'");
137        }
138        public Enumeration<FHIRDeviceStatus> fromType(Base code) throws FHIRException {
139          if (code == null)
140            return null;
141          if (code.isEmpty())
142            return new Enumeration<FHIRDeviceStatus>(this);
143          String codeString = ((PrimitiveType) code).asStringValue();
144          if (codeString == null || "".equals(codeString))
145            return null;
146        if ("active".equals(codeString))
147          return new Enumeration<FHIRDeviceStatus>(this, FHIRDeviceStatus.ACTIVE);
148        if ("inactive".equals(codeString))
149          return new Enumeration<FHIRDeviceStatus>(this, FHIRDeviceStatus.INACTIVE);
150        if ("entered-in-error".equals(codeString))
151          return new Enumeration<FHIRDeviceStatus>(this, FHIRDeviceStatus.ENTEREDINERROR);
152        throw new FHIRException("Unknown FHIRDeviceStatus code '"+codeString+"'");
153        }
154    public String toCode(FHIRDeviceStatus code) {
155      if (code == FHIRDeviceStatus.ACTIVE)
156        return "active";
157      if (code == FHIRDeviceStatus.INACTIVE)
158        return "inactive";
159      if (code == FHIRDeviceStatus.ENTEREDINERROR)
160        return "entered-in-error";
161      return "?";
162      }
163    public String toSystem(FHIRDeviceStatus code) {
164      return code.getSystem();
165      }
166    }
167
168    public enum UDIEntryType {
169        /**
170         * a barcodescanner captured the data from the device label.
171         */
172        BARCODE, 
173        /**
174         * An RFID chip reader captured the data from the device label.
175         */
176        RFID, 
177        /**
178         * The data was read from the label by a person and manually entered. (e.g.  via a keyboard).
179         */
180        MANUAL, 
181        /**
182         * The data originated from a patient's implant card and was read by an operator.
183         */
184        CARD, 
185        /**
186         * The data originated from a patient source and was not directly scanned or read from a label or card.
187         */
188        SELFREPORTED, 
189        /**
190         * The UDI information was received electronically from the device through a communication protocol, such as the IEEE 11073 20601 version 4 exchange protocol over Bluetooth or USB.
191         */
192        ELECTRONICTRANSMISSION, 
193        /**
194         * The method of data capture has not been determined.
195         */
196        UNKNOWN, 
197        /**
198         * added to help the parsers with the generic types
199         */
200        NULL;
201        public static UDIEntryType fromCode(String codeString) throws FHIRException {
202            if (codeString == null || "".equals(codeString))
203                return null;
204        if ("barcode".equals(codeString))
205          return BARCODE;
206        if ("rfid".equals(codeString))
207          return RFID;
208        if ("manual".equals(codeString))
209          return MANUAL;
210        if ("card".equals(codeString))
211          return CARD;
212        if ("self-reported".equals(codeString))
213          return SELFREPORTED;
214        if ("electronic-transmission".equals(codeString))
215          return ELECTRONICTRANSMISSION;
216        if ("unknown".equals(codeString))
217          return UNKNOWN;
218        if (Configuration.isAcceptInvalidEnums())
219          return null;
220        else
221          throw new FHIRException("Unknown UDIEntryType code '"+codeString+"'");
222        }
223        public String toCode() {
224          switch (this) {
225            case BARCODE: return "barcode";
226            case RFID: return "rfid";
227            case MANUAL: return "manual";
228            case CARD: return "card";
229            case SELFREPORTED: return "self-reported";
230            case ELECTRONICTRANSMISSION: return "electronic-transmission";
231            case UNKNOWN: return "unknown";
232            case NULL: return null;
233            default: return "?";
234          }
235        }
236        public String getSystem() {
237          switch (this) {
238            case BARCODE: return "http://hl7.org/fhir/udi-entry-type";
239            case RFID: return "http://hl7.org/fhir/udi-entry-type";
240            case MANUAL: return "http://hl7.org/fhir/udi-entry-type";
241            case CARD: return "http://hl7.org/fhir/udi-entry-type";
242            case SELFREPORTED: return "http://hl7.org/fhir/udi-entry-type";
243            case ELECTRONICTRANSMISSION: return "http://hl7.org/fhir/udi-entry-type";
244            case UNKNOWN: return "http://hl7.org/fhir/udi-entry-type";
245            case NULL: return null;
246            default: return "?";
247          }
248        }
249        public String getDefinition() {
250          switch (this) {
251            case BARCODE: return "a barcodescanner captured the data from the device label.";
252            case RFID: return "An RFID chip reader captured the data from the device label.";
253            case MANUAL: return "The data was read from the label by a person and manually entered. (e.g.  via a keyboard).";
254            case CARD: return "The data originated from a patient's implant card and was read by an operator.";
255            case SELFREPORTED: return "The data originated from a patient source and was not directly scanned or read from a label or card.";
256            case ELECTRONICTRANSMISSION: return "The UDI information was received electronically from the device through a communication protocol, such as the IEEE 11073 20601 version 4 exchange protocol over Bluetooth or USB.";
257            case UNKNOWN: return "The method of data capture has not been determined.";
258            case NULL: return null;
259            default: return "?";
260          }
261        }
262        public String getDisplay() {
263          switch (this) {
264            case BARCODE: return "Barcode";
265            case RFID: return "RFID";
266            case MANUAL: return "Manual";
267            case CARD: return "Card";
268            case SELFREPORTED: return "Self Reported";
269            case ELECTRONICTRANSMISSION: return "Electronic Transmission";
270            case UNKNOWN: return "Unknown";
271            case NULL: return null;
272            default: return "?";
273          }
274        }
275    }
276
277  public static class UDIEntryTypeEnumFactory implements EnumFactory<UDIEntryType> {
278    public UDIEntryType fromCode(String codeString) throws IllegalArgumentException {
279      if (codeString == null || "".equals(codeString))
280            if (codeString == null || "".equals(codeString))
281                return null;
282        if ("barcode".equals(codeString))
283          return UDIEntryType.BARCODE;
284        if ("rfid".equals(codeString))
285          return UDIEntryType.RFID;
286        if ("manual".equals(codeString))
287          return UDIEntryType.MANUAL;
288        if ("card".equals(codeString))
289          return UDIEntryType.CARD;
290        if ("self-reported".equals(codeString))
291          return UDIEntryType.SELFREPORTED;
292        if ("electronic-transmission".equals(codeString))
293          return UDIEntryType.ELECTRONICTRANSMISSION;
294        if ("unknown".equals(codeString))
295          return UDIEntryType.UNKNOWN;
296        throw new IllegalArgumentException("Unknown UDIEntryType code '"+codeString+"'");
297        }
298        public Enumeration<UDIEntryType> fromType(Base code) throws FHIRException {
299          if (code == null)
300            return null;
301          if (code.isEmpty())
302            return new Enumeration<UDIEntryType>(this);
303          String codeString = ((PrimitiveType) code).asStringValue();
304          if (codeString == null || "".equals(codeString))
305            return null;
306        if ("barcode".equals(codeString))
307          return new Enumeration<UDIEntryType>(this, UDIEntryType.BARCODE);
308        if ("rfid".equals(codeString))
309          return new Enumeration<UDIEntryType>(this, UDIEntryType.RFID);
310        if ("manual".equals(codeString))
311          return new Enumeration<UDIEntryType>(this, UDIEntryType.MANUAL);
312        if ("card".equals(codeString))
313          return new Enumeration<UDIEntryType>(this, UDIEntryType.CARD);
314        if ("self-reported".equals(codeString))
315          return new Enumeration<UDIEntryType>(this, UDIEntryType.SELFREPORTED);
316        if ("electronic-transmission".equals(codeString))
317          return new Enumeration<UDIEntryType>(this, UDIEntryType.ELECTRONICTRANSMISSION);
318        if ("unknown".equals(codeString))
319          return new Enumeration<UDIEntryType>(this, UDIEntryType.UNKNOWN);
320        throw new FHIRException("Unknown UDIEntryType code '"+codeString+"'");
321        }
322    public String toCode(UDIEntryType code) {
323      if (code == UDIEntryType.BARCODE)
324        return "barcode";
325      if (code == UDIEntryType.RFID)
326        return "rfid";
327      if (code == UDIEntryType.MANUAL)
328        return "manual";
329      if (code == UDIEntryType.CARD)
330        return "card";
331      if (code == UDIEntryType.SELFREPORTED)
332        return "self-reported";
333      if (code == UDIEntryType.ELECTRONICTRANSMISSION)
334        return "electronic-transmission";
335      if (code == UDIEntryType.UNKNOWN)
336        return "unknown";
337      return "?";
338      }
339    public String toSystem(UDIEntryType code) {
340      return code.getSystem();
341      }
342    }
343
344    @Block()
345    public static class DeviceUdiCarrierComponent extends BackboneElement implements IBaseBackboneElement {
346        /**
347         * 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.
348         */
349        @Child(name = "deviceIdentifier", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
350        @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." )
351        protected StringType deviceIdentifier;
352
353        /**
354         * Organization that is charged with issuing UDIs for devices. For example, the US FDA issuers include: 
3551) GS1: http://hl7.org/fhir/NamingSystem/gs1-di, 
3562) HIBCC: http://hl7.org/fhir/NamingSystem/hibcc-diI, 
3573) ICCBBA for blood containers: http://hl7.org/fhir/NamingSystem/iccbba-blood-di, 
3584) ICCBA for other devices: http://hl7.org/fhir/NamingSystem/iccbba-other-di # Informationsstelle für Arzneispezialitäten (IFA GmbH) (EU only): http://hl7.org/fhir/NamingSystem/ifa-gmbh-di.
359         */
360        @Child(name = "issuer", type = {UriType.class}, order=2, min=1, max=1, modifier=false, summary=true)
361        @Description(shortDefinition="UDI Issuing Organization", formalDefinition="Organization that is charged with issuing UDIs for devices. For example, the US FDA issuers include: \n1) GS1: http://hl7.org/fhir/NamingSystem/gs1-di, \n2) HIBCC: http://hl7.org/fhir/NamingSystem/hibcc-diI, \n3) ICCBBA for blood containers: http://hl7.org/fhir/NamingSystem/iccbba-blood-di, \n4) ICCBA for other devices: http://hl7.org/fhir/NamingSystem/iccbba-other-di # Informationsstelle für Arzneispezialitäten (IFA GmbH) (EU only): http://hl7.org/fhir/NamingSystem/ifa-gmbh-di." )
362        protected UriType issuer;
363
364        /**
365         * 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/us-fda-udi or in the European Union by the European Commission http://hl7.org/fhir/NamingSystem/eu-ec-udi.
366         */
367        @Child(name = "jurisdiction", type = {UriType.class}, order=3, min=0, max=1, modifier=false, summary=false)
368        @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/us-fda-udi or in the European Union by the European Commission http://hl7.org/fhir/NamingSystem/eu-ec-udi." )
369        protected UriType jurisdiction;
370
371        /**
372         * 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.
373         */
374        @Child(name = "carrierAIDC", type = {Base64BinaryType.class}, order=4, min=0, max=1, modifier=false, summary=true)
375        @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." )
376        protected Base64BinaryType carrierAIDC;
377
378        /**
379         * The full UDI carrier as the human readable form (HRF) representation of the barcode string as printed on the packaging of the device.
380         */
381        @Child(name = "carrierHRF", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
382        @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." )
383        protected StringType carrierHRF;
384
385        /**
386         * A coded entry to indicate how the data was entered.
387         */
388        @Child(name = "entryType", type = {CodeType.class}, order=6, min=0, max=1, modifier=false, summary=false)
389        @Description(shortDefinition="barcode | rfid | manual | card | self-reported | electronic-transmission | unknown", formalDefinition="A coded entry to indicate how the data was entered." )
390        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/udi-entry-type")
391        protected Enumeration<UDIEntryType> entryType;
392
393        private static final long serialVersionUID = -191630425L;
394
395    /**
396     * Constructor
397     */
398      public DeviceUdiCarrierComponent() {
399        super();
400      }
401
402    /**
403     * Constructor
404     */
405      public DeviceUdiCarrierComponent(String deviceIdentifier, String issuer) {
406        super();
407        this.setDeviceIdentifier(deviceIdentifier);
408        this.setIssuer(issuer);
409      }
410
411        /**
412         * @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
413         */
414        public StringType getDeviceIdentifierElement() { 
415          if (this.deviceIdentifier == null)
416            if (Configuration.errorOnAutoCreate())
417              throw new Error("Attempt to auto-create DeviceUdiCarrierComponent.deviceIdentifier");
418            else if (Configuration.doAutoCreate())
419              this.deviceIdentifier = new StringType(); // bb
420          return this.deviceIdentifier;
421        }
422
423        public boolean hasDeviceIdentifierElement() { 
424          return this.deviceIdentifier != null && !this.deviceIdentifier.isEmpty();
425        }
426
427        public boolean hasDeviceIdentifier() { 
428          return this.deviceIdentifier != null && !this.deviceIdentifier.isEmpty();
429        }
430
431        /**
432         * @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
433         */
434        public DeviceUdiCarrierComponent setDeviceIdentifierElement(StringType value) { 
435          this.deviceIdentifier = value;
436          return this;
437        }
438
439        /**
440         * @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.
441         */
442        public String getDeviceIdentifier() { 
443          return this.deviceIdentifier == null ? null : this.deviceIdentifier.getValue();
444        }
445
446        /**
447         * @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.
448         */
449        public DeviceUdiCarrierComponent setDeviceIdentifier(String value) { 
450            if (this.deviceIdentifier == null)
451              this.deviceIdentifier = new StringType();
452            this.deviceIdentifier.setValue(value);
453          return this;
454        }
455
456        /**
457         * @return {@link #issuer} (Organization that is charged with issuing UDIs for devices. For example, the US FDA issuers include: 
4581) GS1: http://hl7.org/fhir/NamingSystem/gs1-di, 
4592) HIBCC: http://hl7.org/fhir/NamingSystem/hibcc-diI, 
4603) ICCBBA for blood containers: http://hl7.org/fhir/NamingSystem/iccbba-blood-di, 
4614) ICCBA for other devices: http://hl7.org/fhir/NamingSystem/iccbba-other-di # Informationsstelle für Arzneispezialitäten (IFA GmbH) (EU only): http://hl7.org/fhir/NamingSystem/ifa-gmbh-di.). This is the underlying object with id, value and extensions. The accessor "getIssuer" gives direct access to the value
462         */
463        public UriType getIssuerElement() { 
464          if (this.issuer == null)
465            if (Configuration.errorOnAutoCreate())
466              throw new Error("Attempt to auto-create DeviceUdiCarrierComponent.issuer");
467            else if (Configuration.doAutoCreate())
468              this.issuer = new UriType(); // bb
469          return this.issuer;
470        }
471
472        public boolean hasIssuerElement() { 
473          return this.issuer != null && !this.issuer.isEmpty();
474        }
475
476        public boolean hasIssuer() { 
477          return this.issuer != null && !this.issuer.isEmpty();
478        }
479
480        /**
481         * @param value {@link #issuer} (Organization that is charged with issuing UDIs for devices. For example, the US FDA issuers include: 
4821) GS1: http://hl7.org/fhir/NamingSystem/gs1-di, 
4832) HIBCC: http://hl7.org/fhir/NamingSystem/hibcc-diI, 
4843) ICCBBA for blood containers: http://hl7.org/fhir/NamingSystem/iccbba-blood-di, 
4854) ICCBA for other devices: http://hl7.org/fhir/NamingSystem/iccbba-other-di # Informationsstelle für Arzneispezialitäten (IFA GmbH) (EU only): http://hl7.org/fhir/NamingSystem/ifa-gmbh-di.). This is the underlying object with id, value and extensions. The accessor "getIssuer" gives direct access to the value
486         */
487        public DeviceUdiCarrierComponent setIssuerElement(UriType value) { 
488          this.issuer = value;
489          return this;
490        }
491
492        /**
493         * @return Organization that is charged with issuing UDIs for devices. For example, the US FDA issuers include: 
4941) GS1: http://hl7.org/fhir/NamingSystem/gs1-di, 
4952) HIBCC: http://hl7.org/fhir/NamingSystem/hibcc-diI, 
4963) ICCBBA for blood containers: http://hl7.org/fhir/NamingSystem/iccbba-blood-di, 
4974) ICCBA for other devices: http://hl7.org/fhir/NamingSystem/iccbba-other-di # Informationsstelle für Arzneispezialitäten (IFA GmbH) (EU only): http://hl7.org/fhir/NamingSystem/ifa-gmbh-di.
498         */
499        public String getIssuer() { 
500          return this.issuer == null ? null : this.issuer.getValue();
501        }
502
503        /**
504         * @param value Organization that is charged with issuing UDIs for devices. For example, the US FDA issuers include: 
5051) GS1: http://hl7.org/fhir/NamingSystem/gs1-di, 
5062) HIBCC: http://hl7.org/fhir/NamingSystem/hibcc-diI, 
5073) ICCBBA for blood containers: http://hl7.org/fhir/NamingSystem/iccbba-blood-di, 
5084) ICCBA for other devices: http://hl7.org/fhir/NamingSystem/iccbba-other-di # Informationsstelle für Arzneispezialitäten (IFA GmbH) (EU only): http://hl7.org/fhir/NamingSystem/ifa-gmbh-di.
509         */
510        public DeviceUdiCarrierComponent setIssuer(String value) { 
511            if (this.issuer == null)
512              this.issuer = new UriType();
513            this.issuer.setValue(value);
514          return this;
515        }
516
517        /**
518         * @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/us-fda-udi or in the European Union by the European Commission http://hl7.org/fhir/NamingSystem/eu-ec-udi.). This is the underlying object with id, value and extensions. The accessor "getJurisdiction" gives direct access to the value
519         */
520        public UriType getJurisdictionElement() { 
521          if (this.jurisdiction == null)
522            if (Configuration.errorOnAutoCreate())
523              throw new Error("Attempt to auto-create DeviceUdiCarrierComponent.jurisdiction");
524            else if (Configuration.doAutoCreate())
525              this.jurisdiction = new UriType(); // bb
526          return this.jurisdiction;
527        }
528
529        public boolean hasJurisdictionElement() { 
530          return this.jurisdiction != null && !this.jurisdiction.isEmpty();
531        }
532
533        public boolean hasJurisdiction() { 
534          return this.jurisdiction != null && !this.jurisdiction.isEmpty();
535        }
536
537        /**
538         * @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/us-fda-udi or in the European Union by the European Commission http://hl7.org/fhir/NamingSystem/eu-ec-udi.). This is the underlying object with id, value and extensions. The accessor "getJurisdiction" gives direct access to the value
539         */
540        public DeviceUdiCarrierComponent setJurisdictionElement(UriType value) { 
541          this.jurisdiction = value;
542          return this;
543        }
544
545        /**
546         * @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/us-fda-udi or in the European Union by the European Commission http://hl7.org/fhir/NamingSystem/eu-ec-udi.
547         */
548        public String getJurisdiction() { 
549          return this.jurisdiction == null ? null : this.jurisdiction.getValue();
550        }
551
552        /**
553         * @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/us-fda-udi or in the European Union by the European Commission http://hl7.org/fhir/NamingSystem/eu-ec-udi.
554         */
555        public DeviceUdiCarrierComponent setJurisdiction(String value) { 
556          if (Utilities.noString(value))
557            this.jurisdiction = null;
558          else {
559            if (this.jurisdiction == null)
560              this.jurisdiction = new UriType();
561            this.jurisdiction.setValue(value);
562          }
563          return this;
564        }
565
566        /**
567         * @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
568         */
569        public Base64BinaryType getCarrierAIDCElement() { 
570          if (this.carrierAIDC == null)
571            if (Configuration.errorOnAutoCreate())
572              throw new Error("Attempt to auto-create DeviceUdiCarrierComponent.carrierAIDC");
573            else if (Configuration.doAutoCreate())
574              this.carrierAIDC = new Base64BinaryType(); // bb
575          return this.carrierAIDC;
576        }
577
578        public boolean hasCarrierAIDCElement() { 
579          return this.carrierAIDC != null && !this.carrierAIDC.isEmpty();
580        }
581
582        public boolean hasCarrierAIDC() { 
583          return this.carrierAIDC != null && !this.carrierAIDC.isEmpty();
584        }
585
586        /**
587         * @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
588         */
589        public DeviceUdiCarrierComponent setCarrierAIDCElement(Base64BinaryType value) { 
590          this.carrierAIDC = value;
591          return this;
592        }
593
594        /**
595         * @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.
596         */
597        public byte[] getCarrierAIDC() { 
598          return this.carrierAIDC == null ? null : this.carrierAIDC.getValue();
599        }
600
601        /**
602         * @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.
603         */
604        public DeviceUdiCarrierComponent setCarrierAIDC(byte[] value) { 
605          if (value == null)
606            this.carrierAIDC = null;
607          else {
608            if (this.carrierAIDC == null)
609              this.carrierAIDC = new Base64BinaryType();
610            this.carrierAIDC.setValue(value);
611          }
612          return this;
613        }
614
615        /**
616         * @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
617         */
618        public StringType getCarrierHRFElement() { 
619          if (this.carrierHRF == null)
620            if (Configuration.errorOnAutoCreate())
621              throw new Error("Attempt to auto-create DeviceUdiCarrierComponent.carrierHRF");
622            else if (Configuration.doAutoCreate())
623              this.carrierHRF = new StringType(); // bb
624          return this.carrierHRF;
625        }
626
627        public boolean hasCarrierHRFElement() { 
628          return this.carrierHRF != null && !this.carrierHRF.isEmpty();
629        }
630
631        public boolean hasCarrierHRF() { 
632          return this.carrierHRF != null && !this.carrierHRF.isEmpty();
633        }
634
635        /**
636         * @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
637         */
638        public DeviceUdiCarrierComponent setCarrierHRFElement(StringType value) { 
639          this.carrierHRF = value;
640          return this;
641        }
642
643        /**
644         * @return The full UDI carrier as the human readable form (HRF) representation of the barcode string as printed on the packaging of the device.
645         */
646        public String getCarrierHRF() { 
647          return this.carrierHRF == null ? null : this.carrierHRF.getValue();
648        }
649
650        /**
651         * @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.
652         */
653        public DeviceUdiCarrierComponent setCarrierHRF(String value) { 
654          if (Utilities.noString(value))
655            this.carrierHRF = null;
656          else {
657            if (this.carrierHRF == null)
658              this.carrierHRF = new StringType();
659            this.carrierHRF.setValue(value);
660          }
661          return this;
662        }
663
664        /**
665         * @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
666         */
667        public Enumeration<UDIEntryType> getEntryTypeElement() { 
668          if (this.entryType == null)
669            if (Configuration.errorOnAutoCreate())
670              throw new Error("Attempt to auto-create DeviceUdiCarrierComponent.entryType");
671            else if (Configuration.doAutoCreate())
672              this.entryType = new Enumeration<UDIEntryType>(new UDIEntryTypeEnumFactory()); // bb
673          return this.entryType;
674        }
675
676        public boolean hasEntryTypeElement() { 
677          return this.entryType != null && !this.entryType.isEmpty();
678        }
679
680        public boolean hasEntryType() { 
681          return this.entryType != null && !this.entryType.isEmpty();
682        }
683
684        /**
685         * @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
686         */
687        public DeviceUdiCarrierComponent setEntryTypeElement(Enumeration<UDIEntryType> value) { 
688          this.entryType = value;
689          return this;
690        }
691
692        /**
693         * @return A coded entry to indicate how the data was entered.
694         */
695        public UDIEntryType getEntryType() { 
696          return this.entryType == null ? null : this.entryType.getValue();
697        }
698
699        /**
700         * @param value A coded entry to indicate how the data was entered.
701         */
702        public DeviceUdiCarrierComponent setEntryType(UDIEntryType value) { 
703          if (value == null)
704            this.entryType = null;
705          else {
706            if (this.entryType == null)
707              this.entryType = new Enumeration<UDIEntryType>(new UDIEntryTypeEnumFactory());
708            this.entryType.setValue(value);
709          }
710          return this;
711        }
712
713        protected void listChildren(List<Property> children) {
714          super.listChildren(children);
715          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));
716          children.add(new Property("issuer", "uri", "Organization that is charged with issuing UDIs for devices. For example, the US FDA issuers include: \n1) GS1: http://hl7.org/fhir/NamingSystem/gs1-di, \n2) HIBCC: http://hl7.org/fhir/NamingSystem/hibcc-diI, \n3) ICCBBA for blood containers: http://hl7.org/fhir/NamingSystem/iccbba-blood-di, \n4) ICCBA for other devices: http://hl7.org/fhir/NamingSystem/iccbba-other-di # Informationsstelle für Arzneispezialitäten (IFA GmbH) (EU only): http://hl7.org/fhir/NamingSystem/ifa-gmbh-di.", 0, 1, issuer));
717          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/us-fda-udi or in the European Union by the European Commission http://hl7.org/fhir/NamingSystem/eu-ec-udi.", 0, 1, jurisdiction));
718          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));
719          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));
720          children.add(new Property("entryType", "code", "A coded entry to indicate how the data was entered.", 0, 1, entryType));
721        }
722
723        @Override
724        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
725          switch (_hash) {
726          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);
727          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: http://hl7.org/fhir/NamingSystem/gs1-di, \n2) HIBCC: http://hl7.org/fhir/NamingSystem/hibcc-diI, \n3) ICCBBA for blood containers: http://hl7.org/fhir/NamingSystem/iccbba-blood-di, \n4) ICCBA for other devices: http://hl7.org/fhir/NamingSystem/iccbba-other-di # Informationsstelle für Arzneispezialitäten (IFA GmbH) (EU only): http://hl7.org/fhir/NamingSystem/ifa-gmbh-di.", 0, 1, issuer);
728          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/us-fda-udi or in the European Union by the European Commission http://hl7.org/fhir/NamingSystem/eu-ec-udi.", 0, 1, jurisdiction);
729          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);
730          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);
731          case -479362356: /*entryType*/  return new Property("entryType", "code", "A coded entry to indicate how the data was entered.", 0, 1, entryType);
732          default: return super.getNamedProperty(_hash, _name, _checkValid);
733          }
734
735        }
736
737      @Override
738      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
739        switch (hash) {
740        case 1322005407: /*deviceIdentifier*/ return this.deviceIdentifier == null ? new Base[0] : new Base[] {this.deviceIdentifier}; // StringType
741        case -1179159879: /*issuer*/ return this.issuer == null ? new Base[0] : new Base[] {this.issuer}; // UriType
742        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : new Base[] {this.jurisdiction}; // UriType
743        case -768521825: /*carrierAIDC*/ return this.carrierAIDC == null ? new Base[0] : new Base[] {this.carrierAIDC}; // Base64BinaryType
744        case 806499972: /*carrierHRF*/ return this.carrierHRF == null ? new Base[0] : new Base[] {this.carrierHRF}; // StringType
745        case -479362356: /*entryType*/ return this.entryType == null ? new Base[0] : new Base[] {this.entryType}; // Enumeration<UDIEntryType>
746        default: return super.getProperty(hash, name, checkValid);
747        }
748
749      }
750
751      @Override
752      public Base setProperty(int hash, String name, Base value) throws FHIRException {
753        switch (hash) {
754        case 1322005407: // deviceIdentifier
755          this.deviceIdentifier = TypeConvertor.castToString(value); // StringType
756          return value;
757        case -1179159879: // issuer
758          this.issuer = TypeConvertor.castToUri(value); // UriType
759          return value;
760        case -507075711: // jurisdiction
761          this.jurisdiction = TypeConvertor.castToUri(value); // UriType
762          return value;
763        case -768521825: // carrierAIDC
764          this.carrierAIDC = TypeConvertor.castToBase64Binary(value); // Base64BinaryType
765          return value;
766        case 806499972: // carrierHRF
767          this.carrierHRF = TypeConvertor.castToString(value); // StringType
768          return value;
769        case -479362356: // entryType
770          value = new UDIEntryTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
771          this.entryType = (Enumeration) value; // Enumeration<UDIEntryType>
772          return value;
773        default: return super.setProperty(hash, name, value);
774        }
775
776      }
777
778      @Override
779      public Base setProperty(String name, Base value) throws FHIRException {
780        if (name.equals("deviceIdentifier")) {
781          this.deviceIdentifier = TypeConvertor.castToString(value); // StringType
782        } else if (name.equals("issuer")) {
783          this.issuer = TypeConvertor.castToUri(value); // UriType
784        } else if (name.equals("jurisdiction")) {
785          this.jurisdiction = TypeConvertor.castToUri(value); // UriType
786        } else if (name.equals("carrierAIDC")) {
787          this.carrierAIDC = TypeConvertor.castToBase64Binary(value); // Base64BinaryType
788        } else if (name.equals("carrierHRF")) {
789          this.carrierHRF = TypeConvertor.castToString(value); // StringType
790        } else if (name.equals("entryType")) {
791          value = new UDIEntryTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
792          this.entryType = (Enumeration) value; // Enumeration<UDIEntryType>
793        } else
794          return super.setProperty(name, value);
795        return value;
796      }
797
798      @Override
799      public Base makeProperty(int hash, String name) throws FHIRException {
800        switch (hash) {
801        case 1322005407:  return getDeviceIdentifierElement();
802        case -1179159879:  return getIssuerElement();
803        case -507075711:  return getJurisdictionElement();
804        case -768521825:  return getCarrierAIDCElement();
805        case 806499972:  return getCarrierHRFElement();
806        case -479362356:  return getEntryTypeElement();
807        default: return super.makeProperty(hash, name);
808        }
809
810      }
811
812      @Override
813      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
814        switch (hash) {
815        case 1322005407: /*deviceIdentifier*/ return new String[] {"string"};
816        case -1179159879: /*issuer*/ return new String[] {"uri"};
817        case -507075711: /*jurisdiction*/ return new String[] {"uri"};
818        case -768521825: /*carrierAIDC*/ return new String[] {"base64Binary"};
819        case 806499972: /*carrierHRF*/ return new String[] {"string"};
820        case -479362356: /*entryType*/ return new String[] {"code"};
821        default: return super.getTypesForProperty(hash, name);
822        }
823
824      }
825
826      @Override
827      public Base addChild(String name) throws FHIRException {
828        if (name.equals("deviceIdentifier")) {
829          throw new FHIRException("Cannot call addChild on a primitive type Device.udiCarrier.deviceIdentifier");
830        }
831        else if (name.equals("issuer")) {
832          throw new FHIRException("Cannot call addChild on a primitive type Device.udiCarrier.issuer");
833        }
834        else if (name.equals("jurisdiction")) {
835          throw new FHIRException("Cannot call addChild on a primitive type Device.udiCarrier.jurisdiction");
836        }
837        else if (name.equals("carrierAIDC")) {
838          throw new FHIRException("Cannot call addChild on a primitive type Device.udiCarrier.carrierAIDC");
839        }
840        else if (name.equals("carrierHRF")) {
841          throw new FHIRException("Cannot call addChild on a primitive type Device.udiCarrier.carrierHRF");
842        }
843        else if (name.equals("entryType")) {
844          throw new FHIRException("Cannot call addChild on a primitive type Device.udiCarrier.entryType");
845        }
846        else
847          return super.addChild(name);
848      }
849
850      public DeviceUdiCarrierComponent copy() {
851        DeviceUdiCarrierComponent dst = new DeviceUdiCarrierComponent();
852        copyValues(dst);
853        return dst;
854      }
855
856      public void copyValues(DeviceUdiCarrierComponent dst) {
857        super.copyValues(dst);
858        dst.deviceIdentifier = deviceIdentifier == null ? null : deviceIdentifier.copy();
859        dst.issuer = issuer == null ? null : issuer.copy();
860        dst.jurisdiction = jurisdiction == null ? null : jurisdiction.copy();
861        dst.carrierAIDC = carrierAIDC == null ? null : carrierAIDC.copy();
862        dst.carrierHRF = carrierHRF == null ? null : carrierHRF.copy();
863        dst.entryType = entryType == null ? null : entryType.copy();
864      }
865
866      @Override
867      public boolean equalsDeep(Base other_) {
868        if (!super.equalsDeep(other_))
869          return false;
870        if (!(other_ instanceof DeviceUdiCarrierComponent))
871          return false;
872        DeviceUdiCarrierComponent o = (DeviceUdiCarrierComponent) other_;
873        return compareDeep(deviceIdentifier, o.deviceIdentifier, true) && compareDeep(issuer, o.issuer, true)
874           && compareDeep(jurisdiction, o.jurisdiction, true) && compareDeep(carrierAIDC, o.carrierAIDC, true)
875           && compareDeep(carrierHRF, o.carrierHRF, true) && compareDeep(entryType, o.entryType, true);
876      }
877
878      @Override
879      public boolean equalsShallow(Base other_) {
880        if (!super.equalsShallow(other_))
881          return false;
882        if (!(other_ instanceof DeviceUdiCarrierComponent))
883          return false;
884        DeviceUdiCarrierComponent o = (DeviceUdiCarrierComponent) other_;
885        return compareValues(deviceIdentifier, o.deviceIdentifier, true) && compareValues(issuer, o.issuer, true)
886           && compareValues(jurisdiction, o.jurisdiction, true) && compareValues(carrierAIDC, o.carrierAIDC, true)
887           && compareValues(carrierHRF, o.carrierHRF, true) && compareValues(entryType, o.entryType, true);
888      }
889
890      public boolean isEmpty() {
891        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(deviceIdentifier, issuer, jurisdiction
892          , carrierAIDC, carrierHRF, entryType);
893      }
894
895  public String fhirType() {
896    return "Device.udiCarrier";
897
898  }
899
900  }
901
902    @Block()
903    public static class DeviceDeviceNameComponent extends BackboneElement implements IBaseBackboneElement {
904        /**
905         * The name that identifies the device.
906         */
907        @Child(name = "name", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
908        @Description(shortDefinition="The name that identifies the device", formalDefinition="The name that identifies the device." )
909        protected StringType name;
910
911        /**
912         * The type of deviceName. Note that ManufactureDeviceName means that the name is the name as given by the manufacturer, not the name of the manufacturer.
913RegisteredName | UserFriendlyName | PatientReportedName.
914         */
915        @Child(name = "type", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=false)
916        @Description(shortDefinition="registered-name | user-friendly-name | patient-reported-name", formalDefinition="The type of deviceName. Note that ManufactureDeviceName means that the name is the name as given by the manufacturer, not the name of the manufacturer.\nRegisteredName | UserFriendlyName | PatientReportedName." )
917        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-nametype")
918        protected Enumeration<DeviceNameType> type;
919
920        private static final long serialVersionUID = 918983440L;
921
922    /**
923     * Constructor
924     */
925      public DeviceDeviceNameComponent() {
926        super();
927      }
928
929    /**
930     * Constructor
931     */
932      public DeviceDeviceNameComponent(String name, DeviceNameType type) {
933        super();
934        this.setName(name);
935        this.setType(type);
936      }
937
938        /**
939         * @return {@link #name} (The name that identifies the device.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
940         */
941        public StringType getNameElement() { 
942          if (this.name == null)
943            if (Configuration.errorOnAutoCreate())
944              throw new Error("Attempt to auto-create DeviceDeviceNameComponent.name");
945            else if (Configuration.doAutoCreate())
946              this.name = new StringType(); // bb
947          return this.name;
948        }
949
950        public boolean hasNameElement() { 
951          return this.name != null && !this.name.isEmpty();
952        }
953
954        public boolean hasName() { 
955          return this.name != null && !this.name.isEmpty();
956        }
957
958        /**
959         * @param value {@link #name} (The name that identifies the device.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
960         */
961        public DeviceDeviceNameComponent setNameElement(StringType value) { 
962          this.name = value;
963          return this;
964        }
965
966        /**
967         * @return The name that identifies the device.
968         */
969        public String getName() { 
970          return this.name == null ? null : this.name.getValue();
971        }
972
973        /**
974         * @param value The name that identifies the device.
975         */
976        public DeviceDeviceNameComponent setName(String value) { 
977            if (this.name == null)
978              this.name = new StringType();
979            this.name.setValue(value);
980          return this;
981        }
982
983        /**
984         * @return {@link #type} (The type of deviceName. Note that ManufactureDeviceName means that the name is the name as given by the manufacturer, not the name of the manufacturer.
985RegisteredName | UserFriendlyName | PatientReportedName.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
986         */
987        public Enumeration<DeviceNameType> getTypeElement() { 
988          if (this.type == null)
989            if (Configuration.errorOnAutoCreate())
990              throw new Error("Attempt to auto-create DeviceDeviceNameComponent.type");
991            else if (Configuration.doAutoCreate())
992              this.type = new Enumeration<DeviceNameType>(new DeviceNameTypeEnumFactory()); // bb
993          return this.type;
994        }
995
996        public boolean hasTypeElement() { 
997          return this.type != null && !this.type.isEmpty();
998        }
999
1000        public boolean hasType() { 
1001          return this.type != null && !this.type.isEmpty();
1002        }
1003
1004        /**
1005         * @param value {@link #type} (The type of deviceName. Note that ManufactureDeviceName means that the name is the name as given by the manufacturer, not the name of the manufacturer.
1006RegisteredName | UserFriendlyName | PatientReportedName.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1007         */
1008        public DeviceDeviceNameComponent setTypeElement(Enumeration<DeviceNameType> value) { 
1009          this.type = value;
1010          return this;
1011        }
1012
1013        /**
1014         * @return The type of deviceName. Note that ManufactureDeviceName means that the name is the name as given by the manufacturer, not the name of the manufacturer.
1015RegisteredName | UserFriendlyName | PatientReportedName.
1016         */
1017        public DeviceNameType getType() { 
1018          return this.type == null ? null : this.type.getValue();
1019        }
1020
1021        /**
1022         * @param value The type of deviceName. Note that ManufactureDeviceName means that the name is the name as given by the manufacturer, not the name of the manufacturer.
1023RegisteredName | UserFriendlyName | PatientReportedName.
1024         */
1025        public DeviceDeviceNameComponent setType(DeviceNameType value) { 
1026            if (this.type == null)
1027              this.type = new Enumeration<DeviceNameType>(new DeviceNameTypeEnumFactory());
1028            this.type.setValue(value);
1029          return this;
1030        }
1031
1032        protected void listChildren(List<Property> children) {
1033          super.listChildren(children);
1034          children.add(new Property("name", "string", "The name that identifies the device.", 0, 1, name));
1035          children.add(new Property("type", "code", "The type of deviceName. Note that ManufactureDeviceName means that the name is the name as given by the manufacturer, not the name of the manufacturer.\nRegisteredName | UserFriendlyName | PatientReportedName.", 0, 1, type));
1036        }
1037
1038        @Override
1039        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1040          switch (_hash) {
1041          case 3373707: /*name*/  return new Property("name", "string", "The name that identifies the device.", 0, 1, name);
1042          case 3575610: /*type*/  return new Property("type", "code", "The type of deviceName. Note that ManufactureDeviceName means that the name is the name as given by the manufacturer, not the name of the manufacturer.\nRegisteredName | UserFriendlyName | PatientReportedName.", 0, 1, type);
1043          default: return super.getNamedProperty(_hash, _name, _checkValid);
1044          }
1045
1046        }
1047
1048      @Override
1049      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1050        switch (hash) {
1051        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
1052        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<DeviceNameType>
1053        default: return super.getProperty(hash, name, checkValid);
1054        }
1055
1056      }
1057
1058      @Override
1059      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1060        switch (hash) {
1061        case 3373707: // name
1062          this.name = TypeConvertor.castToString(value); // StringType
1063          return value;
1064        case 3575610: // type
1065          value = new DeviceNameTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1066          this.type = (Enumeration) value; // Enumeration<DeviceNameType>
1067          return value;
1068        default: return super.setProperty(hash, name, value);
1069        }
1070
1071      }
1072
1073      @Override
1074      public Base setProperty(String name, Base value) throws FHIRException {
1075        if (name.equals("name")) {
1076          this.name = TypeConvertor.castToString(value); // StringType
1077        } else if (name.equals("type")) {
1078          value = new DeviceNameTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1079          this.type = (Enumeration) value; // Enumeration<DeviceNameType>
1080        } else
1081          return super.setProperty(name, value);
1082        return value;
1083      }
1084
1085      @Override
1086      public Base makeProperty(int hash, String name) throws FHIRException {
1087        switch (hash) {
1088        case 3373707:  return getNameElement();
1089        case 3575610:  return getTypeElement();
1090        default: return super.makeProperty(hash, name);
1091        }
1092
1093      }
1094
1095      @Override
1096      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1097        switch (hash) {
1098        case 3373707: /*name*/ return new String[] {"string"};
1099        case 3575610: /*type*/ return new String[] {"code"};
1100        default: return super.getTypesForProperty(hash, name);
1101        }
1102
1103      }
1104
1105      @Override
1106      public Base addChild(String name) throws FHIRException {
1107        if (name.equals("name")) {
1108          throw new FHIRException("Cannot call addChild on a primitive type Device.deviceName.name");
1109        }
1110        else if (name.equals("type")) {
1111          throw new FHIRException("Cannot call addChild on a primitive type Device.deviceName.type");
1112        }
1113        else
1114          return super.addChild(name);
1115      }
1116
1117      public DeviceDeviceNameComponent copy() {
1118        DeviceDeviceNameComponent dst = new DeviceDeviceNameComponent();
1119        copyValues(dst);
1120        return dst;
1121      }
1122
1123      public void copyValues(DeviceDeviceNameComponent dst) {
1124        super.copyValues(dst);
1125        dst.name = name == null ? null : name.copy();
1126        dst.type = type == null ? null : type.copy();
1127      }
1128
1129      @Override
1130      public boolean equalsDeep(Base other_) {
1131        if (!super.equalsDeep(other_))
1132          return false;
1133        if (!(other_ instanceof DeviceDeviceNameComponent))
1134          return false;
1135        DeviceDeviceNameComponent o = (DeviceDeviceNameComponent) other_;
1136        return compareDeep(name, o.name, true) && compareDeep(type, o.type, true);
1137      }
1138
1139      @Override
1140      public boolean equalsShallow(Base other_) {
1141        if (!super.equalsShallow(other_))
1142          return false;
1143        if (!(other_ instanceof DeviceDeviceNameComponent))
1144          return false;
1145        DeviceDeviceNameComponent o = (DeviceDeviceNameComponent) other_;
1146        return compareValues(name, o.name, true) && compareValues(type, o.type, true);
1147      }
1148
1149      public boolean isEmpty() {
1150        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, type);
1151      }
1152
1153  public String fhirType() {
1154    return "Device.deviceName";
1155
1156  }
1157
1158  }
1159
1160    @Block()
1161    public static class DeviceVersionComponent extends BackboneElement implements IBaseBackboneElement {
1162        /**
1163         * The type of the device version, e.g. manufacturer, approved, internal.
1164         */
1165        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
1166        @Description(shortDefinition="The type of the device version, e.g. manufacturer, approved, internal", formalDefinition="The type of the device version, e.g. manufacturer, approved, internal." )
1167        protected CodeableConcept type;
1168
1169        /**
1170         * The hardware or software module of the device to which the version applies.
1171         */
1172        @Child(name = "component", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=false)
1173        @Description(shortDefinition="The hardware or software module of the device to which the version applies", formalDefinition="The hardware or software module of the device to which the version applies." )
1174        protected Identifier component;
1175
1176        /**
1177         * The date the version was installed on the device.
1178         */
1179        @Child(name = "installDate", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
1180        @Description(shortDefinition="The date the version was installed on the device", formalDefinition="The date the version was installed on the device." )
1181        protected DateTimeType installDate;
1182
1183        /**
1184         * The version text.
1185         */
1186        @Child(name = "value", type = {StringType.class}, order=4, min=1, max=1, modifier=false, summary=false)
1187        @Description(shortDefinition="The version text", formalDefinition="The version text." )
1188        protected StringType value;
1189
1190        private static final long serialVersionUID = 1358422741L;
1191
1192    /**
1193     * Constructor
1194     */
1195      public DeviceVersionComponent() {
1196        super();
1197      }
1198
1199    /**
1200     * Constructor
1201     */
1202      public DeviceVersionComponent(String value) {
1203        super();
1204        this.setValue(value);
1205      }
1206
1207        /**
1208         * @return {@link #type} (The type of the device version, e.g. manufacturer, approved, internal.)
1209         */
1210        public CodeableConcept getType() { 
1211          if (this.type == null)
1212            if (Configuration.errorOnAutoCreate())
1213              throw new Error("Attempt to auto-create DeviceVersionComponent.type");
1214            else if (Configuration.doAutoCreate())
1215              this.type = new CodeableConcept(); // cc
1216          return this.type;
1217        }
1218
1219        public boolean hasType() { 
1220          return this.type != null && !this.type.isEmpty();
1221        }
1222
1223        /**
1224         * @param value {@link #type} (The type of the device version, e.g. manufacturer, approved, internal.)
1225         */
1226        public DeviceVersionComponent setType(CodeableConcept value) { 
1227          this.type = value;
1228          return this;
1229        }
1230
1231        /**
1232         * @return {@link #component} (The hardware or software module of the device to which the version applies.)
1233         */
1234        public Identifier getComponent() { 
1235          if (this.component == null)
1236            if (Configuration.errorOnAutoCreate())
1237              throw new Error("Attempt to auto-create DeviceVersionComponent.component");
1238            else if (Configuration.doAutoCreate())
1239              this.component = new Identifier(); // cc
1240          return this.component;
1241        }
1242
1243        public boolean hasComponent() { 
1244          return this.component != null && !this.component.isEmpty();
1245        }
1246
1247        /**
1248         * @param value {@link #component} (The hardware or software module of the device to which the version applies.)
1249         */
1250        public DeviceVersionComponent setComponent(Identifier value) { 
1251          this.component = value;
1252          return this;
1253        }
1254
1255        /**
1256         * @return {@link #installDate} (The date the version was installed on the device.). This is the underlying object with id, value and extensions. The accessor "getInstallDate" gives direct access to the value
1257         */
1258        public DateTimeType getInstallDateElement() { 
1259          if (this.installDate == null)
1260            if (Configuration.errorOnAutoCreate())
1261              throw new Error("Attempt to auto-create DeviceVersionComponent.installDate");
1262            else if (Configuration.doAutoCreate())
1263              this.installDate = new DateTimeType(); // bb
1264          return this.installDate;
1265        }
1266
1267        public boolean hasInstallDateElement() { 
1268          return this.installDate != null && !this.installDate.isEmpty();
1269        }
1270
1271        public boolean hasInstallDate() { 
1272          return this.installDate != null && !this.installDate.isEmpty();
1273        }
1274
1275        /**
1276         * @param value {@link #installDate} (The date the version was installed on the device.). This is the underlying object with id, value and extensions. The accessor "getInstallDate" gives direct access to the value
1277         */
1278        public DeviceVersionComponent setInstallDateElement(DateTimeType value) { 
1279          this.installDate = value;
1280          return this;
1281        }
1282
1283        /**
1284         * @return The date the version was installed on the device.
1285         */
1286        public Date getInstallDate() { 
1287          return this.installDate == null ? null : this.installDate.getValue();
1288        }
1289
1290        /**
1291         * @param value The date the version was installed on the device.
1292         */
1293        public DeviceVersionComponent setInstallDate(Date value) { 
1294          if (value == null)
1295            this.installDate = null;
1296          else {
1297            if (this.installDate == null)
1298              this.installDate = new DateTimeType();
1299            this.installDate.setValue(value);
1300          }
1301          return this;
1302        }
1303
1304        /**
1305         * @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
1306         */
1307        public StringType getValueElement() { 
1308          if (this.value == null)
1309            if (Configuration.errorOnAutoCreate())
1310              throw new Error("Attempt to auto-create DeviceVersionComponent.value");
1311            else if (Configuration.doAutoCreate())
1312              this.value = new StringType(); // bb
1313          return this.value;
1314        }
1315
1316        public boolean hasValueElement() { 
1317          return this.value != null && !this.value.isEmpty();
1318        }
1319
1320        public boolean hasValue() { 
1321          return this.value != null && !this.value.isEmpty();
1322        }
1323
1324        /**
1325         * @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
1326         */
1327        public DeviceVersionComponent setValueElement(StringType value) { 
1328          this.value = value;
1329          return this;
1330        }
1331
1332        /**
1333         * @return The version text.
1334         */
1335        public String getValue() { 
1336          return this.value == null ? null : this.value.getValue();
1337        }
1338
1339        /**
1340         * @param value The version text.
1341         */
1342        public DeviceVersionComponent setValue(String value) { 
1343            if (this.value == null)
1344              this.value = new StringType();
1345            this.value.setValue(value);
1346          return this;
1347        }
1348
1349        protected void listChildren(List<Property> children) {
1350          super.listChildren(children);
1351          children.add(new Property("type", "CodeableConcept", "The type of the device version, e.g. manufacturer, approved, internal.", 0, 1, type));
1352          children.add(new Property("component", "Identifier", "The hardware or software module of the device to which the version applies.", 0, 1, component));
1353          children.add(new Property("installDate", "dateTime", "The date the version was installed on the device.", 0, 1, installDate));
1354          children.add(new Property("value", "string", "The version text.", 0, 1, value));
1355        }
1356
1357        @Override
1358        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1359          switch (_hash) {
1360          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of the device version, e.g. manufacturer, approved, internal.", 0, 1, type);
1361          case -1399907075: /*component*/  return new Property("component", "Identifier", "The hardware or software module of the device to which the version applies.", 0, 1, component);
1362          case 2143044585: /*installDate*/  return new Property("installDate", "dateTime", "The date the version was installed on the device.", 0, 1, installDate);
1363          case 111972721: /*value*/  return new Property("value", "string", "The version text.", 0, 1, value);
1364          default: return super.getNamedProperty(_hash, _name, _checkValid);
1365          }
1366
1367        }
1368
1369      @Override
1370      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1371        switch (hash) {
1372        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1373        case -1399907075: /*component*/ return this.component == null ? new Base[0] : new Base[] {this.component}; // Identifier
1374        case 2143044585: /*installDate*/ return this.installDate == null ? new Base[0] : new Base[] {this.installDate}; // DateTimeType
1375        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType
1376        default: return super.getProperty(hash, name, checkValid);
1377        }
1378
1379      }
1380
1381      @Override
1382      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1383        switch (hash) {
1384        case 3575610: // type
1385          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1386          return value;
1387        case -1399907075: // component
1388          this.component = TypeConvertor.castToIdentifier(value); // Identifier
1389          return value;
1390        case 2143044585: // installDate
1391          this.installDate = TypeConvertor.castToDateTime(value); // DateTimeType
1392          return value;
1393        case 111972721: // value
1394          this.value = TypeConvertor.castToString(value); // StringType
1395          return value;
1396        default: return super.setProperty(hash, name, value);
1397        }
1398
1399      }
1400
1401      @Override
1402      public Base setProperty(String name, Base value) throws FHIRException {
1403        if (name.equals("type")) {
1404          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1405        } else if (name.equals("component")) {
1406          this.component = TypeConvertor.castToIdentifier(value); // Identifier
1407        } else if (name.equals("installDate")) {
1408          this.installDate = TypeConvertor.castToDateTime(value); // DateTimeType
1409        } else if (name.equals("value")) {
1410          this.value = TypeConvertor.castToString(value); // StringType
1411        } else
1412          return super.setProperty(name, value);
1413        return value;
1414      }
1415
1416      @Override
1417      public Base makeProperty(int hash, String name) throws FHIRException {
1418        switch (hash) {
1419        case 3575610:  return getType();
1420        case -1399907075:  return getComponent();
1421        case 2143044585:  return getInstallDateElement();
1422        case 111972721:  return getValueElement();
1423        default: return super.makeProperty(hash, name);
1424        }
1425
1426      }
1427
1428      @Override
1429      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1430        switch (hash) {
1431        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1432        case -1399907075: /*component*/ return new String[] {"Identifier"};
1433        case 2143044585: /*installDate*/ return new String[] {"dateTime"};
1434        case 111972721: /*value*/ return new String[] {"string"};
1435        default: return super.getTypesForProperty(hash, name);
1436        }
1437
1438      }
1439
1440      @Override
1441      public Base addChild(String name) throws FHIRException {
1442        if (name.equals("type")) {
1443          this.type = new CodeableConcept();
1444          return this.type;
1445        }
1446        else if (name.equals("component")) {
1447          this.component = new Identifier();
1448          return this.component;
1449        }
1450        else if (name.equals("installDate")) {
1451          throw new FHIRException("Cannot call addChild on a primitive type Device.version.installDate");
1452        }
1453        else if (name.equals("value")) {
1454          throw new FHIRException("Cannot call addChild on a primitive type Device.version.value");
1455        }
1456        else
1457          return super.addChild(name);
1458      }
1459
1460      public DeviceVersionComponent copy() {
1461        DeviceVersionComponent dst = new DeviceVersionComponent();
1462        copyValues(dst);
1463        return dst;
1464      }
1465
1466      public void copyValues(DeviceVersionComponent dst) {
1467        super.copyValues(dst);
1468        dst.type = type == null ? null : type.copy();
1469        dst.component = component == null ? null : component.copy();
1470        dst.installDate = installDate == null ? null : installDate.copy();
1471        dst.value = value == null ? null : value.copy();
1472      }
1473
1474      @Override
1475      public boolean equalsDeep(Base other_) {
1476        if (!super.equalsDeep(other_))
1477          return false;
1478        if (!(other_ instanceof DeviceVersionComponent))
1479          return false;
1480        DeviceVersionComponent o = (DeviceVersionComponent) other_;
1481        return compareDeep(type, o.type, true) && compareDeep(component, o.component, true) && compareDeep(installDate, o.installDate, true)
1482           && compareDeep(value, o.value, true);
1483      }
1484
1485      @Override
1486      public boolean equalsShallow(Base other_) {
1487        if (!super.equalsShallow(other_))
1488          return false;
1489        if (!(other_ instanceof DeviceVersionComponent))
1490          return false;
1491        DeviceVersionComponent o = (DeviceVersionComponent) other_;
1492        return compareValues(installDate, o.installDate, true) && compareValues(value, o.value, true);
1493      }
1494
1495      public boolean isEmpty() {
1496        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, component, installDate
1497          , value);
1498      }
1499
1500  public String fhirType() {
1501    return "Device.version";
1502
1503  }
1504
1505  }
1506
1507    @Block()
1508    public static class DeviceSpecializationComponent extends BackboneElement implements IBaseBackboneElement {
1509        /**
1510         * Code that specifies the property being represented. No codes are specified but the MDC codes are an example: https://build.fhir.org/mdc.html.
1511         */
1512        @Child(name = "systemType", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
1513        @Description(shortDefinition="Code that specifies the property being represented", formalDefinition="Code that specifies the property being represented. No codes are specified but the MDC codes are an example: https://build.fhir.org/mdc.html." )
1514        protected CodeableConcept systemType;
1515
1516        /**
1517         * The version of the standard that is used to operate and communicate.
1518         */
1519        @Child(name = "version", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1520        @Description(shortDefinition="Standard version used", formalDefinition="The version of the standard that is used to operate and communicate." )
1521        protected StringType version;
1522
1523        /**
1524         * Kind of standards that the device adheres to, e.g., communication, performance or communication.
1525         */
1526        @Child(name = "category", type = {Coding.class}, order=3, min=0, max=1, modifier=false, summary=false)
1527        @Description(shortDefinition="communication | performance | measurement", formalDefinition="Kind of standards that the device adheres to, e.g., communication, performance or communication." )
1528        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-specialization-category")
1529        protected Coding category;
1530
1531        private static final long serialVersionUID = 1771791003L;
1532
1533    /**
1534     * Constructor
1535     */
1536      public DeviceSpecializationComponent() {
1537        super();
1538      }
1539
1540    /**
1541     * Constructor
1542     */
1543      public DeviceSpecializationComponent(CodeableConcept systemType) {
1544        super();
1545        this.setSystemType(systemType);
1546      }
1547
1548        /**
1549         * @return {@link #systemType} (Code that specifies the property being represented. No codes are specified but the MDC codes are an example: https://build.fhir.org/mdc.html.)
1550         */
1551        public CodeableConcept getSystemType() { 
1552          if (this.systemType == null)
1553            if (Configuration.errorOnAutoCreate())
1554              throw new Error("Attempt to auto-create DeviceSpecializationComponent.systemType");
1555            else if (Configuration.doAutoCreate())
1556              this.systemType = new CodeableConcept(); // cc
1557          return this.systemType;
1558        }
1559
1560        public boolean hasSystemType() { 
1561          return this.systemType != null && !this.systemType.isEmpty();
1562        }
1563
1564        /**
1565         * @param value {@link #systemType} (Code that specifies the property being represented. No codes are specified but the MDC codes are an example: https://build.fhir.org/mdc.html.)
1566         */
1567        public DeviceSpecializationComponent setSystemType(CodeableConcept value) { 
1568          this.systemType = value;
1569          return this;
1570        }
1571
1572        /**
1573         * @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
1574         */
1575        public StringType getVersionElement() { 
1576          if (this.version == null)
1577            if (Configuration.errorOnAutoCreate())
1578              throw new Error("Attempt to auto-create DeviceSpecializationComponent.version");
1579            else if (Configuration.doAutoCreate())
1580              this.version = new StringType(); // bb
1581          return this.version;
1582        }
1583
1584        public boolean hasVersionElement() { 
1585          return this.version != null && !this.version.isEmpty();
1586        }
1587
1588        public boolean hasVersion() { 
1589          return this.version != null && !this.version.isEmpty();
1590        }
1591
1592        /**
1593         * @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
1594         */
1595        public DeviceSpecializationComponent setVersionElement(StringType value) { 
1596          this.version = value;
1597          return this;
1598        }
1599
1600        /**
1601         * @return The version of the standard that is used to operate and communicate.
1602         */
1603        public String getVersion() { 
1604          return this.version == null ? null : this.version.getValue();
1605        }
1606
1607        /**
1608         * @param value The version of the standard that is used to operate and communicate.
1609         */
1610        public DeviceSpecializationComponent setVersion(String value) { 
1611          if (Utilities.noString(value))
1612            this.version = null;
1613          else {
1614            if (this.version == null)
1615              this.version = new StringType();
1616            this.version.setValue(value);
1617          }
1618          return this;
1619        }
1620
1621        /**
1622         * @return {@link #category} (Kind of standards that the device adheres to, e.g., communication, performance or communication.)
1623         */
1624        public Coding getCategory() { 
1625          if (this.category == null)
1626            if (Configuration.errorOnAutoCreate())
1627              throw new Error("Attempt to auto-create DeviceSpecializationComponent.category");
1628            else if (Configuration.doAutoCreate())
1629              this.category = new Coding(); // cc
1630          return this.category;
1631        }
1632
1633        public boolean hasCategory() { 
1634          return this.category != null && !this.category.isEmpty();
1635        }
1636
1637        /**
1638         * @param value {@link #category} (Kind of standards that the device adheres to, e.g., communication, performance or communication.)
1639         */
1640        public DeviceSpecializationComponent setCategory(Coding value) { 
1641          this.category = value;
1642          return this;
1643        }
1644
1645        protected void listChildren(List<Property> children) {
1646          super.listChildren(children);
1647          children.add(new Property("systemType", "CodeableConcept", "Code that specifies the property being represented. No codes are specified but the MDC codes are an example: https://build.fhir.org/mdc.html.", 0, 1, systemType));
1648          children.add(new Property("version", "string", "The version of the standard that is used to operate and communicate.", 0, 1, version));
1649          children.add(new Property("category", "Coding", "Kind of standards that the device adheres to, e.g., communication, performance or communication.", 0, 1, category));
1650        }
1651
1652        @Override
1653        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1654          switch (_hash) {
1655          case 642893321: /*systemType*/  return new Property("systemType", "CodeableConcept", "Code that specifies the property being represented. No codes are specified but the MDC codes are an example: https://build.fhir.org/mdc.html.", 0, 1, systemType);
1656          case 351608024: /*version*/  return new Property("version", "string", "The version of the standard that is used to operate and communicate.", 0, 1, version);
1657          case 50511102: /*category*/  return new Property("category", "Coding", "Kind of standards that the device adheres to, e.g., communication, performance or communication.", 0, 1, category);
1658          default: return super.getNamedProperty(_hash, _name, _checkValid);
1659          }
1660
1661        }
1662
1663      @Override
1664      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1665        switch (hash) {
1666        case 642893321: /*systemType*/ return this.systemType == null ? new Base[0] : new Base[] {this.systemType}; // CodeableConcept
1667        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
1668        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // Coding
1669        default: return super.getProperty(hash, name, checkValid);
1670        }
1671
1672      }
1673
1674      @Override
1675      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1676        switch (hash) {
1677        case 642893321: // systemType
1678          this.systemType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1679          return value;
1680        case 351608024: // version
1681          this.version = TypeConvertor.castToString(value); // StringType
1682          return value;
1683        case 50511102: // category
1684          this.category = TypeConvertor.castToCoding(value); // Coding
1685          return value;
1686        default: return super.setProperty(hash, name, value);
1687        }
1688
1689      }
1690
1691      @Override
1692      public Base setProperty(String name, Base value) throws FHIRException {
1693        if (name.equals("systemType")) {
1694          this.systemType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1695        } else if (name.equals("version")) {
1696          this.version = TypeConvertor.castToString(value); // StringType
1697        } else if (name.equals("category")) {
1698          this.category = TypeConvertor.castToCoding(value); // Coding
1699        } else
1700          return super.setProperty(name, value);
1701        return value;
1702      }
1703
1704      @Override
1705      public Base makeProperty(int hash, String name) throws FHIRException {
1706        switch (hash) {
1707        case 642893321:  return getSystemType();
1708        case 351608024:  return getVersionElement();
1709        case 50511102:  return getCategory();
1710        default: return super.makeProperty(hash, name);
1711        }
1712
1713      }
1714
1715      @Override
1716      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1717        switch (hash) {
1718        case 642893321: /*systemType*/ return new String[] {"CodeableConcept"};
1719        case 351608024: /*version*/ return new String[] {"string"};
1720        case 50511102: /*category*/ return new String[] {"Coding"};
1721        default: return super.getTypesForProperty(hash, name);
1722        }
1723
1724      }
1725
1726      @Override
1727      public Base addChild(String name) throws FHIRException {
1728        if (name.equals("systemType")) {
1729          this.systemType = new CodeableConcept();
1730          return this.systemType;
1731        }
1732        else if (name.equals("version")) {
1733          throw new FHIRException("Cannot call addChild on a primitive type Device.specialization.version");
1734        }
1735        else if (name.equals("category")) {
1736          this.category = new Coding();
1737          return this.category;
1738        }
1739        else
1740          return super.addChild(name);
1741      }
1742
1743      public DeviceSpecializationComponent copy() {
1744        DeviceSpecializationComponent dst = new DeviceSpecializationComponent();
1745        copyValues(dst);
1746        return dst;
1747      }
1748
1749      public void copyValues(DeviceSpecializationComponent dst) {
1750        super.copyValues(dst);
1751        dst.systemType = systemType == null ? null : systemType.copy();
1752        dst.version = version == null ? null : version.copy();
1753        dst.category = category == null ? null : category.copy();
1754      }
1755
1756      @Override
1757      public boolean equalsDeep(Base other_) {
1758        if (!super.equalsDeep(other_))
1759          return false;
1760        if (!(other_ instanceof DeviceSpecializationComponent))
1761          return false;
1762        DeviceSpecializationComponent o = (DeviceSpecializationComponent) other_;
1763        return compareDeep(systemType, o.systemType, true) && compareDeep(version, o.version, true) && compareDeep(category, o.category, true)
1764          ;
1765      }
1766
1767      @Override
1768      public boolean equalsShallow(Base other_) {
1769        if (!super.equalsShallow(other_))
1770          return false;
1771        if (!(other_ instanceof DeviceSpecializationComponent))
1772          return false;
1773        DeviceSpecializationComponent o = (DeviceSpecializationComponent) other_;
1774        return compareValues(version, o.version, true);
1775      }
1776
1777      public boolean isEmpty() {
1778        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(systemType, version, category
1779          );
1780      }
1781
1782  public String fhirType() {
1783    return "Device.specialization";
1784
1785  }
1786
1787  }
1788
1789    @Block()
1790    public static class DevicePropertyComponent extends BackboneElement implements IBaseBackboneElement {
1791        /**
1792         * Code that specifies the property being represented. No codes are specified but the MDC codes are an example: https://build.fhir.org/mdc.html.
1793         */
1794        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
1795        @Description(shortDefinition="Code that specifies the property being represented", formalDefinition="Code that specifies the property being represented. No codes are specified but the MDC codes are an example: https://build.fhir.org/mdc.html." )
1796        protected CodeableConcept type;
1797
1798        /**
1799         * Property value - can be a code, quantity, boolean, string or attachment.
1800         */
1801        @Child(name = "value", type = {Quantity.class, CodeableConcept.class, StringType.class, BooleanType.class, IntegerType.class, Range.class, Attachment.class}, order=2, min=1, max=1, modifier=false, summary=false)
1802        @Description(shortDefinition="Property value - as a code, quantity, boolean, string or attachmment", formalDefinition="Property value - can be a code, quantity, boolean, string or attachment." )
1803        protected DataType value;
1804
1805        private static final long serialVersionUID = -1659186716L;
1806
1807    /**
1808     * Constructor
1809     */
1810      public DevicePropertyComponent() {
1811        super();
1812      }
1813
1814    /**
1815     * Constructor
1816     */
1817      public DevicePropertyComponent(CodeableConcept type, DataType value) {
1818        super();
1819        this.setType(type);
1820        this.setValue(value);
1821      }
1822
1823        /**
1824         * @return {@link #type} (Code that specifies the property being represented. No codes are specified but the MDC codes are an example: https://build.fhir.org/mdc.html.)
1825         */
1826        public CodeableConcept getType() { 
1827          if (this.type == null)
1828            if (Configuration.errorOnAutoCreate())
1829              throw new Error("Attempt to auto-create DevicePropertyComponent.type");
1830            else if (Configuration.doAutoCreate())
1831              this.type = new CodeableConcept(); // cc
1832          return this.type;
1833        }
1834
1835        public boolean hasType() { 
1836          return this.type != null && !this.type.isEmpty();
1837        }
1838
1839        /**
1840         * @param value {@link #type} (Code that specifies the property being represented. No codes are specified but the MDC codes are an example: https://build.fhir.org/mdc.html.)
1841         */
1842        public DevicePropertyComponent setType(CodeableConcept value) { 
1843          this.type = value;
1844          return this;
1845        }
1846
1847        /**
1848         * @return {@link #value} (Property value - can be a code, quantity, boolean, string or attachment.)
1849         */
1850        public DataType getValue() { 
1851          return this.value;
1852        }
1853
1854        /**
1855         * @return {@link #value} (Property value - can be a code, quantity, boolean, string or attachment.)
1856         */
1857        public Quantity getValueQuantity() throws FHIRException { 
1858          if (this.value == null)
1859            this.value = new Quantity();
1860          if (!(this.value instanceof Quantity))
1861            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
1862          return (Quantity) this.value;
1863        }
1864
1865        public boolean hasValueQuantity() { 
1866          return this != null && this.value instanceof Quantity;
1867        }
1868
1869        /**
1870         * @return {@link #value} (Property value - can be a code, quantity, boolean, string or attachment.)
1871         */
1872        public CodeableConcept getValueCodeableConcept() throws FHIRException { 
1873          if (this.value == null)
1874            this.value = new CodeableConcept();
1875          if (!(this.value instanceof CodeableConcept))
1876            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered");
1877          return (CodeableConcept) this.value;
1878        }
1879
1880        public boolean hasValueCodeableConcept() { 
1881          return this != null && this.value instanceof CodeableConcept;
1882        }
1883
1884        /**
1885         * @return {@link #value} (Property value - can be a code, quantity, boolean, string or attachment.)
1886         */
1887        public StringType getValueStringType() throws FHIRException { 
1888          if (this.value == null)
1889            this.value = new StringType();
1890          if (!(this.value instanceof StringType))
1891            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
1892          return (StringType) this.value;
1893        }
1894
1895        public boolean hasValueStringType() { 
1896          return this != null && this.value instanceof StringType;
1897        }
1898
1899        /**
1900         * @return {@link #value} (Property value - can be a code, quantity, boolean, string or attachment.)
1901         */
1902        public BooleanType getValueBooleanType() throws FHIRException { 
1903          if (this.value == null)
1904            this.value = new BooleanType();
1905          if (!(this.value instanceof BooleanType))
1906            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
1907          return (BooleanType) this.value;
1908        }
1909
1910        public boolean hasValueBooleanType() { 
1911          return this != null && this.value instanceof BooleanType;
1912        }
1913
1914        /**
1915         * @return {@link #value} (Property value - can be a code, quantity, boolean, string or attachment.)
1916         */
1917        public IntegerType getValueIntegerType() throws FHIRException { 
1918          if (this.value == null)
1919            this.value = new IntegerType();
1920          if (!(this.value instanceof IntegerType))
1921            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
1922          return (IntegerType) this.value;
1923        }
1924
1925        public boolean hasValueIntegerType() { 
1926          return this != null && this.value instanceof IntegerType;
1927        }
1928
1929        /**
1930         * @return {@link #value} (Property value - can be a code, quantity, boolean, string or attachment.)
1931         */
1932        public Range getValueRange() throws FHIRException { 
1933          if (this.value == null)
1934            this.value = new Range();
1935          if (!(this.value instanceof Range))
1936            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.value.getClass().getName()+" was encountered");
1937          return (Range) this.value;
1938        }
1939
1940        public boolean hasValueRange() { 
1941          return this != null && this.value instanceof Range;
1942        }
1943
1944        /**
1945         * @return {@link #value} (Property value - can be a code, quantity, boolean, string or attachment.)
1946         */
1947        public Attachment getValueAttachment() throws FHIRException { 
1948          if (this.value == null)
1949            this.value = new Attachment();
1950          if (!(this.value instanceof Attachment))
1951            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
1952          return (Attachment) this.value;
1953        }
1954
1955        public boolean hasValueAttachment() { 
1956          return this != null && this.value instanceof Attachment;
1957        }
1958
1959        public boolean hasValue() { 
1960          return this.value != null && !this.value.isEmpty();
1961        }
1962
1963        /**
1964         * @param value {@link #value} (Property value - can be a code, quantity, boolean, string or attachment.)
1965         */
1966        public DevicePropertyComponent setValue(DataType value) { 
1967          if (value != null && !(value instanceof Quantity || value instanceof CodeableConcept || value instanceof StringType || value instanceof BooleanType || value instanceof IntegerType || value instanceof Range || value instanceof Attachment))
1968            throw new Error("Not the right type for Device.property.value[x]: "+value.fhirType());
1969          this.value = value;
1970          return this;
1971        }
1972
1973        protected void listChildren(List<Property> children) {
1974          super.listChildren(children);
1975          children.add(new Property("type", "CodeableConcept", "Code that specifies the property being represented. No codes are specified but the MDC codes are an example: https://build.fhir.org/mdc.html.", 0, 1, type));
1976          children.add(new Property("value[x]", "Quantity|CodeableConcept|string|boolean|integer|Range|Attachment", "Property value - can be a code, quantity, boolean, string or attachment.", 0, 1, value));
1977        }
1978
1979        @Override
1980        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1981          switch (_hash) {
1982          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Code that specifies the property being represented. No codes are specified but the MDC codes are an example: https://build.fhir.org/mdc.html.", 0, 1, type);
1983          case -1410166417: /*value[x]*/  return new Property("value[x]", "Quantity|CodeableConcept|string|boolean|integer|Range|Attachment", "Property value - can be a code, quantity, boolean, string or attachment.", 0, 1, value);
1984          case 111972721: /*value*/  return new Property("value[x]", "Quantity|CodeableConcept|string|boolean|integer|Range|Attachment", "Property value - can be a code, quantity, boolean, string or attachment.", 0, 1, value);
1985          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "Quantity", "Property value - can be a code, quantity, boolean, string or attachment.", 0, 1, value);
1986          case 924902896: /*valueCodeableConcept*/  return new Property("value[x]", "CodeableConcept", "Property value - can be a code, quantity, boolean, string or attachment.", 0, 1, value);
1987          case -1424603934: /*valueString*/  return new Property("value[x]", "string", "Property value - can be a code, quantity, boolean, string or attachment.", 0, 1, value);
1988          case 733421943: /*valueBoolean*/  return new Property("value[x]", "boolean", "Property value - can be a code, quantity, boolean, string or attachment.", 0, 1, value);
1989          case -1668204915: /*valueInteger*/  return new Property("value[x]", "integer", "Property value - can be a code, quantity, boolean, string or attachment.", 0, 1, value);
1990          case 2030761548: /*valueRange*/  return new Property("value[x]", "Range", "Property value - can be a code, quantity, boolean, string or attachment.", 0, 1, value);
1991          case -475566732: /*valueAttachment*/  return new Property("value[x]", "Attachment", "Property value - can be a code, quantity, boolean, string or attachment.", 0, 1, value);
1992          default: return super.getNamedProperty(_hash, _name, _checkValid);
1993          }
1994
1995        }
1996
1997      @Override
1998      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1999        switch (hash) {
2000        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2001        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
2002        default: return super.getProperty(hash, name, checkValid);
2003        }
2004
2005      }
2006
2007      @Override
2008      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2009        switch (hash) {
2010        case 3575610: // type
2011          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2012          return value;
2013        case 111972721: // value
2014          this.value = TypeConvertor.castToType(value); // DataType
2015          return value;
2016        default: return super.setProperty(hash, name, value);
2017        }
2018
2019      }
2020
2021      @Override
2022      public Base setProperty(String name, Base value) throws FHIRException {
2023        if (name.equals("type")) {
2024          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2025        } else if (name.equals("value[x]")) {
2026          this.value = TypeConvertor.castToType(value); // DataType
2027        } else
2028          return super.setProperty(name, value);
2029        return value;
2030      }
2031
2032      @Override
2033      public Base makeProperty(int hash, String name) throws FHIRException {
2034        switch (hash) {
2035        case 3575610:  return getType();
2036        case -1410166417:  return getValue();
2037        case 111972721:  return getValue();
2038        default: return super.makeProperty(hash, name);
2039        }
2040
2041      }
2042
2043      @Override
2044      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2045        switch (hash) {
2046        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2047        case 111972721: /*value*/ return new String[] {"Quantity", "CodeableConcept", "string", "boolean", "integer", "Range", "Attachment"};
2048        default: return super.getTypesForProperty(hash, name);
2049        }
2050
2051      }
2052
2053      @Override
2054      public Base addChild(String name) throws FHIRException {
2055        if (name.equals("type")) {
2056          this.type = new CodeableConcept();
2057          return this.type;
2058        }
2059        else if (name.equals("valueQuantity")) {
2060          this.value = new Quantity();
2061          return this.value;
2062        }
2063        else if (name.equals("valueCodeableConcept")) {
2064          this.value = new CodeableConcept();
2065          return this.value;
2066        }
2067        else if (name.equals("valueString")) {
2068          this.value = new StringType();
2069          return this.value;
2070        }
2071        else if (name.equals("valueBoolean")) {
2072          this.value = new BooleanType();
2073          return this.value;
2074        }
2075        else if (name.equals("valueInteger")) {
2076          this.value = new IntegerType();
2077          return this.value;
2078        }
2079        else if (name.equals("valueRange")) {
2080          this.value = new Range();
2081          return this.value;
2082        }
2083        else if (name.equals("valueAttachment")) {
2084          this.value = new Attachment();
2085          return this.value;
2086        }
2087        else
2088          return super.addChild(name);
2089      }
2090
2091      public DevicePropertyComponent copy() {
2092        DevicePropertyComponent dst = new DevicePropertyComponent();
2093        copyValues(dst);
2094        return dst;
2095      }
2096
2097      public void copyValues(DevicePropertyComponent dst) {
2098        super.copyValues(dst);
2099        dst.type = type == null ? null : type.copy();
2100        dst.value = value == null ? null : value.copy();
2101      }
2102
2103      @Override
2104      public boolean equalsDeep(Base other_) {
2105        if (!super.equalsDeep(other_))
2106          return false;
2107        if (!(other_ instanceof DevicePropertyComponent))
2108          return false;
2109        DevicePropertyComponent o = (DevicePropertyComponent) other_;
2110        return compareDeep(type, o.type, true) && compareDeep(value, o.value, true);
2111      }
2112
2113      @Override
2114      public boolean equalsShallow(Base other_) {
2115        if (!super.equalsShallow(other_))
2116          return false;
2117        if (!(other_ instanceof DevicePropertyComponent))
2118          return false;
2119        DevicePropertyComponent o = (DevicePropertyComponent) other_;
2120        return true;
2121      }
2122
2123      public boolean isEmpty() {
2124        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, value);
2125      }
2126
2127  public String fhirType() {
2128    return "Device.property";
2129
2130  }
2131
2132  }
2133
2134    @Block()
2135    public static class DeviceOperationalStateComponent extends BackboneElement implements IBaseBackboneElement {
2136        /**
2137         * The state or condition of the device's operation.
2138         */
2139        @Child(name = "status", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
2140        @Description(shortDefinition="Device operational condition", formalDefinition="The state or condition of the device's operation." )
2141        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-operationalstatus")
2142        protected CodeableConcept status;
2143
2144        /**
2145         * The reasons given for the current operational status - i.e. why is the device switched on etc.
2146         */
2147        @Child(name = "statusReason", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2148        @Description(shortDefinition="The reasons given for the current operational status", formalDefinition="The reasons given for the current operational status - i.e. why is the device switched on etc." )
2149        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-operation-status-reason")
2150        protected List<CodeableConcept> statusReason;
2151
2152        /**
2153         * The individual performing the action enabled by the device.
2154         */
2155        @Child(name = "operator", type = {Patient.class, Practitioner.class, RelatedPerson.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2156        @Description(shortDefinition="The current device operator", formalDefinition="The individual performing the action enabled by the device." )
2157        protected List<Reference> operator;
2158
2159        /**
2160         * The designated condition for performing a task with the device.
2161         */
2162        @Child(name = "mode", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
2163        @Description(shortDefinition="Designated condition for task", formalDefinition="The designated condition for performing a task with the device." )
2164        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-operational-state-mode")
2165        protected CodeableConcept mode;
2166
2167        /**
2168         * The series of occurrences that repeats during the operation of the device.
2169         */
2170        @Child(name = "cycle", type = {Count.class}, order=5, min=0, max=1, modifier=false, summary=false)
2171        @Description(shortDefinition="Number of operationcycles", formalDefinition="The series of occurrences that repeats during the operation of the device." )
2172        protected Count cycle;
2173
2174        /**
2175         * A measurement of time during the device's operation (e.g., days, hours, mins, etc).
2176         */
2177        @Child(name = "duration", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
2178        @Description(shortDefinition="Operation time measurement", formalDefinition="A measurement of time during the device's operation (e.g., days, hours, mins, etc)." )
2179        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-operational-state-mode")
2180        protected CodeableConcept duration;
2181
2182        private static final long serialVersionUID = 803068311L;
2183
2184    /**
2185     * Constructor
2186     */
2187      public DeviceOperationalStateComponent() {
2188        super();
2189      }
2190
2191    /**
2192     * Constructor
2193     */
2194      public DeviceOperationalStateComponent(CodeableConcept status) {
2195        super();
2196        this.setStatus(status);
2197      }
2198
2199        /**
2200         * @return {@link #status} (The state or condition of the device's operation.)
2201         */
2202        public CodeableConcept getStatus() { 
2203          if (this.status == null)
2204            if (Configuration.errorOnAutoCreate())
2205              throw new Error("Attempt to auto-create DeviceOperationalStateComponent.status");
2206            else if (Configuration.doAutoCreate())
2207              this.status = new CodeableConcept(); // cc
2208          return this.status;
2209        }
2210
2211        public boolean hasStatus() { 
2212          return this.status != null && !this.status.isEmpty();
2213        }
2214
2215        /**
2216         * @param value {@link #status} (The state or condition of the device's operation.)
2217         */
2218        public DeviceOperationalStateComponent setStatus(CodeableConcept value) { 
2219          this.status = value;
2220          return this;
2221        }
2222
2223        /**
2224         * @return {@link #statusReason} (The reasons given for the current operational status - i.e. why is the device switched on etc.)
2225         */
2226        public List<CodeableConcept> getStatusReason() { 
2227          if (this.statusReason == null)
2228            this.statusReason = new ArrayList<CodeableConcept>();
2229          return this.statusReason;
2230        }
2231
2232        /**
2233         * @return Returns a reference to <code>this</code> for easy method chaining
2234         */
2235        public DeviceOperationalStateComponent setStatusReason(List<CodeableConcept> theStatusReason) { 
2236          this.statusReason = theStatusReason;
2237          return this;
2238        }
2239
2240        public boolean hasStatusReason() { 
2241          if (this.statusReason == null)
2242            return false;
2243          for (CodeableConcept item : this.statusReason)
2244            if (!item.isEmpty())
2245              return true;
2246          return false;
2247        }
2248
2249        public CodeableConcept addStatusReason() { //3
2250          CodeableConcept t = new CodeableConcept();
2251          if (this.statusReason == null)
2252            this.statusReason = new ArrayList<CodeableConcept>();
2253          this.statusReason.add(t);
2254          return t;
2255        }
2256
2257        public DeviceOperationalStateComponent addStatusReason(CodeableConcept t) { //3
2258          if (t == null)
2259            return this;
2260          if (this.statusReason == null)
2261            this.statusReason = new ArrayList<CodeableConcept>();
2262          this.statusReason.add(t);
2263          return this;
2264        }
2265
2266        /**
2267         * @return The first repetition of repeating field {@link #statusReason}, creating it if it does not already exist {3}
2268         */
2269        public CodeableConcept getStatusReasonFirstRep() { 
2270          if (getStatusReason().isEmpty()) {
2271            addStatusReason();
2272          }
2273          return getStatusReason().get(0);
2274        }
2275
2276        /**
2277         * @return {@link #operator} (The individual performing the action enabled by the device.)
2278         */
2279        public List<Reference> getOperator() { 
2280          if (this.operator == null)
2281            this.operator = new ArrayList<Reference>();
2282          return this.operator;
2283        }
2284
2285        /**
2286         * @return Returns a reference to <code>this</code> for easy method chaining
2287         */
2288        public DeviceOperationalStateComponent setOperator(List<Reference> theOperator) { 
2289          this.operator = theOperator;
2290          return this;
2291        }
2292
2293        public boolean hasOperator() { 
2294          if (this.operator == null)
2295            return false;
2296          for (Reference item : this.operator)
2297            if (!item.isEmpty())
2298              return true;
2299          return false;
2300        }
2301
2302        public Reference addOperator() { //3
2303          Reference t = new Reference();
2304          if (this.operator == null)
2305            this.operator = new ArrayList<Reference>();
2306          this.operator.add(t);
2307          return t;
2308        }
2309
2310        public DeviceOperationalStateComponent addOperator(Reference t) { //3
2311          if (t == null)
2312            return this;
2313          if (this.operator == null)
2314            this.operator = new ArrayList<Reference>();
2315          this.operator.add(t);
2316          return this;
2317        }
2318
2319        /**
2320         * @return The first repetition of repeating field {@link #operator}, creating it if it does not already exist {3}
2321         */
2322        public Reference getOperatorFirstRep() { 
2323          if (getOperator().isEmpty()) {
2324            addOperator();
2325          }
2326          return getOperator().get(0);
2327        }
2328
2329        /**
2330         * @return {@link #mode} (The designated condition for performing a task with the device.)
2331         */
2332        public CodeableConcept getMode() { 
2333          if (this.mode == null)
2334            if (Configuration.errorOnAutoCreate())
2335              throw new Error("Attempt to auto-create DeviceOperationalStateComponent.mode");
2336            else if (Configuration.doAutoCreate())
2337              this.mode = new CodeableConcept(); // cc
2338          return this.mode;
2339        }
2340
2341        public boolean hasMode() { 
2342          return this.mode != null && !this.mode.isEmpty();
2343        }
2344
2345        /**
2346         * @param value {@link #mode} (The designated condition for performing a task with the device.)
2347         */
2348        public DeviceOperationalStateComponent setMode(CodeableConcept value) { 
2349          this.mode = value;
2350          return this;
2351        }
2352
2353        /**
2354         * @return {@link #cycle} (The series of occurrences that repeats during the operation of the device.)
2355         */
2356        public Count getCycle() { 
2357          if (this.cycle == null)
2358            if (Configuration.errorOnAutoCreate())
2359              throw new Error("Attempt to auto-create DeviceOperationalStateComponent.cycle");
2360            else if (Configuration.doAutoCreate())
2361              this.cycle = new Count(); // cc
2362          return this.cycle;
2363        }
2364
2365        public boolean hasCycle() { 
2366          return this.cycle != null && !this.cycle.isEmpty();
2367        }
2368
2369        /**
2370         * @param value {@link #cycle} (The series of occurrences that repeats during the operation of the device.)
2371         */
2372        public DeviceOperationalStateComponent setCycle(Count value) { 
2373          this.cycle = value;
2374          return this;
2375        }
2376
2377        /**
2378         * @return {@link #duration} (A measurement of time during the device's operation (e.g., days, hours, mins, etc).)
2379         */
2380        public CodeableConcept getDuration() { 
2381          if (this.duration == null)
2382            if (Configuration.errorOnAutoCreate())
2383              throw new Error("Attempt to auto-create DeviceOperationalStateComponent.duration");
2384            else if (Configuration.doAutoCreate())
2385              this.duration = new CodeableConcept(); // cc
2386          return this.duration;
2387        }
2388
2389        public boolean hasDuration() { 
2390          return this.duration != null && !this.duration.isEmpty();
2391        }
2392
2393        /**
2394         * @param value {@link #duration} (A measurement of time during the device's operation (e.g., days, hours, mins, etc).)
2395         */
2396        public DeviceOperationalStateComponent setDuration(CodeableConcept value) { 
2397          this.duration = value;
2398          return this;
2399        }
2400
2401        protected void listChildren(List<Property> children) {
2402          super.listChildren(children);
2403          children.add(new Property("status", "CodeableConcept", "The state or condition of the device's operation.", 0, 1, status));
2404          children.add(new Property("statusReason", "CodeableConcept", "The reasons given for the current operational status - i.e. why is the device switched on etc.", 0, java.lang.Integer.MAX_VALUE, statusReason));
2405          children.add(new Property("operator", "Reference(Patient|Practitioner|RelatedPerson)", "The individual performing the action enabled by the device.", 0, java.lang.Integer.MAX_VALUE, operator));
2406          children.add(new Property("mode", "CodeableConcept", "The designated condition for performing a task with the device.", 0, 1, mode));
2407          children.add(new Property("cycle", "Count", "The series of occurrences that repeats during the operation of the device.", 0, 1, cycle));
2408          children.add(new Property("duration", "CodeableConcept", "A measurement of time during the device's operation (e.g., days, hours, mins, etc).", 0, 1, duration));
2409        }
2410
2411        @Override
2412        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2413          switch (_hash) {
2414          case -892481550: /*status*/  return new Property("status", "CodeableConcept", "The state or condition of the device's operation.", 0, 1, status);
2415          case 2051346646: /*statusReason*/  return new Property("statusReason", "CodeableConcept", "The reasons given for the current operational status - i.e. why is the device switched on etc.", 0, java.lang.Integer.MAX_VALUE, statusReason);
2416          case -500553564: /*operator*/  return new Property("operator", "Reference(Patient|Practitioner|RelatedPerson)", "The individual performing the action enabled by the device.", 0, java.lang.Integer.MAX_VALUE, operator);
2417          case 3357091: /*mode*/  return new Property("mode", "CodeableConcept", "The designated condition for performing a task with the device.", 0, 1, mode);
2418          case 95131878: /*cycle*/  return new Property("cycle", "Count", "The series of occurrences that repeats during the operation of the device.", 0, 1, cycle);
2419          case -1992012396: /*duration*/  return new Property("duration", "CodeableConcept", "A measurement of time during the device's operation (e.g., days, hours, mins, etc).", 0, 1, duration);
2420          default: return super.getNamedProperty(_hash, _name, _checkValid);
2421          }
2422
2423        }
2424
2425      @Override
2426      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2427        switch (hash) {
2428        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept
2429        case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : this.statusReason.toArray(new Base[this.statusReason.size()]); // CodeableConcept
2430        case -500553564: /*operator*/ return this.operator == null ? new Base[0] : this.operator.toArray(new Base[this.operator.size()]); // Reference
2431        case 3357091: /*mode*/ return this.mode == null ? new Base[0] : new Base[] {this.mode}; // CodeableConcept
2432        case 95131878: /*cycle*/ return this.cycle == null ? new Base[0] : new Base[] {this.cycle}; // Count
2433        case -1992012396: /*duration*/ return this.duration == null ? new Base[0] : new Base[] {this.duration}; // CodeableConcept
2434        default: return super.getProperty(hash, name, checkValid);
2435        }
2436
2437      }
2438
2439      @Override
2440      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2441        switch (hash) {
2442        case -892481550: // status
2443          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2444          return value;
2445        case 2051346646: // statusReason
2446          this.getStatusReason().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2447          return value;
2448        case -500553564: // operator
2449          this.getOperator().add(TypeConvertor.castToReference(value)); // Reference
2450          return value;
2451        case 3357091: // mode
2452          this.mode = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2453          return value;
2454        case 95131878: // cycle
2455          this.cycle = TypeConvertor.castToCount(value); // Count
2456          return value;
2457        case -1992012396: // duration
2458          this.duration = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2459          return value;
2460        default: return super.setProperty(hash, name, value);
2461        }
2462
2463      }
2464
2465      @Override
2466      public Base setProperty(String name, Base value) throws FHIRException {
2467        if (name.equals("status")) {
2468          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2469        } else if (name.equals("statusReason")) {
2470          this.getStatusReason().add(TypeConvertor.castToCodeableConcept(value));
2471        } else if (name.equals("operator")) {
2472          this.getOperator().add(TypeConvertor.castToReference(value));
2473        } else if (name.equals("mode")) {
2474          this.mode = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2475        } else if (name.equals("cycle")) {
2476          this.cycle = TypeConvertor.castToCount(value); // Count
2477        } else if (name.equals("duration")) {
2478          this.duration = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2479        } else
2480          return super.setProperty(name, value);
2481        return value;
2482      }
2483
2484      @Override
2485      public Base makeProperty(int hash, String name) throws FHIRException {
2486        switch (hash) {
2487        case -892481550:  return getStatus();
2488        case 2051346646:  return addStatusReason(); 
2489        case -500553564:  return addOperator(); 
2490        case 3357091:  return getMode();
2491        case 95131878:  return getCycle();
2492        case -1992012396:  return getDuration();
2493        default: return super.makeProperty(hash, name);
2494        }
2495
2496      }
2497
2498      @Override
2499      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2500        switch (hash) {
2501        case -892481550: /*status*/ return new String[] {"CodeableConcept"};
2502        case 2051346646: /*statusReason*/ return new String[] {"CodeableConcept"};
2503        case -500553564: /*operator*/ return new String[] {"Reference"};
2504        case 3357091: /*mode*/ return new String[] {"CodeableConcept"};
2505        case 95131878: /*cycle*/ return new String[] {"Count"};
2506        case -1992012396: /*duration*/ return new String[] {"CodeableConcept"};
2507        default: return super.getTypesForProperty(hash, name);
2508        }
2509
2510      }
2511
2512      @Override
2513      public Base addChild(String name) throws FHIRException {
2514        if (name.equals("status")) {
2515          this.status = new CodeableConcept();
2516          return this.status;
2517        }
2518        else if (name.equals("statusReason")) {
2519          return addStatusReason();
2520        }
2521        else if (name.equals("operator")) {
2522          return addOperator();
2523        }
2524        else if (name.equals("mode")) {
2525          this.mode = new CodeableConcept();
2526          return this.mode;
2527        }
2528        else if (name.equals("cycle")) {
2529          this.cycle = new Count();
2530          return this.cycle;
2531        }
2532        else if (name.equals("duration")) {
2533          this.duration = new CodeableConcept();
2534          return this.duration;
2535        }
2536        else
2537          return super.addChild(name);
2538      }
2539
2540      public DeviceOperationalStateComponent copy() {
2541        DeviceOperationalStateComponent dst = new DeviceOperationalStateComponent();
2542        copyValues(dst);
2543        return dst;
2544      }
2545
2546      public void copyValues(DeviceOperationalStateComponent dst) {
2547        super.copyValues(dst);
2548        dst.status = status == null ? null : status.copy();
2549        if (statusReason != null) {
2550          dst.statusReason = new ArrayList<CodeableConcept>();
2551          for (CodeableConcept i : statusReason)
2552            dst.statusReason.add(i.copy());
2553        };
2554        if (operator != null) {
2555          dst.operator = new ArrayList<Reference>();
2556          for (Reference i : operator)
2557            dst.operator.add(i.copy());
2558        };
2559        dst.mode = mode == null ? null : mode.copy();
2560        dst.cycle = cycle == null ? null : cycle.copy();
2561        dst.duration = duration == null ? null : duration.copy();
2562      }
2563
2564      @Override
2565      public boolean equalsDeep(Base other_) {
2566        if (!super.equalsDeep(other_))
2567          return false;
2568        if (!(other_ instanceof DeviceOperationalStateComponent))
2569          return false;
2570        DeviceOperationalStateComponent o = (DeviceOperationalStateComponent) other_;
2571        return compareDeep(status, o.status, true) && compareDeep(statusReason, o.statusReason, true) && compareDeep(operator, o.operator, true)
2572           && compareDeep(mode, o.mode, true) && compareDeep(cycle, o.cycle, true) && compareDeep(duration, o.duration, true)
2573          ;
2574      }
2575
2576      @Override
2577      public boolean equalsShallow(Base other_) {
2578        if (!super.equalsShallow(other_))
2579          return false;
2580        if (!(other_ instanceof DeviceOperationalStateComponent))
2581          return false;
2582        DeviceOperationalStateComponent o = (DeviceOperationalStateComponent) other_;
2583        return true;
2584      }
2585
2586      public boolean isEmpty() {
2587        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(status, statusReason, operator
2588          , mode, cycle, duration);
2589      }
2590
2591  public String fhirType() {
2592    return "Device.operationalState";
2593
2594  }
2595
2596  }
2597
2598    @Block()
2599    public static class DeviceAssociationComponent extends BackboneElement implements IBaseBackboneElement {
2600        /**
2601         * The state of the usage or application of the device.
2602         */
2603        @Child(name = "status", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
2604        @Description(shortDefinition="Device useage state", formalDefinition="The state of the usage or application of the device." )
2605        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-association-status")
2606        protected CodeableConcept status;
2607
2608        /**
2609         * The reasons given for the current association status - i.e. why is the device explanted, or attached to the patient, etc.
2610         */
2611        @Child(name = "statusReason", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2612        @Description(shortDefinition="The reasons given for the current association status", formalDefinition="The reasons given for the current association status - i.e. why is the device explanted, or attached to the patient, etc." )
2613        protected List<CodeableConcept> statusReason;
2614
2615        /**
2616         * The individual to whom the device is affixed or inserted in their body.
2617         */
2618        @Child(name = "humanSubject", type = {Patient.class}, order=3, min=0, max=1, modifier=false, summary=false)
2619        @Description(shortDefinition="The individual associated with the device", formalDefinition="The individual to whom the device is affixed or inserted in their body." )
2620        protected Reference humanSubject;
2621
2622        /**
2623         * The current anatomical location of the device in/on the humanSubject where it is attached or placed.
2624         */
2625        @Child(name = "bodyStructure", type = {CodeableReference.class}, order=4, min=0, max=1, modifier=false, summary=true)
2626        @Description(shortDefinition="Current anatomical location of device in/on humanSubject", formalDefinition="The current anatomical location of the device in/on the humanSubject where it is attached or placed." )
2627        protected CodeableReference bodyStructure;
2628
2629        private static final long serialVersionUID = -534050127L;
2630
2631    /**
2632     * Constructor
2633     */
2634      public DeviceAssociationComponent() {
2635        super();
2636      }
2637
2638    /**
2639     * Constructor
2640     */
2641      public DeviceAssociationComponent(CodeableConcept status) {
2642        super();
2643        this.setStatus(status);
2644      }
2645
2646        /**
2647         * @return {@link #status} (The state of the usage or application of the device.)
2648         */
2649        public CodeableConcept getStatus() { 
2650          if (this.status == null)
2651            if (Configuration.errorOnAutoCreate())
2652              throw new Error("Attempt to auto-create DeviceAssociationComponent.status");
2653            else if (Configuration.doAutoCreate())
2654              this.status = new CodeableConcept(); // cc
2655          return this.status;
2656        }
2657
2658        public boolean hasStatus() { 
2659          return this.status != null && !this.status.isEmpty();
2660        }
2661
2662        /**
2663         * @param value {@link #status} (The state of the usage or application of the device.)
2664         */
2665        public DeviceAssociationComponent setStatus(CodeableConcept value) { 
2666          this.status = value;
2667          return this;
2668        }
2669
2670        /**
2671         * @return {@link #statusReason} (The reasons given for the current association status - i.e. why is the device explanted, or attached to the patient, etc.)
2672         */
2673        public List<CodeableConcept> getStatusReason() { 
2674          if (this.statusReason == null)
2675            this.statusReason = new ArrayList<CodeableConcept>();
2676          return this.statusReason;
2677        }
2678
2679        /**
2680         * @return Returns a reference to <code>this</code> for easy method chaining
2681         */
2682        public DeviceAssociationComponent setStatusReason(List<CodeableConcept> theStatusReason) { 
2683          this.statusReason = theStatusReason;
2684          return this;
2685        }
2686
2687        public boolean hasStatusReason() { 
2688          if (this.statusReason == null)
2689            return false;
2690          for (CodeableConcept item : this.statusReason)
2691            if (!item.isEmpty())
2692              return true;
2693          return false;
2694        }
2695
2696        public CodeableConcept addStatusReason() { //3
2697          CodeableConcept t = new CodeableConcept();
2698          if (this.statusReason == null)
2699            this.statusReason = new ArrayList<CodeableConcept>();
2700          this.statusReason.add(t);
2701          return t;
2702        }
2703
2704        public DeviceAssociationComponent addStatusReason(CodeableConcept t) { //3
2705          if (t == null)
2706            return this;
2707          if (this.statusReason == null)
2708            this.statusReason = new ArrayList<CodeableConcept>();
2709          this.statusReason.add(t);
2710          return this;
2711        }
2712
2713        /**
2714         * @return The first repetition of repeating field {@link #statusReason}, creating it if it does not already exist {3}
2715         */
2716        public CodeableConcept getStatusReasonFirstRep() { 
2717          if (getStatusReason().isEmpty()) {
2718            addStatusReason();
2719          }
2720          return getStatusReason().get(0);
2721        }
2722
2723        /**
2724         * @return {@link #humanSubject} (The individual to whom the device is affixed or inserted in their body.)
2725         */
2726        public Reference getHumanSubject() { 
2727          if (this.humanSubject == null)
2728            if (Configuration.errorOnAutoCreate())
2729              throw new Error("Attempt to auto-create DeviceAssociationComponent.humanSubject");
2730            else if (Configuration.doAutoCreate())
2731              this.humanSubject = new Reference(); // cc
2732          return this.humanSubject;
2733        }
2734
2735        public boolean hasHumanSubject() { 
2736          return this.humanSubject != null && !this.humanSubject.isEmpty();
2737        }
2738
2739        /**
2740         * @param value {@link #humanSubject} (The individual to whom the device is affixed or inserted in their body.)
2741         */
2742        public DeviceAssociationComponent setHumanSubject(Reference value) { 
2743          this.humanSubject = value;
2744          return this;
2745        }
2746
2747        /**
2748         * @return {@link #bodyStructure} (The current anatomical location of the device in/on the humanSubject where it is attached or placed.)
2749         */
2750        public CodeableReference getBodyStructure() { 
2751          if (this.bodyStructure == null)
2752            if (Configuration.errorOnAutoCreate())
2753              throw new Error("Attempt to auto-create DeviceAssociationComponent.bodyStructure");
2754            else if (Configuration.doAutoCreate())
2755              this.bodyStructure = new CodeableReference(); // cc
2756          return this.bodyStructure;
2757        }
2758
2759        public boolean hasBodyStructure() { 
2760          return this.bodyStructure != null && !this.bodyStructure.isEmpty();
2761        }
2762
2763        /**
2764         * @param value {@link #bodyStructure} (The current anatomical location of the device in/on the humanSubject where it is attached or placed.)
2765         */
2766        public DeviceAssociationComponent setBodyStructure(CodeableReference value) { 
2767          this.bodyStructure = value;
2768          return this;
2769        }
2770
2771        protected void listChildren(List<Property> children) {
2772          super.listChildren(children);
2773          children.add(new Property("status", "CodeableConcept", "The state of the usage or application of the device.", 0, 1, status));
2774          children.add(new Property("statusReason", "CodeableConcept", "The reasons given for the current association status - i.e. why is the device explanted, or attached to the patient, etc.", 0, java.lang.Integer.MAX_VALUE, statusReason));
2775          children.add(new Property("humanSubject", "Reference(Patient)", "The individual to whom the device is affixed or inserted in their body.", 0, 1, humanSubject));
2776          children.add(new Property("bodyStructure", "CodeableReference(BodyStructure)", "The current anatomical location of the device in/on the humanSubject where it is attached or placed.", 0, 1, bodyStructure));
2777        }
2778
2779        @Override
2780        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2781          switch (_hash) {
2782          case -892481550: /*status*/  return new Property("status", "CodeableConcept", "The state of the usage or application of the device.", 0, 1, status);
2783          case 2051346646: /*statusReason*/  return new Property("statusReason", "CodeableConcept", "The reasons given for the current association status - i.e. why is the device explanted, or attached to the patient, etc.", 0, java.lang.Integer.MAX_VALUE, statusReason);
2784          case -192393409: /*humanSubject*/  return new Property("humanSubject", "Reference(Patient)", "The individual to whom the device is affixed or inserted in their body.", 0, 1, humanSubject);
2785          case -1001731599: /*bodyStructure*/  return new Property("bodyStructure", "CodeableReference(BodyStructure)", "The current anatomical location of the device in/on the humanSubject where it is attached or placed.", 0, 1, bodyStructure);
2786          default: return super.getNamedProperty(_hash, _name, _checkValid);
2787          }
2788
2789        }
2790
2791      @Override
2792      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2793        switch (hash) {
2794        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept
2795        case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : this.statusReason.toArray(new Base[this.statusReason.size()]); // CodeableConcept
2796        case -192393409: /*humanSubject*/ return this.humanSubject == null ? new Base[0] : new Base[] {this.humanSubject}; // Reference
2797        case -1001731599: /*bodyStructure*/ return this.bodyStructure == null ? new Base[0] : new Base[] {this.bodyStructure}; // CodeableReference
2798        default: return super.getProperty(hash, name, checkValid);
2799        }
2800
2801      }
2802
2803      @Override
2804      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2805        switch (hash) {
2806        case -892481550: // status
2807          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2808          return value;
2809        case 2051346646: // statusReason
2810          this.getStatusReason().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2811          return value;
2812        case -192393409: // humanSubject
2813          this.humanSubject = TypeConvertor.castToReference(value); // Reference
2814          return value;
2815        case -1001731599: // bodyStructure
2816          this.bodyStructure = TypeConvertor.castToCodeableReference(value); // CodeableReference
2817          return value;
2818        default: return super.setProperty(hash, name, value);
2819        }
2820
2821      }
2822
2823      @Override
2824      public Base setProperty(String name, Base value) throws FHIRException {
2825        if (name.equals("status")) {
2826          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2827        } else if (name.equals("statusReason")) {
2828          this.getStatusReason().add(TypeConvertor.castToCodeableConcept(value));
2829        } else if (name.equals("humanSubject")) {
2830          this.humanSubject = TypeConvertor.castToReference(value); // Reference
2831        } else if (name.equals("bodyStructure")) {
2832          this.bodyStructure = TypeConvertor.castToCodeableReference(value); // CodeableReference
2833        } else
2834          return super.setProperty(name, value);
2835        return value;
2836      }
2837
2838      @Override
2839      public Base makeProperty(int hash, String name) throws FHIRException {
2840        switch (hash) {
2841        case -892481550:  return getStatus();
2842        case 2051346646:  return addStatusReason(); 
2843        case -192393409:  return getHumanSubject();
2844        case -1001731599:  return getBodyStructure();
2845        default: return super.makeProperty(hash, name);
2846        }
2847
2848      }
2849
2850      @Override
2851      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2852        switch (hash) {
2853        case -892481550: /*status*/ return new String[] {"CodeableConcept"};
2854        case 2051346646: /*statusReason*/ return new String[] {"CodeableConcept"};
2855        case -192393409: /*humanSubject*/ return new String[] {"Reference"};
2856        case -1001731599: /*bodyStructure*/ return new String[] {"CodeableReference"};
2857        default: return super.getTypesForProperty(hash, name);
2858        }
2859
2860      }
2861
2862      @Override
2863      public Base addChild(String name) throws FHIRException {
2864        if (name.equals("status")) {
2865          this.status = new CodeableConcept();
2866          return this.status;
2867        }
2868        else if (name.equals("statusReason")) {
2869          return addStatusReason();
2870        }
2871        else if (name.equals("humanSubject")) {
2872          this.humanSubject = new Reference();
2873          return this.humanSubject;
2874        }
2875        else if (name.equals("bodyStructure")) {
2876          this.bodyStructure = new CodeableReference();
2877          return this.bodyStructure;
2878        }
2879        else
2880          return super.addChild(name);
2881      }
2882
2883      public DeviceAssociationComponent copy() {
2884        DeviceAssociationComponent dst = new DeviceAssociationComponent();
2885        copyValues(dst);
2886        return dst;
2887      }
2888
2889      public void copyValues(DeviceAssociationComponent dst) {
2890        super.copyValues(dst);
2891        dst.status = status == null ? null : status.copy();
2892        if (statusReason != null) {
2893          dst.statusReason = new ArrayList<CodeableConcept>();
2894          for (CodeableConcept i : statusReason)
2895            dst.statusReason.add(i.copy());
2896        };
2897        dst.humanSubject = humanSubject == null ? null : humanSubject.copy();
2898        dst.bodyStructure = bodyStructure == null ? null : bodyStructure.copy();
2899      }
2900
2901      @Override
2902      public boolean equalsDeep(Base other_) {
2903        if (!super.equalsDeep(other_))
2904          return false;
2905        if (!(other_ instanceof DeviceAssociationComponent))
2906          return false;
2907        DeviceAssociationComponent o = (DeviceAssociationComponent) other_;
2908        return compareDeep(status, o.status, true) && compareDeep(statusReason, o.statusReason, true) && compareDeep(humanSubject, o.humanSubject, true)
2909           && compareDeep(bodyStructure, o.bodyStructure, true);
2910      }
2911
2912      @Override
2913      public boolean equalsShallow(Base other_) {
2914        if (!super.equalsShallow(other_))
2915          return false;
2916        if (!(other_ instanceof DeviceAssociationComponent))
2917          return false;
2918        DeviceAssociationComponent o = (DeviceAssociationComponent) other_;
2919        return true;
2920      }
2921
2922      public boolean isEmpty() {
2923        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(status, statusReason, humanSubject
2924          , bodyStructure);
2925      }
2926
2927  public String fhirType() {
2928    return "Device.association";
2929
2930  }
2931
2932  }
2933
2934    @Block()
2935    public static class DeviceLinkComponent extends BackboneElement implements IBaseBackboneElement {
2936        /**
2937         * The type indicates the relationship of the related device to the device instance.
2938         */
2939        @Child(name = "relation", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=false)
2940        @Description(shortDefinition="The type indicates the relationship of the related device to the device instance", formalDefinition="The type indicates the relationship of the related device to the device instance." )
2941        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-relationtype")
2942        protected Coding relation;
2943
2944        /**
2945         * A reference to the linked device.
2946         */
2947        @Child(name = "relatedDevice", type = {CodeableReference.class}, order=2, min=1, max=1, modifier=false, summary=false)
2948        @Description(shortDefinition="A reference to the linked device", formalDefinition="A reference to the linked device." )
2949        protected CodeableReference relatedDevice;
2950
2951        private static final long serialVersionUID = 627614461L;
2952
2953    /**
2954     * Constructor
2955     */
2956      public DeviceLinkComponent() {
2957        super();
2958      }
2959
2960    /**
2961     * Constructor
2962     */
2963      public DeviceLinkComponent(Coding relation, CodeableReference relatedDevice) {
2964        super();
2965        this.setRelation(relation);
2966        this.setRelatedDevice(relatedDevice);
2967      }
2968
2969        /**
2970         * @return {@link #relation} (The type indicates the relationship of the related device to the device instance.)
2971         */
2972        public Coding getRelation() { 
2973          if (this.relation == null)
2974            if (Configuration.errorOnAutoCreate())
2975              throw new Error("Attempt to auto-create DeviceLinkComponent.relation");
2976            else if (Configuration.doAutoCreate())
2977              this.relation = new Coding(); // cc
2978          return this.relation;
2979        }
2980
2981        public boolean hasRelation() { 
2982          return this.relation != null && !this.relation.isEmpty();
2983        }
2984
2985        /**
2986         * @param value {@link #relation} (The type indicates the relationship of the related device to the device instance.)
2987         */
2988        public DeviceLinkComponent setRelation(Coding value) { 
2989          this.relation = value;
2990          return this;
2991        }
2992
2993        /**
2994         * @return {@link #relatedDevice} (A reference to the linked device.)
2995         */
2996        public CodeableReference getRelatedDevice() { 
2997          if (this.relatedDevice == null)
2998            if (Configuration.errorOnAutoCreate())
2999              throw new Error("Attempt to auto-create DeviceLinkComponent.relatedDevice");
3000            else if (Configuration.doAutoCreate())
3001              this.relatedDevice = new CodeableReference(); // cc
3002          return this.relatedDevice;
3003        }
3004
3005        public boolean hasRelatedDevice() { 
3006          return this.relatedDevice != null && !this.relatedDevice.isEmpty();
3007        }
3008
3009        /**
3010         * @param value {@link #relatedDevice} (A reference to the linked device.)
3011         */
3012        public DeviceLinkComponent setRelatedDevice(CodeableReference value) { 
3013          this.relatedDevice = value;
3014          return this;
3015        }
3016
3017        protected void listChildren(List<Property> children) {
3018          super.listChildren(children);
3019          children.add(new Property("relation", "Coding", "The type indicates the relationship of the related device to the device instance.", 0, 1, relation));
3020          children.add(new Property("relatedDevice", "CodeableReference(Device)", "A reference to the linked device.", 0, 1, relatedDevice));
3021        }
3022
3023        @Override
3024        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3025          switch (_hash) {
3026          case -554436100: /*relation*/  return new Property("relation", "Coding", "The type indicates the relationship of the related device to the device instance.", 0, 1, relation);
3027          case -296314271: /*relatedDevice*/  return new Property("relatedDevice", "CodeableReference(Device)", "A reference to the linked device.", 0, 1, relatedDevice);
3028          default: return super.getNamedProperty(_hash, _name, _checkValid);
3029          }
3030
3031        }
3032
3033      @Override
3034      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3035        switch (hash) {
3036        case -554436100: /*relation*/ return this.relation == null ? new Base[0] : new Base[] {this.relation}; // Coding
3037        case -296314271: /*relatedDevice*/ return this.relatedDevice == null ? new Base[0] : new Base[] {this.relatedDevice}; // CodeableReference
3038        default: return super.getProperty(hash, name, checkValid);
3039        }
3040
3041      }
3042
3043      @Override
3044      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3045        switch (hash) {
3046        case -554436100: // relation
3047          this.relation = TypeConvertor.castToCoding(value); // Coding
3048          return value;
3049        case -296314271: // relatedDevice
3050          this.relatedDevice = TypeConvertor.castToCodeableReference(value); // CodeableReference
3051          return value;
3052        default: return super.setProperty(hash, name, value);
3053        }
3054
3055      }
3056
3057      @Override
3058      public Base setProperty(String name, Base value) throws FHIRException {
3059        if (name.equals("relation")) {
3060          this.relation = TypeConvertor.castToCoding(value); // Coding
3061        } else if (name.equals("relatedDevice")) {
3062          this.relatedDevice = TypeConvertor.castToCodeableReference(value); // CodeableReference
3063        } else
3064          return super.setProperty(name, value);
3065        return value;
3066      }
3067
3068      @Override
3069      public Base makeProperty(int hash, String name) throws FHIRException {
3070        switch (hash) {
3071        case -554436100:  return getRelation();
3072        case -296314271:  return getRelatedDevice();
3073        default: return super.makeProperty(hash, name);
3074        }
3075
3076      }
3077
3078      @Override
3079      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3080        switch (hash) {
3081        case -554436100: /*relation*/ return new String[] {"Coding"};
3082        case -296314271: /*relatedDevice*/ return new String[] {"CodeableReference"};
3083        default: return super.getTypesForProperty(hash, name);
3084        }
3085
3086      }
3087
3088      @Override
3089      public Base addChild(String name) throws FHIRException {
3090        if (name.equals("relation")) {
3091          this.relation = new Coding();
3092          return this.relation;
3093        }
3094        else if (name.equals("relatedDevice")) {
3095          this.relatedDevice = new CodeableReference();
3096          return this.relatedDevice;
3097        }
3098        else
3099          return super.addChild(name);
3100      }
3101
3102      public DeviceLinkComponent copy() {
3103        DeviceLinkComponent dst = new DeviceLinkComponent();
3104        copyValues(dst);
3105        return dst;
3106      }
3107
3108      public void copyValues(DeviceLinkComponent dst) {
3109        super.copyValues(dst);
3110        dst.relation = relation == null ? null : relation.copy();
3111        dst.relatedDevice = relatedDevice == null ? null : relatedDevice.copy();
3112      }
3113
3114      @Override
3115      public boolean equalsDeep(Base other_) {
3116        if (!super.equalsDeep(other_))
3117          return false;
3118        if (!(other_ instanceof DeviceLinkComponent))
3119          return false;
3120        DeviceLinkComponent o = (DeviceLinkComponent) other_;
3121        return compareDeep(relation, o.relation, true) && compareDeep(relatedDevice, o.relatedDevice, true)
3122          ;
3123      }
3124
3125      @Override
3126      public boolean equalsShallow(Base other_) {
3127        if (!super.equalsShallow(other_))
3128          return false;
3129        if (!(other_ instanceof DeviceLinkComponent))
3130          return false;
3131        DeviceLinkComponent o = (DeviceLinkComponent) other_;
3132        return true;
3133      }
3134
3135      public boolean isEmpty() {
3136        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(relation, relatedDevice);
3137      }
3138
3139  public String fhirType() {
3140    return "Device.link";
3141
3142  }
3143
3144  }
3145
3146    /**
3147     * Unique instance identifiers assigned to a device by manufacturers other organizations or owners.
3148     */
3149    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3150    @Description(shortDefinition="Instance identifier", formalDefinition="Unique instance identifiers assigned to a device by manufacturers other organizations or owners." )
3151    protected List<Identifier> identifier;
3152
3153    /**
3154     * The name used to display by default when the device is referenced. Based on intent of use by the resource creator, this may reflect one of the names in Device.deviceName, or may be another simple name.
3155     */
3156    @Child(name = "displayName", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
3157    @Description(shortDefinition="The name used to display by default when the device is referenced", formalDefinition="The name used to display by default when the device is referenced. Based on intent of use by the resource creator, this may reflect one of the names in Device.deviceName, or may be another simple name." )
3158    protected StringType displayName;
3159
3160    /**
3161     * The reference to the definition for the device.
3162     */
3163    @Child(name = "definition", type = {CodeableReference.class}, order=2, min=0, max=1, modifier=false, summary=false)
3164    @Description(shortDefinition="The reference to the definition for the device", formalDefinition="The reference to the definition for the device." )
3165    protected CodeableReference definition;
3166
3167    /**
3168     * 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.
3169     */
3170    @Child(name = "udiCarrier", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3171    @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." )
3172    protected List<DeviceUdiCarrierComponent> udiCarrier;
3173
3174    /**
3175     * Status of the Device record. This is not the status of the device like availability.
3176     */
3177    @Child(name = "status", type = {CodeType.class}, order=4, min=0, max=1, modifier=true, summary=true)
3178    @Description(shortDefinition="active | inactive | entered-in-error | unknown", formalDefinition="Status of the Device record. This is not the status of the device like availability." )
3179    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-status")
3180    protected Enumeration<FHIRDeviceStatus> status;
3181
3182    /**
3183     * Reason for the status of the Device record. For example, why is the record not active.
3184     */
3185    @Child(name = "statusReason", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3186    @Description(shortDefinition="discarded | obsolete | removed", formalDefinition="Reason for the status of the Device record. For example, why is the record not active." )
3187    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-status-reason")
3188    protected List<CodeableConcept> statusReason;
3189
3190    /**
3191     * An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled.
3192     */
3193    @Child(name = "biologicalSourceEvent", type = {Identifier.class}, order=6, min=0, max=1, modifier=false, summary=false)
3194    @Description(shortDefinition="An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled", formalDefinition="An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled." )
3195    protected Identifier biologicalSourceEvent;
3196
3197    /**
3198     * A name of the manufacturer or entity legally responsible for the device.
3199     */
3200    @Child(name = "manufacturer", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
3201    @Description(shortDefinition="Name of device manufacturer", formalDefinition="A name of the manufacturer or entity legally responsible for the device." )
3202    protected StringType manufacturer;
3203
3204    /**
3205     * The date and time when the device was manufactured.
3206     */
3207    @Child(name = "manufactureDate", type = {DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=false)
3208    @Description(shortDefinition="Date when the device was made", formalDefinition="The date and time when the device was manufactured." )
3209    protected DateTimeType manufactureDate;
3210
3211    /**
3212     * The date and time beyond which this device is no longer valid or should not be used (if applicable).
3213     */
3214    @Child(name = "expirationDate", type = {DateTimeType.class}, order=9, min=0, max=1, modifier=false, summary=false)
3215    @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)." )
3216    protected DateTimeType expirationDate;
3217
3218    /**
3219     * Lot number assigned by the manufacturer.
3220     */
3221    @Child(name = "lotNumber", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=false)
3222    @Description(shortDefinition="Lot number of manufacture", formalDefinition="Lot number assigned by the manufacturer." )
3223    protected StringType lotNumber;
3224
3225    /**
3226     * The serial number assigned by the organization when the device was manufactured.
3227     */
3228    @Child(name = "serialNumber", type = {StringType.class}, order=11, min=0, max=1, modifier=false, summary=false)
3229    @Description(shortDefinition="Serial number assigned by the manufacturer", formalDefinition="The serial number assigned by the organization when the device was manufactured." )
3230    protected StringType serialNumber;
3231
3232    /**
3233     * 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.
3234     */
3235    @Child(name = "deviceName", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3236    @Description(shortDefinition="The name or names of the device as known to the manufacturer and/or patient", 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." )
3237    protected List<DeviceDeviceNameComponent> deviceName;
3238
3239    /**
3240     * The manufacturer's model number for the device.
3241     */
3242    @Child(name = "modelNumber", type = {StringType.class}, order=13, min=0, max=1, modifier=false, summary=false)
3243    @Description(shortDefinition="The manufacturer's model number for the device", formalDefinition="The manufacturer's model number for the device." )
3244    protected StringType modelNumber;
3245
3246    /**
3247     * The part number or catalog number of the device.
3248     */
3249    @Child(name = "partNumber", type = {StringType.class}, order=14, min=0, max=1, modifier=false, summary=false)
3250    @Description(shortDefinition="The part number or catalog number of the device", formalDefinition="The part number or catalog number of the device." )
3251    protected StringType partNumber;
3252
3253    /**
3254     * The kind or type of device. A device instance may have more than one type - in which case those are the types that apply to the specific instance of the device.
3255     */
3256    @Child(name = "type", type = {CodeableConcept.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3257    @Description(shortDefinition="The kind or type of device", formalDefinition="The kind or type of device. A device instance may have more than one type - in which case those are the types that apply to the specific instance of the device." )
3258    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-type")
3259    protected List<CodeableConcept> type;
3260
3261    /**
3262     * The actual design of the device or software version running on the device.
3263     */
3264    @Child(name = "version", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3265    @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." )
3266    protected List<DeviceVersionComponent> version;
3267
3268    /**
3269     * The standards to which the device adheres and may be certified to in support of its capabilities, e.g., communication, performance, process, or measurement standards.
3270     */
3271    @Child(name = "specialization", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3272    @Description(shortDefinition="The standard(s) the device supports", formalDefinition="The standards to which the device adheres and may be certified to in support of its capabilities, e.g., communication, performance, process, or measurement standards." )
3273    protected List<DeviceSpecializationComponent> specialization;
3274
3275    /**
3276     * Characteristics or features of the device that are otherwise not captured in available attributes, e.g., actual configuration settings, time or timing attributes, resolution, accuracy, and physical attributes.  The focus is on properties of the device actually in use while DeviceDefinition focuses on properties that are available to be used.
3277     */
3278    @Child(name = "property", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3279    @Description(shortDefinition="The actual configuration settings of a device as it actually operates, e.g., regulation status, time properties", formalDefinition="Characteristics or features of the device that are otherwise not captured in available attributes, e.g., actual configuration settings, time or timing attributes, resolution, accuracy, and physical attributes.  The focus is on properties of the device actually in use while DeviceDefinition focuses on properties that are available to be used." )
3280    protected List<DevicePropertyComponent> property;
3281
3282    /**
3283     * Patient information, if the device is affixed to, or associated to a patient for their specific use, irrespective of the procedure, use, observation, or other activity that the device is involved in. The use of Patient is also appropriate for the use of devices outside a healthcare setting, such as a fitness tracker.
3284     */
3285    @Child(name = "subject", type = {Patient.class, Practitioner.class}, order=19, min=0, max=1, modifier=false, summary=false)
3286    @Description(shortDefinition="Patient to whom Device is affixed", formalDefinition="Patient information, if the device is affixed to, or associated to a patient for their specific use, irrespective of the procedure, use, observation, or other activity that the device is involved in. The use of Patient is also appropriate for the use of devices outside a healthcare setting, such as a fitness tracker." )
3287    protected Reference subject;
3288
3289    /**
3290     * The status of the device itself - whether it is switched on, or activated, etc.
3291     */
3292    @Child(name = "operationalState", type = {}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3293    @Description(shortDefinition="The status of the device itself - whether it is switched on, or activated, etc", formalDefinition="The status of the device itself - whether it is switched on, or activated, etc." )
3294    protected List<DeviceOperationalStateComponent> operationalState;
3295
3296    /**
3297     * The details about the device when it is affixed or inside of a patient.
3298     */
3299    @Child(name = "association", type = {}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3300    @Description(shortDefinition="Current association of the device", formalDefinition="The details about the device when it is affixed or inside of a patient." )
3301    protected List<DeviceAssociationComponent> association;
3302
3303    /**
3304     * An organization that is responsible for the provision and ongoing maintenance of the device.
3305     */
3306    @Child(name = "owner", type = {Organization.class}, order=22, min=0, max=1, modifier=false, summary=false)
3307    @Description(shortDefinition="Organization responsible for device", formalDefinition="An organization that is responsible for the provision and ongoing maintenance of the device." )
3308    protected Reference owner;
3309
3310    /**
3311     * Contact details for an organization or a particular human that is responsible for the device.
3312     */
3313    @Child(name = "contact", type = {ContactPoint.class}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3314    @Description(shortDefinition="Details for human/organization for support", formalDefinition="Contact details for an organization or a particular human that is responsible for the device." )
3315    protected List<ContactPoint> contact;
3316
3317    /**
3318     * The place where the device can be found.
3319     */
3320    @Child(name = "location", type = {Location.class}, order=24, min=0, max=1, modifier=false, summary=false)
3321    @Description(shortDefinition="Where the device is found", formalDefinition="The place where the device can be found." )
3322    protected Reference location;
3323
3324    /**
3325     * A network address on which the device may be contacted directly.
3326     */
3327    @Child(name = "url", type = {UriType.class}, order=25, min=0, max=1, modifier=false, summary=false)
3328    @Description(shortDefinition="Network address to contact device", formalDefinition="A network address on which the device may be contacted directly." )
3329    protected UriType url;
3330
3331    /**
3332     * Technical endpoints providing access to services provided by the device defined at this resource.
3333     */
3334    @Child(name = "endpoint", type = {Endpoint.class}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3335    @Description(shortDefinition="Technical endpoints providing access to electronic services provided by the device", formalDefinition="Technical endpoints providing access to services provided by the device defined at this resource." )
3336    protected List<Reference> endpoint;
3337
3338    /**
3339     * An associated device, attached to, used with, communicating with or linking a previous or new device model to the focal device.
3340     */
3341    @Child(name = "link", type = {}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3342    @Description(shortDefinition="An associated device, attached to, used with, communicating with or linking a previous or new device model to the focal device", formalDefinition="An associated device, attached to, used with, communicating with or linking a previous or new device model to the focal device." )
3343    protected List<DeviceLinkComponent> link;
3344
3345    /**
3346     * Descriptive information, usage information or implantation information that is not captured in an existing element.
3347     */
3348    @Child(name = "note", type = {Annotation.class}, order=28, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3349    @Description(shortDefinition="Device notes and comments", formalDefinition="Descriptive information, usage information or implantation information that is not captured in an existing element." )
3350    protected List<Annotation> note;
3351
3352    /**
3353     * Provides additional safety characteristics about a medical device.  For example devices containing latex.
3354     */
3355    @Child(name = "safety", type = {CodeableConcept.class}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3356    @Description(shortDefinition="Safety Characteristics of Device", formalDefinition="Provides additional safety characteristics about a medical device.  For example devices containing latex." )
3357    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-safety")
3358    protected List<CodeableConcept> safety;
3359
3360    /**
3361     * The higher level or encompassing device that this device is a logical part of.
3362     */
3363    @Child(name = "parent", type = {Device.class}, order=30, min=0, max=1, modifier=false, summary=false)
3364    @Description(shortDefinition="The device that this device is attached to or is part of", formalDefinition="The higher level or encompassing device that this device is a logical part of." )
3365    protected Reference parent;
3366
3367    private static final long serialVersionUID = -478488554L;
3368
3369  /**
3370   * Constructor
3371   */
3372    public Device() {
3373      super();
3374    }
3375
3376    /**
3377     * @return {@link #identifier} (Unique instance identifiers assigned to a device by manufacturers other organizations or owners.)
3378     */
3379    public List<Identifier> getIdentifier() { 
3380      if (this.identifier == null)
3381        this.identifier = new ArrayList<Identifier>();
3382      return this.identifier;
3383    }
3384
3385    /**
3386     * @return Returns a reference to <code>this</code> for easy method chaining
3387     */
3388    public Device setIdentifier(List<Identifier> theIdentifier) { 
3389      this.identifier = theIdentifier;
3390      return this;
3391    }
3392
3393    public boolean hasIdentifier() { 
3394      if (this.identifier == null)
3395        return false;
3396      for (Identifier item : this.identifier)
3397        if (!item.isEmpty())
3398          return true;
3399      return false;
3400    }
3401
3402    public Identifier addIdentifier() { //3
3403      Identifier t = new Identifier();
3404      if (this.identifier == null)
3405        this.identifier = new ArrayList<Identifier>();
3406      this.identifier.add(t);
3407      return t;
3408    }
3409
3410    public Device addIdentifier(Identifier t) { //3
3411      if (t == null)
3412        return this;
3413      if (this.identifier == null)
3414        this.identifier = new ArrayList<Identifier>();
3415      this.identifier.add(t);
3416      return this;
3417    }
3418
3419    /**
3420     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
3421     */
3422    public Identifier getIdentifierFirstRep() { 
3423      if (getIdentifier().isEmpty()) {
3424        addIdentifier();
3425      }
3426      return getIdentifier().get(0);
3427    }
3428
3429    /**
3430     * @return {@link #displayName} (The name used to display by default when the device is referenced. Based on intent of use by the resource creator, this may reflect one of the names in Device.deviceName, or may be another simple name.). This is the underlying object with id, value and extensions. The accessor "getDisplayName" gives direct access to the value
3431     */
3432    public StringType getDisplayNameElement() { 
3433      if (this.displayName == null)
3434        if (Configuration.errorOnAutoCreate())
3435          throw new Error("Attempt to auto-create Device.displayName");
3436        else if (Configuration.doAutoCreate())
3437          this.displayName = new StringType(); // bb
3438      return this.displayName;
3439    }
3440
3441    public boolean hasDisplayNameElement() { 
3442      return this.displayName != null && !this.displayName.isEmpty();
3443    }
3444
3445    public boolean hasDisplayName() { 
3446      return this.displayName != null && !this.displayName.isEmpty();
3447    }
3448
3449    /**
3450     * @param value {@link #displayName} (The name used to display by default when the device is referenced. Based on intent of use by the resource creator, this may reflect one of the names in Device.deviceName, or may be another simple name.). This is the underlying object with id, value and extensions. The accessor "getDisplayName" gives direct access to the value
3451     */
3452    public Device setDisplayNameElement(StringType value) { 
3453      this.displayName = value;
3454      return this;
3455    }
3456
3457    /**
3458     * @return The name used to display by default when the device is referenced. Based on intent of use by the resource creator, this may reflect one of the names in Device.deviceName, or may be another simple name.
3459     */
3460    public String getDisplayName() { 
3461      return this.displayName == null ? null : this.displayName.getValue();
3462    }
3463
3464    /**
3465     * @param value The name used to display by default when the device is referenced. Based on intent of use by the resource creator, this may reflect one of the names in Device.deviceName, or may be another simple name.
3466     */
3467    public Device setDisplayName(String value) { 
3468      if (Utilities.noString(value))
3469        this.displayName = null;
3470      else {
3471        if (this.displayName == null)
3472          this.displayName = new StringType();
3473        this.displayName.setValue(value);
3474      }
3475      return this;
3476    }
3477
3478    /**
3479     * @return {@link #definition} (The reference to the definition for the device.)
3480     */
3481    public CodeableReference getDefinition() { 
3482      if (this.definition == null)
3483        if (Configuration.errorOnAutoCreate())
3484          throw new Error("Attempt to auto-create Device.definition");
3485        else if (Configuration.doAutoCreate())
3486          this.definition = new CodeableReference(); // cc
3487      return this.definition;
3488    }
3489
3490    public boolean hasDefinition() { 
3491      return this.definition != null && !this.definition.isEmpty();
3492    }
3493
3494    /**
3495     * @param value {@link #definition} (The reference to the definition for the device.)
3496     */
3497    public Device setDefinition(CodeableReference value) { 
3498      this.definition = value;
3499      return this;
3500    }
3501
3502    /**
3503     * @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.)
3504     */
3505    public List<DeviceUdiCarrierComponent> getUdiCarrier() { 
3506      if (this.udiCarrier == null)
3507        this.udiCarrier = new ArrayList<DeviceUdiCarrierComponent>();
3508      return this.udiCarrier;
3509    }
3510
3511    /**
3512     * @return Returns a reference to <code>this</code> for easy method chaining
3513     */
3514    public Device setUdiCarrier(List<DeviceUdiCarrierComponent> theUdiCarrier) { 
3515      this.udiCarrier = theUdiCarrier;
3516      return this;
3517    }
3518
3519    public boolean hasUdiCarrier() { 
3520      if (this.udiCarrier == null)
3521        return false;
3522      for (DeviceUdiCarrierComponent item : this.udiCarrier)
3523        if (!item.isEmpty())
3524          return true;
3525      return false;
3526    }
3527
3528    public DeviceUdiCarrierComponent addUdiCarrier() { //3
3529      DeviceUdiCarrierComponent t = new DeviceUdiCarrierComponent();
3530      if (this.udiCarrier == null)
3531        this.udiCarrier = new ArrayList<DeviceUdiCarrierComponent>();
3532      this.udiCarrier.add(t);
3533      return t;
3534    }
3535
3536    public Device addUdiCarrier(DeviceUdiCarrierComponent t) { //3
3537      if (t == null)
3538        return this;
3539      if (this.udiCarrier == null)
3540        this.udiCarrier = new ArrayList<DeviceUdiCarrierComponent>();
3541      this.udiCarrier.add(t);
3542      return this;
3543    }
3544
3545    /**
3546     * @return The first repetition of repeating field {@link #udiCarrier}, creating it if it does not already exist {3}
3547     */
3548    public DeviceUdiCarrierComponent getUdiCarrierFirstRep() { 
3549      if (getUdiCarrier().isEmpty()) {
3550        addUdiCarrier();
3551      }
3552      return getUdiCarrier().get(0);
3553    }
3554
3555    /**
3556     * @return {@link #status} (Status of the Device record. This is not the status of the device like availability.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
3557     */
3558    public Enumeration<FHIRDeviceStatus> getStatusElement() { 
3559      if (this.status == null)
3560        if (Configuration.errorOnAutoCreate())
3561          throw new Error("Attempt to auto-create Device.status");
3562        else if (Configuration.doAutoCreate())
3563          this.status = new Enumeration<FHIRDeviceStatus>(new FHIRDeviceStatusEnumFactory()); // bb
3564      return this.status;
3565    }
3566
3567    public boolean hasStatusElement() { 
3568      return this.status != null && !this.status.isEmpty();
3569    }
3570
3571    public boolean hasStatus() { 
3572      return this.status != null && !this.status.isEmpty();
3573    }
3574
3575    /**
3576     * @param value {@link #status} (Status of the Device record. This is not the status of the device like availability.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
3577     */
3578    public Device setStatusElement(Enumeration<FHIRDeviceStatus> value) { 
3579      this.status = value;
3580      return this;
3581    }
3582
3583    /**
3584     * @return Status of the Device record. This is not the status of the device like availability.
3585     */
3586    public FHIRDeviceStatus getStatus() { 
3587      return this.status == null ? null : this.status.getValue();
3588    }
3589
3590    /**
3591     * @param value Status of the Device record. This is not the status of the device like availability.
3592     */
3593    public Device setStatus(FHIRDeviceStatus value) { 
3594      if (value == null)
3595        this.status = null;
3596      else {
3597        if (this.status == null)
3598          this.status = new Enumeration<FHIRDeviceStatus>(new FHIRDeviceStatusEnumFactory());
3599        this.status.setValue(value);
3600      }
3601      return this;
3602    }
3603
3604    /**
3605     * @return {@link #statusReason} (Reason for the status of the Device record. For example, why is the record not active.)
3606     */
3607    public List<CodeableConcept> getStatusReason() { 
3608      if (this.statusReason == null)
3609        this.statusReason = new ArrayList<CodeableConcept>();
3610      return this.statusReason;
3611    }
3612
3613    /**
3614     * @return Returns a reference to <code>this</code> for easy method chaining
3615     */
3616    public Device setStatusReason(List<CodeableConcept> theStatusReason) { 
3617      this.statusReason = theStatusReason;
3618      return this;
3619    }
3620
3621    public boolean hasStatusReason() { 
3622      if (this.statusReason == null)
3623        return false;
3624      for (CodeableConcept item : this.statusReason)
3625        if (!item.isEmpty())
3626          return true;
3627      return false;
3628    }
3629
3630    public CodeableConcept addStatusReason() { //3
3631      CodeableConcept t = new CodeableConcept();
3632      if (this.statusReason == null)
3633        this.statusReason = new ArrayList<CodeableConcept>();
3634      this.statusReason.add(t);
3635      return t;
3636    }
3637
3638    public Device addStatusReason(CodeableConcept t) { //3
3639      if (t == null)
3640        return this;
3641      if (this.statusReason == null)
3642        this.statusReason = new ArrayList<CodeableConcept>();
3643      this.statusReason.add(t);
3644      return this;
3645    }
3646
3647    /**
3648     * @return The first repetition of repeating field {@link #statusReason}, creating it if it does not already exist {3}
3649     */
3650    public CodeableConcept getStatusReasonFirstRep() { 
3651      if (getStatusReason().isEmpty()) {
3652        addStatusReason();
3653      }
3654      return getStatusReason().get(0);
3655    }
3656
3657    /**
3658     * @return {@link #biologicalSourceEvent} (An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled.)
3659     */
3660    public Identifier getBiologicalSourceEvent() { 
3661      if (this.biologicalSourceEvent == null)
3662        if (Configuration.errorOnAutoCreate())
3663          throw new Error("Attempt to auto-create Device.biologicalSourceEvent");
3664        else if (Configuration.doAutoCreate())
3665          this.biologicalSourceEvent = new Identifier(); // cc
3666      return this.biologicalSourceEvent;
3667    }
3668
3669    public boolean hasBiologicalSourceEvent() { 
3670      return this.biologicalSourceEvent != null && !this.biologicalSourceEvent.isEmpty();
3671    }
3672
3673    /**
3674     * @param value {@link #biologicalSourceEvent} (An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled.)
3675     */
3676    public Device setBiologicalSourceEvent(Identifier value) { 
3677      this.biologicalSourceEvent = value;
3678      return this;
3679    }
3680
3681    /**
3682     * @return {@link #manufacturer} (A name of the manufacturer or entity legally responsible for the device.). This is the underlying object with id, value and extensions. The accessor "getManufacturer" gives direct access to the value
3683     */
3684    public StringType getManufacturerElement() { 
3685      if (this.manufacturer == null)
3686        if (Configuration.errorOnAutoCreate())
3687          throw new Error("Attempt to auto-create Device.manufacturer");
3688        else if (Configuration.doAutoCreate())
3689          this.manufacturer = new StringType(); // bb
3690      return this.manufacturer;
3691    }
3692
3693    public boolean hasManufacturerElement() { 
3694      return this.manufacturer != null && !this.manufacturer.isEmpty();
3695    }
3696
3697    public boolean hasManufacturer() { 
3698      return this.manufacturer != null && !this.manufacturer.isEmpty();
3699    }
3700
3701    /**
3702     * @param value {@link #manufacturer} (A name of the manufacturer or entity legally responsible for the device.). This is the underlying object with id, value and extensions. The accessor "getManufacturer" gives direct access to the value
3703     */
3704    public Device setManufacturerElement(StringType value) { 
3705      this.manufacturer = value;
3706      return this;
3707    }
3708
3709    /**
3710     * @return A name of the manufacturer or entity legally responsible for the device.
3711     */
3712    public String getManufacturer() { 
3713      return this.manufacturer == null ? null : this.manufacturer.getValue();
3714    }
3715
3716    /**
3717     * @param value A name of the manufacturer or entity legally responsible for the device.
3718     */
3719    public Device setManufacturer(String value) { 
3720      if (Utilities.noString(value))
3721        this.manufacturer = null;
3722      else {
3723        if (this.manufacturer == null)
3724          this.manufacturer = new StringType();
3725        this.manufacturer.setValue(value);
3726      }
3727      return this;
3728    }
3729
3730    /**
3731     * @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
3732     */
3733    public DateTimeType getManufactureDateElement() { 
3734      if (this.manufactureDate == null)
3735        if (Configuration.errorOnAutoCreate())
3736          throw new Error("Attempt to auto-create Device.manufactureDate");
3737        else if (Configuration.doAutoCreate())
3738          this.manufactureDate = new DateTimeType(); // bb
3739      return this.manufactureDate;
3740    }
3741
3742    public boolean hasManufactureDateElement() { 
3743      return this.manufactureDate != null && !this.manufactureDate.isEmpty();
3744    }
3745
3746    public boolean hasManufactureDate() { 
3747      return this.manufactureDate != null && !this.manufactureDate.isEmpty();
3748    }
3749
3750    /**
3751     * @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
3752     */
3753    public Device setManufactureDateElement(DateTimeType value) { 
3754      this.manufactureDate = value;
3755      return this;
3756    }
3757
3758    /**
3759     * @return The date and time when the device was manufactured.
3760     */
3761    public Date getManufactureDate() { 
3762      return this.manufactureDate == null ? null : this.manufactureDate.getValue();
3763    }
3764
3765    /**
3766     * @param value The date and time when the device was manufactured.
3767     */
3768    public Device setManufactureDate(Date value) { 
3769      if (value == null)
3770        this.manufactureDate = null;
3771      else {
3772        if (this.manufactureDate == null)
3773          this.manufactureDate = new DateTimeType();
3774        this.manufactureDate.setValue(value);
3775      }
3776      return this;
3777    }
3778
3779    /**
3780     * @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
3781     */
3782    public DateTimeType getExpirationDateElement() { 
3783      if (this.expirationDate == null)
3784        if (Configuration.errorOnAutoCreate())
3785          throw new Error("Attempt to auto-create Device.expirationDate");
3786        else if (Configuration.doAutoCreate())
3787          this.expirationDate = new DateTimeType(); // bb
3788      return this.expirationDate;
3789    }
3790
3791    public boolean hasExpirationDateElement() { 
3792      return this.expirationDate != null && !this.expirationDate.isEmpty();
3793    }
3794
3795    public boolean hasExpirationDate() { 
3796      return this.expirationDate != null && !this.expirationDate.isEmpty();
3797    }
3798
3799    /**
3800     * @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
3801     */
3802    public Device setExpirationDateElement(DateTimeType value) { 
3803      this.expirationDate = value;
3804      return this;
3805    }
3806
3807    /**
3808     * @return The date and time beyond which this device is no longer valid or should not be used (if applicable).
3809     */
3810    public Date getExpirationDate() { 
3811      return this.expirationDate == null ? null : this.expirationDate.getValue();
3812    }
3813
3814    /**
3815     * @param value The date and time beyond which this device is no longer valid or should not be used (if applicable).
3816     */
3817    public Device setExpirationDate(Date value) { 
3818      if (value == null)
3819        this.expirationDate = null;
3820      else {
3821        if (this.expirationDate == null)
3822          this.expirationDate = new DateTimeType();
3823        this.expirationDate.setValue(value);
3824      }
3825      return this;
3826    }
3827
3828    /**
3829     * @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
3830     */
3831    public StringType getLotNumberElement() { 
3832      if (this.lotNumber == null)
3833        if (Configuration.errorOnAutoCreate())
3834          throw new Error("Attempt to auto-create Device.lotNumber");
3835        else if (Configuration.doAutoCreate())
3836          this.lotNumber = new StringType(); // bb
3837      return this.lotNumber;
3838    }
3839
3840    public boolean hasLotNumberElement() { 
3841      return this.lotNumber != null && !this.lotNumber.isEmpty();
3842    }
3843
3844    public boolean hasLotNumber() { 
3845      return this.lotNumber != null && !this.lotNumber.isEmpty();
3846    }
3847
3848    /**
3849     * @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
3850     */
3851    public Device setLotNumberElement(StringType value) { 
3852      this.lotNumber = value;
3853      return this;
3854    }
3855
3856    /**
3857     * @return Lot number assigned by the manufacturer.
3858     */
3859    public String getLotNumber() { 
3860      return this.lotNumber == null ? null : this.lotNumber.getValue();
3861    }
3862
3863    /**
3864     * @param value Lot number assigned by the manufacturer.
3865     */
3866    public Device setLotNumber(String value) { 
3867      if (Utilities.noString(value))
3868        this.lotNumber = null;
3869      else {
3870        if (this.lotNumber == null)
3871          this.lotNumber = new StringType();
3872        this.lotNumber.setValue(value);
3873      }
3874      return this;
3875    }
3876
3877    /**
3878     * @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
3879     */
3880    public StringType getSerialNumberElement() { 
3881      if (this.serialNumber == null)
3882        if (Configuration.errorOnAutoCreate())
3883          throw new Error("Attempt to auto-create Device.serialNumber");
3884        else if (Configuration.doAutoCreate())
3885          this.serialNumber = new StringType(); // bb
3886      return this.serialNumber;
3887    }
3888
3889    public boolean hasSerialNumberElement() { 
3890      return this.serialNumber != null && !this.serialNumber.isEmpty();
3891    }
3892
3893    public boolean hasSerialNumber() { 
3894      return this.serialNumber != null && !this.serialNumber.isEmpty();
3895    }
3896
3897    /**
3898     * @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
3899     */
3900    public Device setSerialNumberElement(StringType value) { 
3901      this.serialNumber = value;
3902      return this;
3903    }
3904
3905    /**
3906     * @return The serial number assigned by the organization when the device was manufactured.
3907     */
3908    public String getSerialNumber() { 
3909      return this.serialNumber == null ? null : this.serialNumber.getValue();
3910    }
3911
3912    /**
3913     * @param value The serial number assigned by the organization when the device was manufactured.
3914     */
3915    public Device setSerialNumber(String value) { 
3916      if (Utilities.noString(value))
3917        this.serialNumber = null;
3918      else {
3919        if (this.serialNumber == null)
3920          this.serialNumber = new StringType();
3921        this.serialNumber.setValue(value);
3922      }
3923      return this;
3924    }
3925
3926    /**
3927     * @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.)
3928     */
3929    public List<DeviceDeviceNameComponent> getDeviceName() { 
3930      if (this.deviceName == null)
3931        this.deviceName = new ArrayList<DeviceDeviceNameComponent>();
3932      return this.deviceName;
3933    }
3934
3935    /**
3936     * @return Returns a reference to <code>this</code> for easy method chaining
3937     */
3938    public Device setDeviceName(List<DeviceDeviceNameComponent> theDeviceName) { 
3939      this.deviceName = theDeviceName;
3940      return this;
3941    }
3942
3943    public boolean hasDeviceName() { 
3944      if (this.deviceName == null)
3945        return false;
3946      for (DeviceDeviceNameComponent item : this.deviceName)
3947        if (!item.isEmpty())
3948          return true;
3949      return false;
3950    }
3951
3952    public DeviceDeviceNameComponent addDeviceName() { //3
3953      DeviceDeviceNameComponent t = new DeviceDeviceNameComponent();
3954      if (this.deviceName == null)
3955        this.deviceName = new ArrayList<DeviceDeviceNameComponent>();
3956      this.deviceName.add(t);
3957      return t;
3958    }
3959
3960    public Device addDeviceName(DeviceDeviceNameComponent t) { //3
3961      if (t == null)
3962        return this;
3963      if (this.deviceName == null)
3964        this.deviceName = new ArrayList<DeviceDeviceNameComponent>();
3965      this.deviceName.add(t);
3966      return this;
3967    }
3968
3969    /**
3970     * @return The first repetition of repeating field {@link #deviceName}, creating it if it does not already exist {3}
3971     */
3972    public DeviceDeviceNameComponent getDeviceNameFirstRep() { 
3973      if (getDeviceName().isEmpty()) {
3974        addDeviceName();
3975      }
3976      return getDeviceName().get(0);
3977    }
3978
3979    /**
3980     * @return {@link #modelNumber} (The manufacturer's model number for the device.). This is the underlying object with id, value and extensions. The accessor "getModelNumber" gives direct access to the value
3981     */
3982    public StringType getModelNumberElement() { 
3983      if (this.modelNumber == null)
3984        if (Configuration.errorOnAutoCreate())
3985          throw new Error("Attempt to auto-create Device.modelNumber");
3986        else if (Configuration.doAutoCreate())
3987          this.modelNumber = new StringType(); // bb
3988      return this.modelNumber;
3989    }
3990
3991    public boolean hasModelNumberElement() { 
3992      return this.modelNumber != null && !this.modelNumber.isEmpty();
3993    }
3994
3995    public boolean hasModelNumber() { 
3996      return this.modelNumber != null && !this.modelNumber.isEmpty();
3997    }
3998
3999    /**
4000     * @param value {@link #modelNumber} (The manufacturer's model number for the device.). This is the underlying object with id, value and extensions. The accessor "getModelNumber" gives direct access to the value
4001     */
4002    public Device setModelNumberElement(StringType value) { 
4003      this.modelNumber = value;
4004      return this;
4005    }
4006
4007    /**
4008     * @return The manufacturer's model number for the device.
4009     */
4010    public String getModelNumber() { 
4011      return this.modelNumber == null ? null : this.modelNumber.getValue();
4012    }
4013
4014    /**
4015     * @param value The manufacturer's model number for the device.
4016     */
4017    public Device setModelNumber(String value) { 
4018      if (Utilities.noString(value))
4019        this.modelNumber = null;
4020      else {
4021        if (this.modelNumber == null)
4022          this.modelNumber = new StringType();
4023        this.modelNumber.setValue(value);
4024      }
4025      return this;
4026    }
4027
4028    /**
4029     * @return {@link #partNumber} (The part number or catalog number of the device.). This is the underlying object with id, value and extensions. The accessor "getPartNumber" gives direct access to the value
4030     */
4031    public StringType getPartNumberElement() { 
4032      if (this.partNumber == null)
4033        if (Configuration.errorOnAutoCreate())
4034          throw new Error("Attempt to auto-create Device.partNumber");
4035        else if (Configuration.doAutoCreate())
4036          this.partNumber = new StringType(); // bb
4037      return this.partNumber;
4038    }
4039
4040    public boolean hasPartNumberElement() { 
4041      return this.partNumber != null && !this.partNumber.isEmpty();
4042    }
4043
4044    public boolean hasPartNumber() { 
4045      return this.partNumber != null && !this.partNumber.isEmpty();
4046    }
4047
4048    /**
4049     * @param value {@link #partNumber} (The part number or catalog number of the device.). This is the underlying object with id, value and extensions. The accessor "getPartNumber" gives direct access to the value
4050     */
4051    public Device setPartNumberElement(StringType value) { 
4052      this.partNumber = value;
4053      return this;
4054    }
4055
4056    /**
4057     * @return The part number or catalog number of the device.
4058     */
4059    public String getPartNumber() { 
4060      return this.partNumber == null ? null : this.partNumber.getValue();
4061    }
4062
4063    /**
4064     * @param value The part number or catalog number of the device.
4065     */
4066    public Device setPartNumber(String value) { 
4067      if (Utilities.noString(value))
4068        this.partNumber = null;
4069      else {
4070        if (this.partNumber == null)
4071          this.partNumber = new StringType();
4072        this.partNumber.setValue(value);
4073      }
4074      return this;
4075    }
4076
4077    /**
4078     * @return {@link #type} (The kind or type of device. A device instance may have more than one type - in which case those are the types that apply to the specific instance of the device.)
4079     */
4080    public List<CodeableConcept> getType() { 
4081      if (this.type == null)
4082        this.type = new ArrayList<CodeableConcept>();
4083      return this.type;
4084    }
4085
4086    /**
4087     * @return Returns a reference to <code>this</code> for easy method chaining
4088     */
4089    public Device setType(List<CodeableConcept> theType) { 
4090      this.type = theType;
4091      return this;
4092    }
4093
4094    public boolean hasType() { 
4095      if (this.type == null)
4096        return false;
4097      for (CodeableConcept item : this.type)
4098        if (!item.isEmpty())
4099          return true;
4100      return false;
4101    }
4102
4103    public CodeableConcept addType() { //3
4104      CodeableConcept t = new CodeableConcept();
4105      if (this.type == null)
4106        this.type = new ArrayList<CodeableConcept>();
4107      this.type.add(t);
4108      return t;
4109    }
4110
4111    public Device addType(CodeableConcept t) { //3
4112      if (t == null)
4113        return this;
4114      if (this.type == null)
4115        this.type = new ArrayList<CodeableConcept>();
4116      this.type.add(t);
4117      return this;
4118    }
4119
4120    /**
4121     * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
4122     */
4123    public CodeableConcept getTypeFirstRep() { 
4124      if (getType().isEmpty()) {
4125        addType();
4126      }
4127      return getType().get(0);
4128    }
4129
4130    /**
4131     * @return {@link #version} (The actual design of the device or software version running on the device.)
4132     */
4133    public List<DeviceVersionComponent> getVersion() { 
4134      if (this.version == null)
4135        this.version = new ArrayList<DeviceVersionComponent>();
4136      return this.version;
4137    }
4138
4139    /**
4140     * @return Returns a reference to <code>this</code> for easy method chaining
4141     */
4142    public Device setVersion(List<DeviceVersionComponent> theVersion) { 
4143      this.version = theVersion;
4144      return this;
4145    }
4146
4147    public boolean hasVersion() { 
4148      if (this.version == null)
4149        return false;
4150      for (DeviceVersionComponent item : this.version)
4151        if (!item.isEmpty())
4152          return true;
4153      return false;
4154    }
4155
4156    public DeviceVersionComponent addVersion() { //3
4157      DeviceVersionComponent t = new DeviceVersionComponent();
4158      if (this.version == null)
4159        this.version = new ArrayList<DeviceVersionComponent>();
4160      this.version.add(t);
4161      return t;
4162    }
4163
4164    public Device addVersion(DeviceVersionComponent t) { //3
4165      if (t == null)
4166        return this;
4167      if (this.version == null)
4168        this.version = new ArrayList<DeviceVersionComponent>();
4169      this.version.add(t);
4170      return this;
4171    }
4172
4173    /**
4174     * @return The first repetition of repeating field {@link #version}, creating it if it does not already exist {3}
4175     */
4176    public DeviceVersionComponent getVersionFirstRep() { 
4177      if (getVersion().isEmpty()) {
4178        addVersion();
4179      }
4180      return getVersion().get(0);
4181    }
4182
4183    /**
4184     * @return {@link #specialization} (The standards to which the device adheres and may be certified to in support of its capabilities, e.g., communication, performance, process, or measurement standards.)
4185     */
4186    public List<DeviceSpecializationComponent> getSpecialization() { 
4187      if (this.specialization == null)
4188        this.specialization = new ArrayList<DeviceSpecializationComponent>();
4189      return this.specialization;
4190    }
4191
4192    /**
4193     * @return Returns a reference to <code>this</code> for easy method chaining
4194     */
4195    public Device setSpecialization(List<DeviceSpecializationComponent> theSpecialization) { 
4196      this.specialization = theSpecialization;
4197      return this;
4198    }
4199
4200    public boolean hasSpecialization() { 
4201      if (this.specialization == null)
4202        return false;
4203      for (DeviceSpecializationComponent item : this.specialization)
4204        if (!item.isEmpty())
4205          return true;
4206      return false;
4207    }
4208
4209    public DeviceSpecializationComponent addSpecialization() { //3
4210      DeviceSpecializationComponent t = new DeviceSpecializationComponent();
4211      if (this.specialization == null)
4212        this.specialization = new ArrayList<DeviceSpecializationComponent>();
4213      this.specialization.add(t);
4214      return t;
4215    }
4216
4217    public Device addSpecialization(DeviceSpecializationComponent t) { //3
4218      if (t == null)
4219        return this;
4220      if (this.specialization == null)
4221        this.specialization = new ArrayList<DeviceSpecializationComponent>();
4222      this.specialization.add(t);
4223      return this;
4224    }
4225
4226    /**
4227     * @return The first repetition of repeating field {@link #specialization}, creating it if it does not already exist {3}
4228     */
4229    public DeviceSpecializationComponent getSpecializationFirstRep() { 
4230      if (getSpecialization().isEmpty()) {
4231        addSpecialization();
4232      }
4233      return getSpecialization().get(0);
4234    }
4235
4236    /**
4237     * @return {@link #property} (Characteristics or features of the device that are otherwise not captured in available attributes, e.g., actual configuration settings, time or timing attributes, resolution, accuracy, and physical attributes.  The focus is on properties of the device actually in use while DeviceDefinition focuses on properties that are available to be used.)
4238     */
4239    public List<DevicePropertyComponent> getProperty() { 
4240      if (this.property == null)
4241        this.property = new ArrayList<DevicePropertyComponent>();
4242      return this.property;
4243    }
4244
4245    /**
4246     * @return Returns a reference to <code>this</code> for easy method chaining
4247     */
4248    public Device setProperty(List<DevicePropertyComponent> theProperty) { 
4249      this.property = theProperty;
4250      return this;
4251    }
4252
4253    public boolean hasProperty() { 
4254      if (this.property == null)
4255        return false;
4256      for (DevicePropertyComponent item : this.property)
4257        if (!item.isEmpty())
4258          return true;
4259      return false;
4260    }
4261
4262    public DevicePropertyComponent addProperty() { //3
4263      DevicePropertyComponent t = new DevicePropertyComponent();
4264      if (this.property == null)
4265        this.property = new ArrayList<DevicePropertyComponent>();
4266      this.property.add(t);
4267      return t;
4268    }
4269
4270    public Device addProperty(DevicePropertyComponent t) { //3
4271      if (t == null)
4272        return this;
4273      if (this.property == null)
4274        this.property = new ArrayList<DevicePropertyComponent>();
4275      this.property.add(t);
4276      return this;
4277    }
4278
4279    /**
4280     * @return The first repetition of repeating field {@link #property}, creating it if it does not already exist {3}
4281     */
4282    public DevicePropertyComponent getPropertyFirstRep() { 
4283      if (getProperty().isEmpty()) {
4284        addProperty();
4285      }
4286      return getProperty().get(0);
4287    }
4288
4289    /**
4290     * @return {@link #subject} (Patient information, if the device is affixed to, or associated to a patient for their specific use, irrespective of the procedure, use, observation, or other activity that the device is involved in. The use of Patient is also appropriate for the use of devices outside a healthcare setting, such as a fitness tracker.)
4291     */
4292    public Reference getSubject() { 
4293      if (this.subject == null)
4294        if (Configuration.errorOnAutoCreate())
4295          throw new Error("Attempt to auto-create Device.subject");
4296        else if (Configuration.doAutoCreate())
4297          this.subject = new Reference(); // cc
4298      return this.subject;
4299    }
4300
4301    public boolean hasSubject() { 
4302      return this.subject != null && !this.subject.isEmpty();
4303    }
4304
4305    /**
4306     * @param value {@link #subject} (Patient information, if the device is affixed to, or associated to a patient for their specific use, irrespective of the procedure, use, observation, or other activity that the device is involved in. The use of Patient is also appropriate for the use of devices outside a healthcare setting, such as a fitness tracker.)
4307     */
4308    public Device setSubject(Reference value) { 
4309      this.subject = value;
4310      return this;
4311    }
4312
4313    /**
4314     * @return {@link #operationalState} (The status of the device itself - whether it is switched on, or activated, etc.)
4315     */
4316    public List<DeviceOperationalStateComponent> getOperationalState() { 
4317      if (this.operationalState == null)
4318        this.operationalState = new ArrayList<DeviceOperationalStateComponent>();
4319      return this.operationalState;
4320    }
4321
4322    /**
4323     * @return Returns a reference to <code>this</code> for easy method chaining
4324     */
4325    public Device setOperationalState(List<DeviceOperationalStateComponent> theOperationalState) { 
4326      this.operationalState = theOperationalState;
4327      return this;
4328    }
4329
4330    public boolean hasOperationalState() { 
4331      if (this.operationalState == null)
4332        return false;
4333      for (DeviceOperationalStateComponent item : this.operationalState)
4334        if (!item.isEmpty())
4335          return true;
4336      return false;
4337    }
4338
4339    public DeviceOperationalStateComponent addOperationalState() { //3
4340      DeviceOperationalStateComponent t = new DeviceOperationalStateComponent();
4341      if (this.operationalState == null)
4342        this.operationalState = new ArrayList<DeviceOperationalStateComponent>();
4343      this.operationalState.add(t);
4344      return t;
4345    }
4346
4347    public Device addOperationalState(DeviceOperationalStateComponent t) { //3
4348      if (t == null)
4349        return this;
4350      if (this.operationalState == null)
4351        this.operationalState = new ArrayList<DeviceOperationalStateComponent>();
4352      this.operationalState.add(t);
4353      return this;
4354    }
4355
4356    /**
4357     * @return The first repetition of repeating field {@link #operationalState}, creating it if it does not already exist {3}
4358     */
4359    public DeviceOperationalStateComponent getOperationalStateFirstRep() { 
4360      if (getOperationalState().isEmpty()) {
4361        addOperationalState();
4362      }
4363      return getOperationalState().get(0);
4364    }
4365
4366    /**
4367     * @return {@link #association} (The details about the device when it is affixed or inside of a patient.)
4368     */
4369    public List<DeviceAssociationComponent> getAssociation() { 
4370      if (this.association == null)
4371        this.association = new ArrayList<DeviceAssociationComponent>();
4372      return this.association;
4373    }
4374
4375    /**
4376     * @return Returns a reference to <code>this</code> for easy method chaining
4377     */
4378    public Device setAssociation(List<DeviceAssociationComponent> theAssociation) { 
4379      this.association = theAssociation;
4380      return this;
4381    }
4382
4383    public boolean hasAssociation() { 
4384      if (this.association == null)
4385        return false;
4386      for (DeviceAssociationComponent item : this.association)
4387        if (!item.isEmpty())
4388          return true;
4389      return false;
4390    }
4391
4392    public DeviceAssociationComponent addAssociation() { //3
4393      DeviceAssociationComponent t = new DeviceAssociationComponent();
4394      if (this.association == null)
4395        this.association = new ArrayList<DeviceAssociationComponent>();
4396      this.association.add(t);
4397      return t;
4398    }
4399
4400    public Device addAssociation(DeviceAssociationComponent t) { //3
4401      if (t == null)
4402        return this;
4403      if (this.association == null)
4404        this.association = new ArrayList<DeviceAssociationComponent>();
4405      this.association.add(t);
4406      return this;
4407    }
4408
4409    /**
4410     * @return The first repetition of repeating field {@link #association}, creating it if it does not already exist {3}
4411     */
4412    public DeviceAssociationComponent getAssociationFirstRep() { 
4413      if (getAssociation().isEmpty()) {
4414        addAssociation();
4415      }
4416      return getAssociation().get(0);
4417    }
4418
4419    /**
4420     * @return {@link #owner} (An organization that is responsible for the provision and ongoing maintenance of the device.)
4421     */
4422    public Reference getOwner() { 
4423      if (this.owner == null)
4424        if (Configuration.errorOnAutoCreate())
4425          throw new Error("Attempt to auto-create Device.owner");
4426        else if (Configuration.doAutoCreate())
4427          this.owner = new Reference(); // cc
4428      return this.owner;
4429    }
4430
4431    public boolean hasOwner() { 
4432      return this.owner != null && !this.owner.isEmpty();
4433    }
4434
4435    /**
4436     * @param value {@link #owner} (An organization that is responsible for the provision and ongoing maintenance of the device.)
4437     */
4438    public Device setOwner(Reference value) { 
4439      this.owner = value;
4440      return this;
4441    }
4442
4443    /**
4444     * @return {@link #contact} (Contact details for an organization or a particular human that is responsible for the device.)
4445     */
4446    public List<ContactPoint> getContact() { 
4447      if (this.contact == null)
4448        this.contact = new ArrayList<ContactPoint>();
4449      return this.contact;
4450    }
4451
4452    /**
4453     * @return Returns a reference to <code>this</code> for easy method chaining
4454     */
4455    public Device setContact(List<ContactPoint> theContact) { 
4456      this.contact = theContact;
4457      return this;
4458    }
4459
4460    public boolean hasContact() { 
4461      if (this.contact == null)
4462        return false;
4463      for (ContactPoint item : this.contact)
4464        if (!item.isEmpty())
4465          return true;
4466      return false;
4467    }
4468
4469    public ContactPoint addContact() { //3
4470      ContactPoint t = new ContactPoint();
4471      if (this.contact == null)
4472        this.contact = new ArrayList<ContactPoint>();
4473      this.contact.add(t);
4474      return t;
4475    }
4476
4477    public Device addContact(ContactPoint t) { //3
4478      if (t == null)
4479        return this;
4480      if (this.contact == null)
4481        this.contact = new ArrayList<ContactPoint>();
4482      this.contact.add(t);
4483      return this;
4484    }
4485
4486    /**
4487     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist {3}
4488     */
4489    public ContactPoint getContactFirstRep() { 
4490      if (getContact().isEmpty()) {
4491        addContact();
4492      }
4493      return getContact().get(0);
4494    }
4495
4496    /**
4497     * @return {@link #location} (The place where the device can be found.)
4498     */
4499    public Reference getLocation() { 
4500      if (this.location == null)
4501        if (Configuration.errorOnAutoCreate())
4502          throw new Error("Attempt to auto-create Device.location");
4503        else if (Configuration.doAutoCreate())
4504          this.location = new Reference(); // cc
4505      return this.location;
4506    }
4507
4508    public boolean hasLocation() { 
4509      return this.location != null && !this.location.isEmpty();
4510    }
4511
4512    /**
4513     * @param value {@link #location} (The place where the device can be found.)
4514     */
4515    public Device setLocation(Reference value) { 
4516      this.location = value;
4517      return this;
4518    }
4519
4520    /**
4521     * @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
4522     */
4523    public UriType getUrlElement() { 
4524      if (this.url == null)
4525        if (Configuration.errorOnAutoCreate())
4526          throw new Error("Attempt to auto-create Device.url");
4527        else if (Configuration.doAutoCreate())
4528          this.url = new UriType(); // bb
4529      return this.url;
4530    }
4531
4532    public boolean hasUrlElement() { 
4533      return this.url != null && !this.url.isEmpty();
4534    }
4535
4536    public boolean hasUrl() { 
4537      return this.url != null && !this.url.isEmpty();
4538    }
4539
4540    /**
4541     * @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
4542     */
4543    public Device setUrlElement(UriType value) { 
4544      this.url = value;
4545      return this;
4546    }
4547
4548    /**
4549     * @return A network address on which the device may be contacted directly.
4550     */
4551    public String getUrl() { 
4552      return this.url == null ? null : this.url.getValue();
4553    }
4554
4555    /**
4556     * @param value A network address on which the device may be contacted directly.
4557     */
4558    public Device setUrl(String value) { 
4559      if (Utilities.noString(value))
4560        this.url = null;
4561      else {
4562        if (this.url == null)
4563          this.url = new UriType();
4564        this.url.setValue(value);
4565      }
4566      return this;
4567    }
4568
4569    /**
4570     * @return {@link #endpoint} (Technical endpoints providing access to services provided by the device defined at this resource.)
4571     */
4572    public List<Reference> getEndpoint() { 
4573      if (this.endpoint == null)
4574        this.endpoint = new ArrayList<Reference>();
4575      return this.endpoint;
4576    }
4577
4578    /**
4579     * @return Returns a reference to <code>this</code> for easy method chaining
4580     */
4581    public Device setEndpoint(List<Reference> theEndpoint) { 
4582      this.endpoint = theEndpoint;
4583      return this;
4584    }
4585
4586    public boolean hasEndpoint() { 
4587      if (this.endpoint == null)
4588        return false;
4589      for (Reference item : this.endpoint)
4590        if (!item.isEmpty())
4591          return true;
4592      return false;
4593    }
4594
4595    public Reference addEndpoint() { //3
4596      Reference t = new Reference();
4597      if (this.endpoint == null)
4598        this.endpoint = new ArrayList<Reference>();
4599      this.endpoint.add(t);
4600      return t;
4601    }
4602
4603    public Device addEndpoint(Reference t) { //3
4604      if (t == null)
4605        return this;
4606      if (this.endpoint == null)
4607        this.endpoint = new ArrayList<Reference>();
4608      this.endpoint.add(t);
4609      return this;
4610    }
4611
4612    /**
4613     * @return The first repetition of repeating field {@link #endpoint}, creating it if it does not already exist {3}
4614     */
4615    public Reference getEndpointFirstRep() { 
4616      if (getEndpoint().isEmpty()) {
4617        addEndpoint();
4618      }
4619      return getEndpoint().get(0);
4620    }
4621
4622    /**
4623     * @return {@link #link} (An associated device, attached to, used with, communicating with or linking a previous or new device model to the focal device.)
4624     */
4625    public List<DeviceLinkComponent> getLink() { 
4626      if (this.link == null)
4627        this.link = new ArrayList<DeviceLinkComponent>();
4628      return this.link;
4629    }
4630
4631    /**
4632     * @return Returns a reference to <code>this</code> for easy method chaining
4633     */
4634    public Device setLink(List<DeviceLinkComponent> theLink) { 
4635      this.link = theLink;
4636      return this;
4637    }
4638
4639    public boolean hasLink() { 
4640      if (this.link == null)
4641        return false;
4642      for (DeviceLinkComponent item : this.link)
4643        if (!item.isEmpty())
4644          return true;
4645      return false;
4646    }
4647
4648    public DeviceLinkComponent addLink() { //3
4649      DeviceLinkComponent t = new DeviceLinkComponent();
4650      if (this.link == null)
4651        this.link = new ArrayList<DeviceLinkComponent>();
4652      this.link.add(t);
4653      return t;
4654    }
4655
4656    public Device addLink(DeviceLinkComponent t) { //3
4657      if (t == null)
4658        return this;
4659      if (this.link == null)
4660        this.link = new ArrayList<DeviceLinkComponent>();
4661      this.link.add(t);
4662      return this;
4663    }
4664
4665    /**
4666     * @return The first repetition of repeating field {@link #link}, creating it if it does not already exist {3}
4667     */
4668    public DeviceLinkComponent getLinkFirstRep() { 
4669      if (getLink().isEmpty()) {
4670        addLink();
4671      }
4672      return getLink().get(0);
4673    }
4674
4675    /**
4676     * @return {@link #note} (Descriptive information, usage information or implantation information that is not captured in an existing element.)
4677     */
4678    public List<Annotation> getNote() { 
4679      if (this.note == null)
4680        this.note = new ArrayList<Annotation>();
4681      return this.note;
4682    }
4683
4684    /**
4685     * @return Returns a reference to <code>this</code> for easy method chaining
4686     */
4687    public Device setNote(List<Annotation> theNote) { 
4688      this.note = theNote;
4689      return this;
4690    }
4691
4692    public boolean hasNote() { 
4693      if (this.note == null)
4694        return false;
4695      for (Annotation item : this.note)
4696        if (!item.isEmpty())
4697          return true;
4698      return false;
4699    }
4700
4701    public Annotation addNote() { //3
4702      Annotation t = new Annotation();
4703      if (this.note == null)
4704        this.note = new ArrayList<Annotation>();
4705      this.note.add(t);
4706      return t;
4707    }
4708
4709    public Device addNote(Annotation t) { //3
4710      if (t == null)
4711        return this;
4712      if (this.note == null)
4713        this.note = new ArrayList<Annotation>();
4714      this.note.add(t);
4715      return this;
4716    }
4717
4718    /**
4719     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
4720     */
4721    public Annotation getNoteFirstRep() { 
4722      if (getNote().isEmpty()) {
4723        addNote();
4724      }
4725      return getNote().get(0);
4726    }
4727
4728    /**
4729     * @return {@link #safety} (Provides additional safety characteristics about a medical device.  For example devices containing latex.)
4730     */
4731    public List<CodeableConcept> getSafety() { 
4732      if (this.safety == null)
4733        this.safety = new ArrayList<CodeableConcept>();
4734      return this.safety;
4735    }
4736
4737    /**
4738     * @return Returns a reference to <code>this</code> for easy method chaining
4739     */
4740    public Device setSafety(List<CodeableConcept> theSafety) { 
4741      this.safety = theSafety;
4742      return this;
4743    }
4744
4745    public boolean hasSafety() { 
4746      if (this.safety == null)
4747        return false;
4748      for (CodeableConcept item : this.safety)
4749        if (!item.isEmpty())
4750          return true;
4751      return false;
4752    }
4753
4754    public CodeableConcept addSafety() { //3
4755      CodeableConcept t = new CodeableConcept();
4756      if (this.safety == null)
4757        this.safety = new ArrayList<CodeableConcept>();
4758      this.safety.add(t);
4759      return t;
4760    }
4761
4762    public Device addSafety(CodeableConcept t) { //3
4763      if (t == null)
4764        return this;
4765      if (this.safety == null)
4766        this.safety = new ArrayList<CodeableConcept>();
4767      this.safety.add(t);
4768      return this;
4769    }
4770
4771    /**
4772     * @return The first repetition of repeating field {@link #safety}, creating it if it does not already exist {3}
4773     */
4774    public CodeableConcept getSafetyFirstRep() { 
4775      if (getSafety().isEmpty()) {
4776        addSafety();
4777      }
4778      return getSafety().get(0);
4779    }
4780
4781    /**
4782     * @return {@link #parent} (The higher level or encompassing device that this device is a logical part of.)
4783     */
4784    public Reference getParent() { 
4785      if (this.parent == null)
4786        if (Configuration.errorOnAutoCreate())
4787          throw new Error("Attempt to auto-create Device.parent");
4788        else if (Configuration.doAutoCreate())
4789          this.parent = new Reference(); // cc
4790      return this.parent;
4791    }
4792
4793    public boolean hasParent() { 
4794      return this.parent != null && !this.parent.isEmpty();
4795    }
4796
4797    /**
4798     * @param value {@link #parent} (The higher level or encompassing device that this device is a logical part of.)
4799     */
4800    public Device setParent(Reference value) { 
4801      this.parent = value;
4802      return this;
4803    }
4804
4805      protected void listChildren(List<Property> children) {
4806        super.listChildren(children);
4807        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));
4808        children.add(new Property("displayName", "string", "The name used to display by default when the device is referenced. Based on intent of use by the resource creator, this may reflect one of the names in Device.deviceName, or may be another simple name.", 0, 1, displayName));
4809        children.add(new Property("definition", "CodeableReference(DeviceDefinition)", "The reference to the definition for the device.", 0, 1, definition));
4810        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));
4811        children.add(new Property("status", "code", "Status of the Device record. This is not the status of the device like availability.", 0, 1, status));
4812        children.add(new Property("statusReason", "CodeableConcept", "Reason for the status of the Device record. For example, why is the record not active.", 0, java.lang.Integer.MAX_VALUE, statusReason));
4813        children.add(new Property("biologicalSourceEvent", "Identifier", "An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled.", 0, 1, biologicalSourceEvent));
4814        children.add(new Property("manufacturer", "string", "A name of the manufacturer or entity legally responsible for the device.", 0, 1, manufacturer));
4815        children.add(new Property("manufactureDate", "dateTime", "The date and time when the device was manufactured.", 0, 1, manufactureDate));
4816        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));
4817        children.add(new Property("lotNumber", "string", "Lot number assigned by the manufacturer.", 0, 1, lotNumber));
4818        children.add(new Property("serialNumber", "string", "The serial number assigned by the organization when the device was manufactured.", 0, 1, serialNumber));
4819        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));
4820        children.add(new Property("modelNumber", "string", "The manufacturer's model number for the device.", 0, 1, modelNumber));
4821        children.add(new Property("partNumber", "string", "The part number or catalog number of the device.", 0, 1, partNumber));
4822        children.add(new Property("type", "CodeableConcept", "The kind or type of device. A device instance may have more than one type - in which case those are the types that apply to the specific instance of the device.", 0, java.lang.Integer.MAX_VALUE, type));
4823        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));
4824        children.add(new Property("specialization", "", "The standards to which the device adheres and may be certified to in support of its capabilities, e.g., communication, performance, process, or measurement standards.", 0, java.lang.Integer.MAX_VALUE, specialization));
4825        children.add(new Property("property", "", "Characteristics or features of the device that are otherwise not captured in available attributes, e.g., actual configuration settings, time or timing attributes, resolution, accuracy, and physical attributes.  The focus is on properties of the device actually in use while DeviceDefinition focuses on properties that are available to be used.", 0, java.lang.Integer.MAX_VALUE, property));
4826        children.add(new Property("subject", "Reference(Patient|Practitioner)", "Patient information, if the device is affixed to, or associated to a patient for their specific use, irrespective of the procedure, use, observation, or other activity that the device is involved in. The use of Patient is also appropriate for the use of devices outside a healthcare setting, such as a fitness tracker.", 0, 1, subject));
4827        children.add(new Property("operationalState", "", "The status of the device itself - whether it is switched on, or activated, etc.", 0, java.lang.Integer.MAX_VALUE, operationalState));
4828        children.add(new Property("association", "", "The details about the device when it is affixed or inside of a patient.", 0, java.lang.Integer.MAX_VALUE, association));
4829        children.add(new Property("owner", "Reference(Organization)", "An organization that is responsible for the provision and ongoing maintenance of the device.", 0, 1, owner));
4830        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));
4831        children.add(new Property("location", "Reference(Location)", "The place where the device can be found.", 0, 1, location));
4832        children.add(new Property("url", "uri", "A network address on which the device may be contacted directly.", 0, 1, url));
4833        children.add(new Property("endpoint", "Reference(Endpoint)", "Technical endpoints providing access to services provided by the device defined at this resource.", 0, java.lang.Integer.MAX_VALUE, endpoint));
4834        children.add(new Property("link", "", "An associated device, attached to, used with, communicating with or linking a previous or new device model to the focal device.", 0, java.lang.Integer.MAX_VALUE, link));
4835        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));
4836        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));
4837        children.add(new Property("parent", "Reference(Device)", "The higher level or encompassing device that this device is a logical part of.", 0, 1, parent));
4838      }
4839
4840      @Override
4841      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4842        switch (_hash) {
4843        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);
4844        case 1714148973: /*displayName*/  return new Property("displayName", "string", "The name used to display by default when the device is referenced. Based on intent of use by the resource creator, this may reflect one of the names in Device.deviceName, or may be another simple name.", 0, 1, displayName);
4845        case -1014418093: /*definition*/  return new Property("definition", "CodeableReference(DeviceDefinition)", "The reference to the definition for the device.", 0, 1, definition);
4846        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);
4847        case -892481550: /*status*/  return new Property("status", "code", "Status of the Device record. This is not the status of the device like availability.", 0, 1, status);
4848        case 2051346646: /*statusReason*/  return new Property("statusReason", "CodeableConcept", "Reason for the status of the Device record. For example, why is the record not active.", 0, java.lang.Integer.MAX_VALUE, statusReason);
4849        case -654468482: /*biologicalSourceEvent*/  return new Property("biologicalSourceEvent", "Identifier", "An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled.", 0, 1, biologicalSourceEvent);
4850        case -1969347631: /*manufacturer*/  return new Property("manufacturer", "string", "A name of the manufacturer or entity legally responsible for the device.", 0, 1, manufacturer);
4851        case 416714767: /*manufactureDate*/  return new Property("manufactureDate", "dateTime", "The date and time when the device was manufactured.", 0, 1, manufactureDate);
4852        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);
4853        case 462547450: /*lotNumber*/  return new Property("lotNumber", "string", "Lot number assigned by the manufacturer.", 0, 1, lotNumber);
4854        case 83787357: /*serialNumber*/  return new Property("serialNumber", "string", "The serial number assigned by the organization when the device was manufactured.", 0, 1, serialNumber);
4855        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);
4856        case 346619858: /*modelNumber*/  return new Property("modelNumber", "string", "The manufacturer's model number for the device.", 0, 1, modelNumber);
4857        case -731502308: /*partNumber*/  return new Property("partNumber", "string", "The part number or catalog number of the device.", 0, 1, partNumber);
4858        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The kind or type of device. A device instance may have more than one type - in which case those are the types that apply to the specific instance of the device.", 0, java.lang.Integer.MAX_VALUE, type);
4859        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);
4860        case 682815883: /*specialization*/  return new Property("specialization", "", "The standards to which the device adheres and may be certified to in support of its capabilities, e.g., communication, performance, process, or measurement standards.", 0, java.lang.Integer.MAX_VALUE, specialization);
4861        case -993141291: /*property*/  return new Property("property", "", "Characteristics or features of the device that are otherwise not captured in available attributes, e.g., actual configuration settings, time or timing attributes, resolution, accuracy, and physical attributes.  The focus is on properties of the device actually in use while DeviceDefinition focuses on properties that are available to be used.", 0, java.lang.Integer.MAX_VALUE, property);
4862        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Practitioner)", "Patient information, if the device is affixed to, or associated to a patient for their specific use, irrespective of the procedure, use, observation, or other activity that the device is involved in. The use of Patient is also appropriate for the use of devices outside a healthcare setting, such as a fitness tracker.", 0, 1, subject);
4863        case -1176222753: /*operationalState*/  return new Property("operationalState", "", "The status of the device itself - whether it is switched on, or activated, etc.", 0, java.lang.Integer.MAX_VALUE, operationalState);
4864        case -87499647: /*association*/  return new Property("association", "", "The details about the device when it is affixed or inside of a patient.", 0, java.lang.Integer.MAX_VALUE, association);
4865        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);
4866        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);
4867        case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "The place where the device can be found.", 0, 1, location);
4868        case 116079: /*url*/  return new Property("url", "uri", "A network address on which the device may be contacted directly.", 0, 1, url);
4869        case 1741102485: /*endpoint*/  return new Property("endpoint", "Reference(Endpoint)", "Technical endpoints providing access to services provided by the device defined at this resource.", 0, java.lang.Integer.MAX_VALUE, endpoint);
4870        case 3321850: /*link*/  return new Property("link", "", "An associated device, attached to, used with, communicating with or linking a previous or new device model to the focal device.", 0, java.lang.Integer.MAX_VALUE, link);
4871        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);
4872        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);
4873        case -995424086: /*parent*/  return new Property("parent", "Reference(Device)", "The higher level or encompassing device that this device is a logical part of.", 0, 1, parent);
4874        default: return super.getNamedProperty(_hash, _name, _checkValid);
4875        }
4876
4877      }
4878
4879      @Override
4880      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4881        switch (hash) {
4882        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
4883        case 1714148973: /*displayName*/ return this.displayName == null ? new Base[0] : new Base[] {this.displayName}; // StringType
4884        case -1014418093: /*definition*/ return this.definition == null ? new Base[0] : new Base[] {this.definition}; // CodeableReference
4885        case -1343558178: /*udiCarrier*/ return this.udiCarrier == null ? new Base[0] : this.udiCarrier.toArray(new Base[this.udiCarrier.size()]); // DeviceUdiCarrierComponent
4886        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<FHIRDeviceStatus>
4887        case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : this.statusReason.toArray(new Base[this.statusReason.size()]); // CodeableConcept
4888        case -654468482: /*biologicalSourceEvent*/ return this.biologicalSourceEvent == null ? new Base[0] : new Base[] {this.biologicalSourceEvent}; // Identifier
4889        case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : new Base[] {this.manufacturer}; // StringType
4890        case 416714767: /*manufactureDate*/ return this.manufactureDate == null ? new Base[0] : new Base[] {this.manufactureDate}; // DateTimeType
4891        case -668811523: /*expirationDate*/ return this.expirationDate == null ? new Base[0] : new Base[] {this.expirationDate}; // DateTimeType
4892        case 462547450: /*lotNumber*/ return this.lotNumber == null ? new Base[0] : new Base[] {this.lotNumber}; // StringType
4893        case 83787357: /*serialNumber*/ return this.serialNumber == null ? new Base[0] : new Base[] {this.serialNumber}; // StringType
4894        case 780988929: /*deviceName*/ return this.deviceName == null ? new Base[0] : this.deviceName.toArray(new Base[this.deviceName.size()]); // DeviceDeviceNameComponent
4895        case 346619858: /*modelNumber*/ return this.modelNumber == null ? new Base[0] : new Base[] {this.modelNumber}; // StringType
4896        case -731502308: /*partNumber*/ return this.partNumber == null ? new Base[0] : new Base[] {this.partNumber}; // StringType
4897        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
4898        case 351608024: /*version*/ return this.version == null ? new Base[0] : this.version.toArray(new Base[this.version.size()]); // DeviceVersionComponent
4899        case 682815883: /*specialization*/ return this.specialization == null ? new Base[0] : this.specialization.toArray(new Base[this.specialization.size()]); // DeviceSpecializationComponent
4900        case -993141291: /*property*/ return this.property == null ? new Base[0] : this.property.toArray(new Base[this.property.size()]); // DevicePropertyComponent
4901        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
4902        case -1176222753: /*operationalState*/ return this.operationalState == null ? new Base[0] : this.operationalState.toArray(new Base[this.operationalState.size()]); // DeviceOperationalStateComponent
4903        case -87499647: /*association*/ return this.association == null ? new Base[0] : this.association.toArray(new Base[this.association.size()]); // DeviceAssociationComponent
4904        case 106164915: /*owner*/ return this.owner == null ? new Base[0] : new Base[] {this.owner}; // Reference
4905        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactPoint
4906        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
4907        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
4908        case 1741102485: /*endpoint*/ return this.endpoint == null ? new Base[0] : this.endpoint.toArray(new Base[this.endpoint.size()]); // Reference
4909        case 3321850: /*link*/ return this.link == null ? new Base[0] : this.link.toArray(new Base[this.link.size()]); // DeviceLinkComponent
4910        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
4911        case -909893934: /*safety*/ return this.safety == null ? new Base[0] : this.safety.toArray(new Base[this.safety.size()]); // CodeableConcept
4912        case -995424086: /*parent*/ return this.parent == null ? new Base[0] : new Base[] {this.parent}; // Reference
4913        default: return super.getProperty(hash, name, checkValid);
4914        }
4915
4916      }
4917
4918      @Override
4919      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4920        switch (hash) {
4921        case -1618432855: // identifier
4922          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
4923          return value;
4924        case 1714148973: // displayName
4925          this.displayName = TypeConvertor.castToString(value); // StringType
4926          return value;
4927        case -1014418093: // definition
4928          this.definition = TypeConvertor.castToCodeableReference(value); // CodeableReference
4929          return value;
4930        case -1343558178: // udiCarrier
4931          this.getUdiCarrier().add((DeviceUdiCarrierComponent) value); // DeviceUdiCarrierComponent
4932          return value;
4933        case -892481550: // status
4934          value = new FHIRDeviceStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
4935          this.status = (Enumeration) value; // Enumeration<FHIRDeviceStatus>
4936          return value;
4937        case 2051346646: // statusReason
4938          this.getStatusReason().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4939          return value;
4940        case -654468482: // biologicalSourceEvent
4941          this.biologicalSourceEvent = TypeConvertor.castToIdentifier(value); // Identifier
4942          return value;
4943        case -1969347631: // manufacturer
4944          this.manufacturer = TypeConvertor.castToString(value); // StringType
4945          return value;
4946        case 416714767: // manufactureDate
4947          this.manufactureDate = TypeConvertor.castToDateTime(value); // DateTimeType
4948          return value;
4949        case -668811523: // expirationDate
4950          this.expirationDate = TypeConvertor.castToDateTime(value); // DateTimeType
4951          return value;
4952        case 462547450: // lotNumber
4953          this.lotNumber = TypeConvertor.castToString(value); // StringType
4954          return value;
4955        case 83787357: // serialNumber
4956          this.serialNumber = TypeConvertor.castToString(value); // StringType
4957          return value;
4958        case 780988929: // deviceName
4959          this.getDeviceName().add((DeviceDeviceNameComponent) value); // DeviceDeviceNameComponent
4960          return value;
4961        case 346619858: // modelNumber
4962          this.modelNumber = TypeConvertor.castToString(value); // StringType
4963          return value;
4964        case -731502308: // partNumber
4965          this.partNumber = TypeConvertor.castToString(value); // StringType
4966          return value;
4967        case 3575610: // type
4968          this.getType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4969          return value;
4970        case 351608024: // version
4971          this.getVersion().add((DeviceVersionComponent) value); // DeviceVersionComponent
4972          return value;
4973        case 682815883: // specialization
4974          this.getSpecialization().add((DeviceSpecializationComponent) value); // DeviceSpecializationComponent
4975          return value;
4976        case -993141291: // property
4977          this.getProperty().add((DevicePropertyComponent) value); // DevicePropertyComponent
4978          return value;
4979        case -1867885268: // subject
4980          this.subject = TypeConvertor.castToReference(value); // Reference
4981          return value;
4982        case -1176222753: // operationalState
4983          this.getOperationalState().add((DeviceOperationalStateComponent) value); // DeviceOperationalStateComponent
4984          return value;
4985        case -87499647: // association
4986          this.getAssociation().add((DeviceAssociationComponent) value); // DeviceAssociationComponent
4987          return value;
4988        case 106164915: // owner
4989          this.owner = TypeConvertor.castToReference(value); // Reference
4990          return value;
4991        case 951526432: // contact
4992          this.getContact().add(TypeConvertor.castToContactPoint(value)); // ContactPoint
4993          return value;
4994        case 1901043637: // location
4995          this.location = TypeConvertor.castToReference(value); // Reference
4996          return value;
4997        case 116079: // url
4998          this.url = TypeConvertor.castToUri(value); // UriType
4999          return value;
5000        case 1741102485: // endpoint
5001          this.getEndpoint().add(TypeConvertor.castToReference(value)); // Reference
5002          return value;
5003        case 3321850: // link
5004          this.getLink().add((DeviceLinkComponent) value); // DeviceLinkComponent
5005          return value;
5006        case 3387378: // note
5007          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
5008          return value;
5009        case -909893934: // safety
5010          this.getSafety().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
5011          return value;
5012        case -995424086: // parent
5013          this.parent = TypeConvertor.castToReference(value); // Reference
5014          return value;
5015        default: return super.setProperty(hash, name, value);
5016        }
5017
5018      }
5019
5020      @Override
5021      public Base setProperty(String name, Base value) throws FHIRException {
5022        if (name.equals("identifier")) {
5023          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
5024        } else if (name.equals("displayName")) {
5025          this.displayName = TypeConvertor.castToString(value); // StringType
5026        } else if (name.equals("definition")) {
5027          this.definition = TypeConvertor.castToCodeableReference(value); // CodeableReference
5028        } else if (name.equals("udiCarrier")) {
5029          this.getUdiCarrier().add((DeviceUdiCarrierComponent) value);
5030        } else if (name.equals("status")) {
5031          value = new FHIRDeviceStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
5032          this.status = (Enumeration) value; // Enumeration<FHIRDeviceStatus>
5033        } else if (name.equals("statusReason")) {
5034          this.getStatusReason().add(TypeConvertor.castToCodeableConcept(value));
5035        } else if (name.equals("biologicalSourceEvent")) {
5036          this.biologicalSourceEvent = TypeConvertor.castToIdentifier(value); // Identifier
5037        } else if (name.equals("manufacturer")) {
5038          this.manufacturer = TypeConvertor.castToString(value); // StringType
5039        } else if (name.equals("manufactureDate")) {
5040          this.manufactureDate = TypeConvertor.castToDateTime(value); // DateTimeType
5041        } else if (name.equals("expirationDate")) {
5042          this.expirationDate = TypeConvertor.castToDateTime(value); // DateTimeType
5043        } else if (name.equals("lotNumber")) {
5044          this.lotNumber = TypeConvertor.castToString(value); // StringType
5045        } else if (name.equals("serialNumber")) {
5046          this.serialNumber = TypeConvertor.castToString(value); // StringType
5047        } else if (name.equals("deviceName")) {
5048          this.getDeviceName().add((DeviceDeviceNameComponent) value);
5049        } else if (name.equals("modelNumber")) {
5050          this.modelNumber = TypeConvertor.castToString(value); // StringType
5051        } else if (name.equals("partNumber")) {
5052          this.partNumber = TypeConvertor.castToString(value); // StringType
5053        } else if (name.equals("type")) {
5054          this.getType().add(TypeConvertor.castToCodeableConcept(value));
5055        } else if (name.equals("version")) {
5056          this.getVersion().add((DeviceVersionComponent) value);
5057        } else if (name.equals("specialization")) {
5058          this.getSpecialization().add((DeviceSpecializationComponent) value);
5059        } else if (name.equals("property")) {
5060          this.getProperty().add((DevicePropertyComponent) value);
5061        } else if (name.equals("subject")) {
5062          this.subject = TypeConvertor.castToReference(value); // Reference
5063        } else if (name.equals("operationalState")) {
5064          this.getOperationalState().add((DeviceOperationalStateComponent) value);
5065        } else if (name.equals("association")) {
5066          this.getAssociation().add((DeviceAssociationComponent) value);
5067        } else if (name.equals("owner")) {
5068          this.owner = TypeConvertor.castToReference(value); // Reference
5069        } else if (name.equals("contact")) {
5070          this.getContact().add(TypeConvertor.castToContactPoint(value));
5071        } else if (name.equals("location")) {
5072          this.location = TypeConvertor.castToReference(value); // Reference
5073        } else if (name.equals("url")) {
5074          this.url = TypeConvertor.castToUri(value); // UriType
5075        } else if (name.equals("endpoint")) {
5076          this.getEndpoint().add(TypeConvertor.castToReference(value));
5077        } else if (name.equals("link")) {
5078          this.getLink().add((DeviceLinkComponent) value);
5079        } else if (name.equals("note")) {
5080          this.getNote().add(TypeConvertor.castToAnnotation(value));
5081        } else if (name.equals("safety")) {
5082          this.getSafety().add(TypeConvertor.castToCodeableConcept(value));
5083        } else if (name.equals("parent")) {
5084          this.parent = TypeConvertor.castToReference(value); // Reference
5085        } else
5086          return super.setProperty(name, value);
5087        return value;
5088      }
5089
5090      @Override
5091      public Base makeProperty(int hash, String name) throws FHIRException {
5092        switch (hash) {
5093        case -1618432855:  return addIdentifier(); 
5094        case 1714148973:  return getDisplayNameElement();
5095        case -1014418093:  return getDefinition();
5096        case -1343558178:  return addUdiCarrier(); 
5097        case -892481550:  return getStatusElement();
5098        case 2051346646:  return addStatusReason(); 
5099        case -654468482:  return getBiologicalSourceEvent();
5100        case -1969347631:  return getManufacturerElement();
5101        case 416714767:  return getManufactureDateElement();
5102        case -668811523:  return getExpirationDateElement();
5103        case 462547450:  return getLotNumberElement();
5104        case 83787357:  return getSerialNumberElement();
5105        case 780988929:  return addDeviceName(); 
5106        case 346619858:  return getModelNumberElement();
5107        case -731502308:  return getPartNumberElement();
5108        case 3575610:  return addType(); 
5109        case 351608024:  return addVersion(); 
5110        case 682815883:  return addSpecialization(); 
5111        case -993141291:  return addProperty(); 
5112        case -1867885268:  return getSubject();
5113        case -1176222753:  return addOperationalState(); 
5114        case -87499647:  return addAssociation(); 
5115        case 106164915:  return getOwner();
5116        case 951526432:  return addContact(); 
5117        case 1901043637:  return getLocation();
5118        case 116079:  return getUrlElement();
5119        case 1741102485:  return addEndpoint(); 
5120        case 3321850:  return addLink(); 
5121        case 3387378:  return addNote(); 
5122        case -909893934:  return addSafety(); 
5123        case -995424086:  return getParent();
5124        default: return super.makeProperty(hash, name);
5125        }
5126
5127      }
5128
5129      @Override
5130      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5131        switch (hash) {
5132        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
5133        case 1714148973: /*displayName*/ return new String[] {"string"};
5134        case -1014418093: /*definition*/ return new String[] {"CodeableReference"};
5135        case -1343558178: /*udiCarrier*/ return new String[] {};
5136        case -892481550: /*status*/ return new String[] {"code"};
5137        case 2051346646: /*statusReason*/ return new String[] {"CodeableConcept"};
5138        case -654468482: /*biologicalSourceEvent*/ return new String[] {"Identifier"};
5139        case -1969347631: /*manufacturer*/ return new String[] {"string"};
5140        case 416714767: /*manufactureDate*/ return new String[] {"dateTime"};
5141        case -668811523: /*expirationDate*/ return new String[] {"dateTime"};
5142        case 462547450: /*lotNumber*/ return new String[] {"string"};
5143        case 83787357: /*serialNumber*/ return new String[] {"string"};
5144        case 780988929: /*deviceName*/ return new String[] {};
5145        case 346619858: /*modelNumber*/ return new String[] {"string"};
5146        case -731502308: /*partNumber*/ return new String[] {"string"};
5147        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
5148        case 351608024: /*version*/ return new String[] {};
5149        case 682815883: /*specialization*/ return new String[] {};
5150        case -993141291: /*property*/ return new String[] {};
5151        case -1867885268: /*subject*/ return new String[] {"Reference"};
5152        case -1176222753: /*operationalState*/ return new String[] {};
5153        case -87499647: /*association*/ return new String[] {};
5154        case 106164915: /*owner*/ return new String[] {"Reference"};
5155        case 951526432: /*contact*/ return new String[] {"ContactPoint"};
5156        case 1901043637: /*location*/ return new String[] {"Reference"};
5157        case 116079: /*url*/ return new String[] {"uri"};
5158        case 1741102485: /*endpoint*/ return new String[] {"Reference"};
5159        case 3321850: /*link*/ return new String[] {};
5160        case 3387378: /*note*/ return new String[] {"Annotation"};
5161        case -909893934: /*safety*/ return new String[] {"CodeableConcept"};
5162        case -995424086: /*parent*/ return new String[] {"Reference"};
5163        default: return super.getTypesForProperty(hash, name);
5164        }
5165
5166      }
5167
5168      @Override
5169      public Base addChild(String name) throws FHIRException {
5170        if (name.equals("identifier")) {
5171          return addIdentifier();
5172        }
5173        else if (name.equals("displayName")) {
5174          throw new FHIRException("Cannot call addChild on a primitive type Device.displayName");
5175        }
5176        else if (name.equals("definition")) {
5177          this.definition = new CodeableReference();
5178          return this.definition;
5179        }
5180        else if (name.equals("udiCarrier")) {
5181          return addUdiCarrier();
5182        }
5183        else if (name.equals("status")) {
5184          throw new FHIRException("Cannot call addChild on a primitive type Device.status");
5185        }
5186        else if (name.equals("statusReason")) {
5187          return addStatusReason();
5188        }
5189        else if (name.equals("biologicalSourceEvent")) {
5190          this.biologicalSourceEvent = new Identifier();
5191          return this.biologicalSourceEvent;
5192        }
5193        else if (name.equals("manufacturer")) {
5194          throw new FHIRException("Cannot call addChild on a primitive type Device.manufacturer");
5195        }
5196        else if (name.equals("manufactureDate")) {
5197          throw new FHIRException("Cannot call addChild on a primitive type Device.manufactureDate");
5198        }
5199        else if (name.equals("expirationDate")) {
5200          throw new FHIRException("Cannot call addChild on a primitive type Device.expirationDate");
5201        }
5202        else if (name.equals("lotNumber")) {
5203          throw new FHIRException("Cannot call addChild on a primitive type Device.lotNumber");
5204        }
5205        else if (name.equals("serialNumber")) {
5206          throw new FHIRException("Cannot call addChild on a primitive type Device.serialNumber");
5207        }
5208        else if (name.equals("deviceName")) {
5209          return addDeviceName();
5210        }
5211        else if (name.equals("modelNumber")) {
5212          throw new FHIRException("Cannot call addChild on a primitive type Device.modelNumber");
5213        }
5214        else if (name.equals("partNumber")) {
5215          throw new FHIRException("Cannot call addChild on a primitive type Device.partNumber");
5216        }
5217        else if (name.equals("type")) {
5218          return addType();
5219        }
5220        else if (name.equals("version")) {
5221          return addVersion();
5222        }
5223        else if (name.equals("specialization")) {
5224          return addSpecialization();
5225        }
5226        else if (name.equals("property")) {
5227          return addProperty();
5228        }
5229        else if (name.equals("subject")) {
5230          this.subject = new Reference();
5231          return this.subject;
5232        }
5233        else if (name.equals("operationalState")) {
5234          return addOperationalState();
5235        }
5236        else if (name.equals("association")) {
5237          return addAssociation();
5238        }
5239        else if (name.equals("owner")) {
5240          this.owner = new Reference();
5241          return this.owner;
5242        }
5243        else if (name.equals("contact")) {
5244          return addContact();
5245        }
5246        else if (name.equals("location")) {
5247          this.location = new Reference();
5248          return this.location;
5249        }
5250        else if (name.equals("url")) {
5251          throw new FHIRException("Cannot call addChild on a primitive type Device.url");
5252        }
5253        else if (name.equals("endpoint")) {
5254          return addEndpoint();
5255        }
5256        else if (name.equals("link")) {
5257          return addLink();
5258        }
5259        else if (name.equals("note")) {
5260          return addNote();
5261        }
5262        else if (name.equals("safety")) {
5263          return addSafety();
5264        }
5265        else if (name.equals("parent")) {
5266          this.parent = new Reference();
5267          return this.parent;
5268        }
5269        else
5270          return super.addChild(name);
5271      }
5272
5273  public String fhirType() {
5274    return "Device";
5275
5276  }
5277
5278      public Device copy() {
5279        Device dst = new Device();
5280        copyValues(dst);
5281        return dst;
5282      }
5283
5284      public void copyValues(Device dst) {
5285        super.copyValues(dst);
5286        if (identifier != null) {
5287          dst.identifier = new ArrayList<Identifier>();
5288          for (Identifier i : identifier)
5289            dst.identifier.add(i.copy());
5290        };
5291        dst.displayName = displayName == null ? null : displayName.copy();
5292        dst.definition = definition == null ? null : definition.copy();
5293        if (udiCarrier != null) {
5294          dst.udiCarrier = new ArrayList<DeviceUdiCarrierComponent>();
5295          for (DeviceUdiCarrierComponent i : udiCarrier)
5296            dst.udiCarrier.add(i.copy());
5297        };
5298        dst.status = status == null ? null : status.copy();
5299        if (statusReason != null) {
5300          dst.statusReason = new ArrayList<CodeableConcept>();
5301          for (CodeableConcept i : statusReason)
5302            dst.statusReason.add(i.copy());
5303        };
5304        dst.biologicalSourceEvent = biologicalSourceEvent == null ? null : biologicalSourceEvent.copy();
5305        dst.manufacturer = manufacturer == null ? null : manufacturer.copy();
5306        dst.manufactureDate = manufactureDate == null ? null : manufactureDate.copy();
5307        dst.expirationDate = expirationDate == null ? null : expirationDate.copy();
5308        dst.lotNumber = lotNumber == null ? null : lotNumber.copy();
5309        dst.serialNumber = serialNumber == null ? null : serialNumber.copy();
5310        if (deviceName != null) {
5311          dst.deviceName = new ArrayList<DeviceDeviceNameComponent>();
5312          for (DeviceDeviceNameComponent i : deviceName)
5313            dst.deviceName.add(i.copy());
5314        };
5315        dst.modelNumber = modelNumber == null ? null : modelNumber.copy();
5316        dst.partNumber = partNumber == null ? null : partNumber.copy();
5317        if (type != null) {
5318          dst.type = new ArrayList<CodeableConcept>();
5319          for (CodeableConcept i : type)
5320            dst.type.add(i.copy());
5321        };
5322        if (version != null) {
5323          dst.version = new ArrayList<DeviceVersionComponent>();
5324          for (DeviceVersionComponent i : version)
5325            dst.version.add(i.copy());
5326        };
5327        if (specialization != null) {
5328          dst.specialization = new ArrayList<DeviceSpecializationComponent>();
5329          for (DeviceSpecializationComponent i : specialization)
5330            dst.specialization.add(i.copy());
5331        };
5332        if (property != null) {
5333          dst.property = new ArrayList<DevicePropertyComponent>();
5334          for (DevicePropertyComponent i : property)
5335            dst.property.add(i.copy());
5336        };
5337        dst.subject = subject == null ? null : subject.copy();
5338        if (operationalState != null) {
5339          dst.operationalState = new ArrayList<DeviceOperationalStateComponent>();
5340          for (DeviceOperationalStateComponent i : operationalState)
5341            dst.operationalState.add(i.copy());
5342        };
5343        if (association != null) {
5344          dst.association = new ArrayList<DeviceAssociationComponent>();
5345          for (DeviceAssociationComponent i : association)
5346            dst.association.add(i.copy());
5347        };
5348        dst.owner = owner == null ? null : owner.copy();
5349        if (contact != null) {
5350          dst.contact = new ArrayList<ContactPoint>();
5351          for (ContactPoint i : contact)
5352            dst.contact.add(i.copy());
5353        };
5354        dst.location = location == null ? null : location.copy();
5355        dst.url = url == null ? null : url.copy();
5356        if (endpoint != null) {
5357          dst.endpoint = new ArrayList<Reference>();
5358          for (Reference i : endpoint)
5359            dst.endpoint.add(i.copy());
5360        };
5361        if (link != null) {
5362          dst.link = new ArrayList<DeviceLinkComponent>();
5363          for (DeviceLinkComponent i : link)
5364            dst.link.add(i.copy());
5365        };
5366        if (note != null) {
5367          dst.note = new ArrayList<Annotation>();
5368          for (Annotation i : note)
5369            dst.note.add(i.copy());
5370        };
5371        if (safety != null) {
5372          dst.safety = new ArrayList<CodeableConcept>();
5373          for (CodeableConcept i : safety)
5374            dst.safety.add(i.copy());
5375        };
5376        dst.parent = parent == null ? null : parent.copy();
5377      }
5378
5379      protected Device typedCopy() {
5380        return copy();
5381      }
5382
5383      @Override
5384      public boolean equalsDeep(Base other_) {
5385        if (!super.equalsDeep(other_))
5386          return false;
5387        if (!(other_ instanceof Device))
5388          return false;
5389        Device o = (Device) other_;
5390        return compareDeep(identifier, o.identifier, true) && compareDeep(displayName, o.displayName, true)
5391           && compareDeep(definition, o.definition, true) && compareDeep(udiCarrier, o.udiCarrier, true) && compareDeep(status, o.status, true)
5392           && compareDeep(statusReason, o.statusReason, true) && compareDeep(biologicalSourceEvent, o.biologicalSourceEvent, true)
5393           && compareDeep(manufacturer, o.manufacturer, true) && compareDeep(manufactureDate, o.manufactureDate, true)
5394           && compareDeep(expirationDate, o.expirationDate, true) && compareDeep(lotNumber, o.lotNumber, true)
5395           && compareDeep(serialNumber, o.serialNumber, true) && compareDeep(deviceName, o.deviceName, true)
5396           && compareDeep(modelNumber, o.modelNumber, true) && compareDeep(partNumber, o.partNumber, true)
5397           && compareDeep(type, o.type, true) && compareDeep(version, o.version, true) && compareDeep(specialization, o.specialization, true)
5398           && compareDeep(property, o.property, true) && compareDeep(subject, o.subject, true) && compareDeep(operationalState, o.operationalState, true)
5399           && compareDeep(association, o.association, true) && compareDeep(owner, o.owner, true) && compareDeep(contact, o.contact, true)
5400           && compareDeep(location, o.location, true) && compareDeep(url, o.url, true) && compareDeep(endpoint, o.endpoint, true)
5401           && compareDeep(link, o.link, true) && compareDeep(note, o.note, true) && compareDeep(safety, o.safety, true)
5402           && compareDeep(parent, o.parent, true);
5403      }
5404
5405      @Override
5406      public boolean equalsShallow(Base other_) {
5407        if (!super.equalsShallow(other_))
5408          return false;
5409        if (!(other_ instanceof Device))
5410          return false;
5411        Device o = (Device) other_;
5412        return compareValues(displayName, o.displayName, true) && compareValues(status, o.status, true) && compareValues(manufacturer, o.manufacturer, true)
5413           && compareValues(manufactureDate, o.manufactureDate, true) && compareValues(expirationDate, o.expirationDate, true)
5414           && compareValues(lotNumber, o.lotNumber, true) && compareValues(serialNumber, o.serialNumber, true)
5415           && compareValues(modelNumber, o.modelNumber, true) && compareValues(partNumber, o.partNumber, true)
5416           && compareValues(url, o.url, true);
5417      }
5418
5419      public boolean isEmpty() {
5420        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, displayName, definition
5421          , udiCarrier, status, statusReason, biologicalSourceEvent, manufacturer, manufactureDate
5422          , expirationDate, lotNumber, serialNumber, deviceName, modelNumber, partNumber, type
5423          , version, specialization, property, subject, operationalState, association, owner
5424          , contact, location, url, endpoint, link, note, safety, parent);
5425      }
5426
5427  @Override
5428  public ResourceType getResourceType() {
5429    return ResourceType.Device;
5430   }
5431
5432 /**
5433   * Search parameter: <b>biological-source-event</b>
5434   * <p>
5435   * Description: <b>The biological source for the device</b><br>
5436   * Type: <b>token</b><br>
5437   * Path: <b>Device.biologicalSourceEvent</b><br>
5438   * </p>
5439   */
5440  @SearchParamDefinition(name="biological-source-event", path="Device.biologicalSourceEvent", description="The biological source for the device", type="token" )
5441  public static final String SP_BIOLOGICAL_SOURCE_EVENT = "biological-source-event";
5442 /**
5443   * <b>Fluent Client</b> search parameter constant for <b>biological-source-event</b>
5444   * <p>
5445   * Description: <b>The biological source for the device</b><br>
5446   * Type: <b>token</b><br>
5447   * Path: <b>Device.biologicalSourceEvent</b><br>
5448   * </p>
5449   */
5450  public static final ca.uhn.fhir.rest.gclient.TokenClientParam BIOLOGICAL_SOURCE_EVENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_BIOLOGICAL_SOURCE_EVENT);
5451
5452 /**
5453   * Search parameter: <b>definition</b>
5454   * <p>
5455   * Description: <b>The definition / type of the device</b><br>
5456   * Type: <b>reference</b><br>
5457   * Path: <b>Device.definition.reference</b><br>
5458   * </p>
5459   */
5460  @SearchParamDefinition(name="definition", path="Device.definition.reference", description="The definition / type of the device", type="reference" )
5461  public static final String SP_DEFINITION = "definition";
5462 /**
5463   * <b>Fluent Client</b> search parameter constant for <b>definition</b>
5464   * <p>
5465   * Description: <b>The definition / type of the device</b><br>
5466   * Type: <b>reference</b><br>
5467   * Path: <b>Device.definition.reference</b><br>
5468   * </p>
5469   */
5470  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DEFINITION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DEFINITION);
5471
5472/**
5473   * Constant for fluent queries to be used to add include statements. Specifies
5474   * the path value of "<b>Device:definition</b>".
5475   */
5476  public static final ca.uhn.fhir.model.api.Include INCLUDE_DEFINITION = new ca.uhn.fhir.model.api.Include("Device:definition").toLocked();
5477
5478 /**
5479   * Search parameter: <b>device-name</b>
5480   * <p>
5481   * Description: <b>A server defined search that may match any of the string fields in Device.deviceName or Device.type.</b><br>
5482   * Type: <b>string</b><br>
5483   * Path: <b>Device.deviceName.name | Device.type.coding.display | Device.type.text</b><br>
5484   * </p>
5485   */
5486  @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" )
5487  public static final String SP_DEVICE_NAME = "device-name";
5488 /**
5489   * <b>Fluent Client</b> search parameter constant for <b>device-name</b>
5490   * <p>
5491   * Description: <b>A server defined search that may match any of the string fields in Device.deviceName or Device.type.</b><br>
5492   * Type: <b>string</b><br>
5493   * Path: <b>Device.deviceName.name | Device.type.coding.display | Device.type.text</b><br>
5494   * </p>
5495   */
5496  public static final ca.uhn.fhir.rest.gclient.StringClientParam DEVICE_NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DEVICE_NAME);
5497
5498 /**
5499   * Search parameter: <b>expiration-date</b>
5500   * <p>
5501   * Description: <b>The expiration date of the device</b><br>
5502   * Type: <b>date</b><br>
5503   * Path: <b>Device.expirationDate</b><br>
5504   * </p>
5505   */
5506  @SearchParamDefinition(name="expiration-date", path="Device.expirationDate", description="The expiration date of the device", type="date" )
5507  public static final String SP_EXPIRATION_DATE = "expiration-date";
5508 /**
5509   * <b>Fluent Client</b> search parameter constant for <b>expiration-date</b>
5510   * <p>
5511   * Description: <b>The expiration date of the device</b><br>
5512   * Type: <b>date</b><br>
5513   * Path: <b>Device.expirationDate</b><br>
5514   * </p>
5515   */
5516  public static final ca.uhn.fhir.rest.gclient.DateClientParam EXPIRATION_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_EXPIRATION_DATE);
5517
5518 /**
5519   * Search parameter: <b>identifier</b>
5520   * <p>
5521   * Description: <b>Instance id from manufacturer, owner, and others</b><br>
5522   * Type: <b>token</b><br>
5523   * Path: <b>Device.identifier</b><br>
5524   * </p>
5525   */
5526  @SearchParamDefinition(name="identifier", path="Device.identifier", description="Instance id from manufacturer, owner, and others", type="token" )
5527  public static final String SP_IDENTIFIER = "identifier";
5528 /**
5529   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
5530   * <p>
5531   * Description: <b>Instance id from manufacturer, owner, and others</b><br>
5532   * Type: <b>token</b><br>
5533   * Path: <b>Device.identifier</b><br>
5534   * </p>
5535   */
5536  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
5537
5538 /**
5539   * Search parameter: <b>location</b>
5540   * <p>
5541   * Description: <b>A location, where the resource is found</b><br>
5542   * Type: <b>reference</b><br>
5543   * Path: <b>Device.location</b><br>
5544   * </p>
5545   */
5546  @SearchParamDefinition(name="location", path="Device.location", description="A location, where the resource is found", type="reference", target={Location.class } )
5547  public static final String SP_LOCATION = "location";
5548 /**
5549   * <b>Fluent Client</b> search parameter constant for <b>location</b>
5550   * <p>
5551   * Description: <b>A location, where the resource is found</b><br>
5552   * Type: <b>reference</b><br>
5553   * Path: <b>Device.location</b><br>
5554   * </p>
5555   */
5556  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
5557
5558/**
5559   * Constant for fluent queries to be used to add include statements. Specifies
5560   * the path value of "<b>Device:location</b>".
5561   */
5562  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("Device:location").toLocked();
5563
5564 /**
5565   * Search parameter: <b>lot-number</b>
5566   * <p>
5567   * Description: <b>The lot number of the device</b><br>
5568   * Type: <b>string</b><br>
5569   * Path: <b>Device.lotNumber</b><br>
5570   * </p>
5571   */
5572  @SearchParamDefinition(name="lot-number", path="Device.lotNumber", description="The lot number of the device", type="string" )
5573  public static final String SP_LOT_NUMBER = "lot-number";
5574 /**
5575   * <b>Fluent Client</b> search parameter constant for <b>lot-number</b>
5576   * <p>
5577   * Description: <b>The lot number of the device</b><br>
5578   * Type: <b>string</b><br>
5579   * Path: <b>Device.lotNumber</b><br>
5580   * </p>
5581   */
5582  public static final ca.uhn.fhir.rest.gclient.StringClientParam LOT_NUMBER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_LOT_NUMBER);
5583
5584 /**
5585   * Search parameter: <b>manufacture-date</b>
5586   * <p>
5587   * Description: <b>The manufacture date of the device</b><br>
5588   * Type: <b>date</b><br>
5589   * Path: <b>Device.manufactureDate</b><br>
5590   * </p>
5591   */
5592  @SearchParamDefinition(name="manufacture-date", path="Device.manufactureDate", description="The manufacture date of the device", type="date" )
5593  public static final String SP_MANUFACTURE_DATE = "manufacture-date";
5594 /**
5595   * <b>Fluent Client</b> search parameter constant for <b>manufacture-date</b>
5596   * <p>
5597   * Description: <b>The manufacture date of the device</b><br>
5598   * Type: <b>date</b><br>
5599   * Path: <b>Device.manufactureDate</b><br>
5600   * </p>
5601   */
5602  public static final ca.uhn.fhir.rest.gclient.DateClientParam MANUFACTURE_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_MANUFACTURE_DATE);
5603
5604 /**
5605   * Search parameter: <b>manufacturer</b>
5606   * <p>
5607   * Description: <b>The manufacturer of the device</b><br>
5608   * Type: <b>string</b><br>
5609   * Path: <b>Device.manufacturer</b><br>
5610   * </p>
5611   */
5612  @SearchParamDefinition(name="manufacturer", path="Device.manufacturer", description="The manufacturer of the device", type="string" )
5613  public static final String SP_MANUFACTURER = "manufacturer";
5614 /**
5615   * <b>Fluent Client</b> search parameter constant for <b>manufacturer</b>
5616   * <p>
5617   * Description: <b>The manufacturer of the device</b><br>
5618   * Type: <b>string</b><br>
5619   * Path: <b>Device.manufacturer</b><br>
5620   * </p>
5621   */
5622  public static final ca.uhn.fhir.rest.gclient.StringClientParam MANUFACTURER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_MANUFACTURER);
5623
5624 /**
5625   * Search parameter: <b>model</b>
5626   * <p>
5627   * Description: <b>The model of the device</b><br>
5628   * Type: <b>string</b><br>
5629   * Path: <b>Device.modelNumber</b><br>
5630   * </p>
5631   */
5632  @SearchParamDefinition(name="model", path="Device.modelNumber", description="The model of the device", type="string" )
5633  public static final String SP_MODEL = "model";
5634 /**
5635   * <b>Fluent Client</b> search parameter constant for <b>model</b>
5636   * <p>
5637   * Description: <b>The model of the device</b><br>
5638   * Type: <b>string</b><br>
5639   * Path: <b>Device.modelNumber</b><br>
5640   * </p>
5641   */
5642  public static final ca.uhn.fhir.rest.gclient.StringClientParam MODEL = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_MODEL);
5643
5644 /**
5645   * Search parameter: <b>organization</b>
5646   * <p>
5647   * Description: <b>The organization responsible for the device</b><br>
5648   * Type: <b>reference</b><br>
5649   * Path: <b>Device.owner</b><br>
5650   * </p>
5651   */
5652  @SearchParamDefinition(name="organization", path="Device.owner", description="The organization responsible for the device", type="reference", target={Organization.class } )
5653  public static final String SP_ORGANIZATION = "organization";
5654 /**
5655   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
5656   * <p>
5657   * Description: <b>The organization responsible for the device</b><br>
5658   * Type: <b>reference</b><br>
5659   * Path: <b>Device.owner</b><br>
5660   * </p>
5661   */
5662  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
5663
5664/**
5665   * Constant for fluent queries to be used to add include statements. Specifies
5666   * the path value of "<b>Device:organization</b>".
5667   */
5668  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("Device:organization").toLocked();
5669
5670 /**
5671   * Search parameter: <b>parent</b>
5672   * <p>
5673   * Description: <b>The parent device</b><br>
5674   * Type: <b>reference</b><br>
5675   * Path: <b>Device.parent</b><br>
5676   * </p>
5677   */
5678  @SearchParamDefinition(name="parent", path="Device.parent", description="The parent device", type="reference", target={Device.class } )
5679  public static final String SP_PARENT = "parent";
5680 /**
5681   * <b>Fluent Client</b> search parameter constant for <b>parent</b>
5682   * <p>
5683   * Description: <b>The parent device</b><br>
5684   * Type: <b>reference</b><br>
5685   * Path: <b>Device.parent</b><br>
5686   * </p>
5687   */
5688  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PARENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PARENT);
5689
5690/**
5691   * Constant for fluent queries to be used to add include statements. Specifies
5692   * the path value of "<b>Device:parent</b>".
5693   */
5694  public static final ca.uhn.fhir.model.api.Include INCLUDE_PARENT = new ca.uhn.fhir.model.api.Include("Device:parent").toLocked();
5695
5696 /**
5697   * Search parameter: <b>patient</b>
5698   * <p>
5699   * Description: <b>Patient information, if the resource is affixed to a person</b><br>
5700   * Type: <b>reference</b><br>
5701   * Path: <b>Device.subject.where(resolve() is Patient)</b><br>
5702   * </p>
5703   */
5704  @SearchParamDefinition(name="patient", path="Device.subject.where(resolve() is Patient)", description="Patient information, if the resource is affixed to a person", type="reference", target={Patient.class } )
5705  public static final String SP_PATIENT = "patient";
5706 /**
5707   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
5708   * <p>
5709   * Description: <b>Patient information, if the resource is affixed to a person</b><br>
5710   * Type: <b>reference</b><br>
5711   * Path: <b>Device.subject.where(resolve() is Patient)</b><br>
5712   * </p>
5713   */
5714  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
5715
5716/**
5717   * Constant for fluent queries to be used to add include statements. Specifies
5718   * the path value of "<b>Device:patient</b>".
5719   */
5720  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Device:patient").toLocked();
5721
5722 /**
5723   * Search parameter: <b>serial-number</b>
5724   * <p>
5725   * Description: <b>The serial number of the device</b><br>
5726   * Type: <b>string</b><br>
5727   * Path: <b>Device.serialNumber | Device.identifier.where(type='SNO')</b><br>
5728   * </p>
5729   */
5730  @SearchParamDefinition(name="serial-number", path="Device.serialNumber | Device.identifier.where(type='SNO')", description="The serial number of the device", type="string" )
5731  public static final String SP_SERIAL_NUMBER = "serial-number";
5732 /**
5733   * <b>Fluent Client</b> search parameter constant for <b>serial-number</b>
5734   * <p>
5735   * Description: <b>The serial number of the device</b><br>
5736   * Type: <b>string</b><br>
5737   * Path: <b>Device.serialNumber | Device.identifier.where(type='SNO')</b><br>
5738   * </p>
5739   */
5740  public static final ca.uhn.fhir.rest.gclient.StringClientParam SERIAL_NUMBER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_SERIAL_NUMBER);
5741
5742 /**
5743   * Search parameter: <b>status</b>
5744   * <p>
5745   * Description: <b>active | inactive | entered-in-error | unknown</b><br>
5746   * Type: <b>token</b><br>
5747   * Path: <b>Device.status</b><br>
5748   * </p>
5749   */
5750  @SearchParamDefinition(name="status", path="Device.status", description="active | inactive | entered-in-error | unknown", type="token" )
5751  public static final String SP_STATUS = "status";
5752 /**
5753   * <b>Fluent Client</b> search parameter constant for <b>status</b>
5754   * <p>
5755   * Description: <b>active | inactive | entered-in-error | unknown</b><br>
5756   * Type: <b>token</b><br>
5757   * Path: <b>Device.status</b><br>
5758   * </p>
5759   */
5760  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
5761
5762 /**
5763   * Search parameter: <b>subject</b>
5764   * <p>
5765   * Description: <b>Subject information, to which the device is associated of affixed</b><br>
5766   * Type: <b>reference</b><br>
5767   * Path: <b>Device.subject</b><br>
5768   * </p>
5769   */
5770  @SearchParamDefinition(name="subject", path="Device.subject", description="Subject information, to which the device is associated of affixed", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient") }, target={Patient.class, Practitioner.class } )
5771  public static final String SP_SUBJECT = "subject";
5772 /**
5773   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
5774   * <p>
5775   * Description: <b>Subject information, to which the device is associated of affixed</b><br>
5776   * Type: <b>reference</b><br>
5777   * Path: <b>Device.subject</b><br>
5778   * </p>
5779   */
5780  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
5781
5782/**
5783   * Constant for fluent queries to be used to add include statements. Specifies
5784   * the path value of "<b>Device:subject</b>".
5785   */
5786  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Device:subject").toLocked();
5787
5788 /**
5789   * Search parameter: <b>type</b>
5790   * <p>
5791   * Description: <b>The type of the device</b><br>
5792   * Type: <b>token</b><br>
5793   * Path: <b>Device.type</b><br>
5794   * </p>
5795   */
5796  @SearchParamDefinition(name="type", path="Device.type", description="The type of the device", type="token" )
5797  public static final String SP_TYPE = "type";
5798 /**
5799   * <b>Fluent Client</b> search parameter constant for <b>type</b>
5800   * <p>
5801   * Description: <b>The type of the device</b><br>
5802   * Type: <b>token</b><br>
5803   * Path: <b>Device.type</b><br>
5804   * </p>
5805   */
5806  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
5807
5808 /**
5809   * Search parameter: <b>udi-carrier</b>
5810   * <p>
5811   * Description: <b>UDI Barcode (RFID or other technology) string in *HRF* format.</b><br>
5812   * Type: <b>string</b><br>
5813   * Path: <b>Device.udiCarrier.carrierHRF</b><br>
5814   * </p>
5815   */
5816  @SearchParamDefinition(name="udi-carrier", path="Device.udiCarrier.carrierHRF", description="UDI Barcode (RFID or other technology) string in *HRF* format.", type="string" )
5817  public static final String SP_UDI_CARRIER = "udi-carrier";
5818 /**
5819   * <b>Fluent Client</b> search parameter constant for <b>udi-carrier</b>
5820   * <p>
5821   * Description: <b>UDI Barcode (RFID or other technology) string in *HRF* format.</b><br>
5822   * Type: <b>string</b><br>
5823   * Path: <b>Device.udiCarrier.carrierHRF</b><br>
5824   * </p>
5825   */
5826  public static final ca.uhn.fhir.rest.gclient.StringClientParam UDI_CARRIER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_UDI_CARRIER);
5827
5828 /**
5829   * Search parameter: <b>udi-di</b>
5830   * <p>
5831   * Description: <b>The udi Device Identifier (DI)</b><br>
5832   * Type: <b>string</b><br>
5833   * Path: <b>Device.udiCarrier.deviceIdentifier</b><br>
5834   * </p>
5835   */
5836  @SearchParamDefinition(name="udi-di", path="Device.udiCarrier.deviceIdentifier", description="The udi Device Identifier (DI)", type="string" )
5837  public static final String SP_UDI_DI = "udi-di";
5838 /**
5839   * <b>Fluent Client</b> search parameter constant for <b>udi-di</b>
5840   * <p>
5841   * Description: <b>The udi Device Identifier (DI)</b><br>
5842   * Type: <b>string</b><br>
5843   * Path: <b>Device.udiCarrier.deviceIdentifier</b><br>
5844   * </p>
5845   */
5846  public static final ca.uhn.fhir.rest.gclient.StringClientParam UDI_DI = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_UDI_DI);
5847
5848 /**
5849   * Search parameter: <b>url</b>
5850   * <p>
5851   * Description: <b>Network address to contact device</b><br>
5852   * Type: <b>uri</b><br>
5853   * Path: <b>Device.url</b><br>
5854   * </p>
5855   */
5856  @SearchParamDefinition(name="url", path="Device.url", description="Network address to contact device", type="uri" )
5857  public static final String SP_URL = "url";
5858 /**
5859   * <b>Fluent Client</b> search parameter constant for <b>url</b>
5860   * <p>
5861   * Description: <b>Network address to contact device</b><br>
5862   * Type: <b>uri</b><br>
5863   * Path: <b>Device.url</b><br>
5864   * </p>
5865   */
5866  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
5867
5868 /**
5869   * Search parameter: <b>version</b>
5870   * <p>
5871   * Description: <b>The specific version of the device</b><br>
5872   * Type: <b>string</b><br>
5873   * Path: <b>Device.version.value</b><br>
5874   * </p>
5875   */
5876  @SearchParamDefinition(name="version", path="Device.version.value", description="The specific version of the device", type="string" )
5877  public static final String SP_VERSION = "version";
5878 /**
5879   * <b>Fluent Client</b> search parameter constant for <b>version</b>
5880   * <p>
5881   * Description: <b>The specific version of the device</b><br>
5882   * Type: <b>string</b><br>
5883   * Path: <b>Device.version.value</b><br>
5884   * </p>
5885   */
5886  public static final ca.uhn.fhir.rest.gclient.StringClientParam VERSION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_VERSION);
5887
5888 /**
5889   * Search parameter: <b>din</b>
5890   * <p>
5891   * Description: <b>The donation identification number (DIN)</b><br>
5892   * Type: <b>token</b><br>
5893   * Path: <b>Device.extension('http://hl7.org/fhir/SearchParameter/device-extensions-Device-din')</b><br>
5894   * </p>
5895   */
5896  @SearchParamDefinition(name="din", path="Device.extension('http://hl7.org/fhir/SearchParameter/device-extensions-Device-din')", description="The donation identification number (DIN)", type="token" )
5897  public static final String SP_DIN = "din";
5898 /**
5899   * <b>Fluent Client</b> search parameter constant for <b>din</b>
5900   * <p>
5901   * Description: <b>The donation identification number (DIN)</b><br>
5902   * Type: <b>token</b><br>
5903   * Path: <b>Device.extension('http://hl7.org/fhir/SearchParameter/device-extensions-Device-din')</b><br>
5904   * </p>
5905   */
5906  public static final ca.uhn.fhir.rest.gclient.TokenClientParam DIN = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_DIN);
5907
5908
5909}
5910