001package org.hl7.fhir.dstu2.model;
002
003
004
005
006/*
007  Copyright (c) 2011+, HL7, Inc.
008  All rights reserved.
009  
010  Redistribution and use in source and binary forms, with or without modification, 
011  are permitted provided that the following conditions are met:
012  
013   * Redistributions of source code must retain the above copyright notice, this 
014     list of conditions and the following disclaimer.
015   * Redistributions in binary form must reproduce the above copyright notice, 
016     this list of conditions and the following disclaimer in the documentation 
017     and/or other materials provided with the distribution.
018   * Neither the name of HL7 nor the names of its contributors may be used to 
019     endorse or promote products derived from this software without specific 
020     prior written permission.
021  
022  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
023  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
024  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
025  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
026  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
027  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
028  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
029  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
030  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
031  POSSIBILITY OF SUCH DAMAGE.
032  
033*/
034
035// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
036import java.util.ArrayList;
037import java.util.Date;
038import java.util.List;
039
040import ca.uhn.fhir.model.api.annotation.Block;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.ResourceDef;
044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
045import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
046import org.hl7.fhir.exceptions.FHIRException;
047import org.hl7.fhir.utilities.Utilities;
048/**
049 * Describes the characteristics, operational status and capabilities of a medical-related component of a medical device.
050 */
051@ResourceDef(name="DeviceComponent", profile="http://hl7.org/fhir/Profile/DeviceComponent")
052public class DeviceComponent extends DomainResource {
053
054    public enum MeasmntPrinciple {
055        /**
056         * Measurement principle isn't in the list.
057         */
058        OTHER, 
059        /**
060         * Measurement is done using the chemical principle.
061         */
062        CHEMICAL, 
063        /**
064         * Measurement is done using the electrical principle.
065         */
066        ELECTRICAL, 
067        /**
068         * Measurement is done using the impedance principle.
069         */
070        IMPEDANCE, 
071        /**
072         * Measurement is done using the nuclear principle.
073         */
074        NUCLEAR, 
075        /**
076         * Measurement is done using the optical principle.
077         */
078        OPTICAL, 
079        /**
080         * Measurement is done using the thermal principle.
081         */
082        THERMAL, 
083        /**
084         * Measurement is done using the biological principle.
085         */
086        BIOLOGICAL, 
087        /**
088         * Measurement is done using the mechanical principle.
089         */
090        MECHANICAL, 
091        /**
092         * Measurement is done using the acoustical principle.
093         */
094        ACOUSTICAL, 
095        /**
096         * Measurement is done using the manual principle.
097         */
098        MANUAL, 
099        /**
100         * added to help the parsers
101         */
102        NULL;
103        public static MeasmntPrinciple fromCode(String codeString) throws FHIRException {
104            if (codeString == null || "".equals(codeString))
105                return null;
106        if ("other".equals(codeString))
107          return OTHER;
108        if ("chemical".equals(codeString))
109          return CHEMICAL;
110        if ("electrical".equals(codeString))
111          return ELECTRICAL;
112        if ("impedance".equals(codeString))
113          return IMPEDANCE;
114        if ("nuclear".equals(codeString))
115          return NUCLEAR;
116        if ("optical".equals(codeString))
117          return OPTICAL;
118        if ("thermal".equals(codeString))
119          return THERMAL;
120        if ("biological".equals(codeString))
121          return BIOLOGICAL;
122        if ("mechanical".equals(codeString))
123          return MECHANICAL;
124        if ("acoustical".equals(codeString))
125          return ACOUSTICAL;
126        if ("manual".equals(codeString))
127          return MANUAL;
128        throw new FHIRException("Unknown MeasmntPrinciple code '"+codeString+"'");
129        }
130        public String toCode() {
131          switch (this) {
132            case OTHER: return "other";
133            case CHEMICAL: return "chemical";
134            case ELECTRICAL: return "electrical";
135            case IMPEDANCE: return "impedance";
136            case NUCLEAR: return "nuclear";
137            case OPTICAL: return "optical";
138            case THERMAL: return "thermal";
139            case BIOLOGICAL: return "biological";
140            case MECHANICAL: return "mechanical";
141            case ACOUSTICAL: return "acoustical";
142            case MANUAL: return "manual";
143            case NULL: return null;
144            default: return "?";
145          }
146        }
147        public String getSystem() {
148          switch (this) {
149            case OTHER: return "http://hl7.org/fhir/measurement-principle";
150            case CHEMICAL: return "http://hl7.org/fhir/measurement-principle";
151            case ELECTRICAL: return "http://hl7.org/fhir/measurement-principle";
152            case IMPEDANCE: return "http://hl7.org/fhir/measurement-principle";
153            case NUCLEAR: return "http://hl7.org/fhir/measurement-principle";
154            case OPTICAL: return "http://hl7.org/fhir/measurement-principle";
155            case THERMAL: return "http://hl7.org/fhir/measurement-principle";
156            case BIOLOGICAL: return "http://hl7.org/fhir/measurement-principle";
157            case MECHANICAL: return "http://hl7.org/fhir/measurement-principle";
158            case ACOUSTICAL: return "http://hl7.org/fhir/measurement-principle";
159            case MANUAL: return "http://hl7.org/fhir/measurement-principle";
160            case NULL: return null;
161            default: return "?";
162          }
163        }
164        public String getDefinition() {
165          switch (this) {
166            case OTHER: return "Measurement principle isn't in the list.";
167            case CHEMICAL: return "Measurement is done using the chemical principle.";
168            case ELECTRICAL: return "Measurement is done using the electrical principle.";
169            case IMPEDANCE: return "Measurement is done using the impedance principle.";
170            case NUCLEAR: return "Measurement is done using the nuclear principle.";
171            case OPTICAL: return "Measurement is done using the optical principle.";
172            case THERMAL: return "Measurement is done using the thermal principle.";
173            case BIOLOGICAL: return "Measurement is done using the biological principle.";
174            case MECHANICAL: return "Measurement is done using the mechanical principle.";
175            case ACOUSTICAL: return "Measurement is done using the acoustical principle.";
176            case MANUAL: return "Measurement is done using the manual principle.";
177            case NULL: return null;
178            default: return "?";
179          }
180        }
181        public String getDisplay() {
182          switch (this) {
183            case OTHER: return "MSP Other";
184            case CHEMICAL: return "MSP Chemical";
185            case ELECTRICAL: return "MSP Electrical";
186            case IMPEDANCE: return "MSP Impedance";
187            case NUCLEAR: return "MSP Nuclear";
188            case OPTICAL: return "MSP Optical";
189            case THERMAL: return "MSP Thermal";
190            case BIOLOGICAL: return "MSP Biological";
191            case MECHANICAL: return "MSP Mechanical";
192            case ACOUSTICAL: return "MSP Acoustical";
193            case MANUAL: return "MSP Manual";
194            case NULL: return null;
195            default: return "?";
196          }
197        }
198    }
199
200  public static class MeasmntPrincipleEnumFactory implements EnumFactory<MeasmntPrinciple> {
201    public MeasmntPrinciple fromCode(String codeString) throws IllegalArgumentException {
202      if (codeString == null || "".equals(codeString))
203            if (codeString == null || "".equals(codeString))
204                return null;
205        if ("other".equals(codeString))
206          return MeasmntPrinciple.OTHER;
207        if ("chemical".equals(codeString))
208          return MeasmntPrinciple.CHEMICAL;
209        if ("electrical".equals(codeString))
210          return MeasmntPrinciple.ELECTRICAL;
211        if ("impedance".equals(codeString))
212          return MeasmntPrinciple.IMPEDANCE;
213        if ("nuclear".equals(codeString))
214          return MeasmntPrinciple.NUCLEAR;
215        if ("optical".equals(codeString))
216          return MeasmntPrinciple.OPTICAL;
217        if ("thermal".equals(codeString))
218          return MeasmntPrinciple.THERMAL;
219        if ("biological".equals(codeString))
220          return MeasmntPrinciple.BIOLOGICAL;
221        if ("mechanical".equals(codeString))
222          return MeasmntPrinciple.MECHANICAL;
223        if ("acoustical".equals(codeString))
224          return MeasmntPrinciple.ACOUSTICAL;
225        if ("manual".equals(codeString))
226          return MeasmntPrinciple.MANUAL;
227        throw new IllegalArgumentException("Unknown MeasmntPrinciple code '"+codeString+"'");
228        }
229        public Enumeration<MeasmntPrinciple> fromType(Base code) throws FHIRException {
230          if (code == null || code.isEmpty())
231            return null;
232          String codeString = ((PrimitiveType) code).asStringValue();
233          if (codeString == null || "".equals(codeString))
234            return null;
235        if ("other".equals(codeString))
236          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.OTHER);
237        if ("chemical".equals(codeString))
238          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.CHEMICAL);
239        if ("electrical".equals(codeString))
240          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.ELECTRICAL);
241        if ("impedance".equals(codeString))
242          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.IMPEDANCE);
243        if ("nuclear".equals(codeString))
244          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.NUCLEAR);
245        if ("optical".equals(codeString))
246          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.OPTICAL);
247        if ("thermal".equals(codeString))
248          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.THERMAL);
249        if ("biological".equals(codeString))
250          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.BIOLOGICAL);
251        if ("mechanical".equals(codeString))
252          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.MECHANICAL);
253        if ("acoustical".equals(codeString))
254          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.ACOUSTICAL);
255        if ("manual".equals(codeString))
256          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.MANUAL);
257        throw new FHIRException("Unknown MeasmntPrinciple code '"+codeString+"'");
258        }
259    public String toCode(MeasmntPrinciple code) {
260      if (code == MeasmntPrinciple.OTHER)
261        return "other";
262      if (code == MeasmntPrinciple.CHEMICAL)
263        return "chemical";
264      if (code == MeasmntPrinciple.ELECTRICAL)
265        return "electrical";
266      if (code == MeasmntPrinciple.IMPEDANCE)
267        return "impedance";
268      if (code == MeasmntPrinciple.NUCLEAR)
269        return "nuclear";
270      if (code == MeasmntPrinciple.OPTICAL)
271        return "optical";
272      if (code == MeasmntPrinciple.THERMAL)
273        return "thermal";
274      if (code == MeasmntPrinciple.BIOLOGICAL)
275        return "biological";
276      if (code == MeasmntPrinciple.MECHANICAL)
277        return "mechanical";
278      if (code == MeasmntPrinciple.ACOUSTICAL)
279        return "acoustical";
280      if (code == MeasmntPrinciple.MANUAL)
281        return "manual";
282      return "?";
283      }
284    }
285
286    @Block()
287    public static class DeviceComponentProductionSpecificationComponent extends BackboneElement implements IBaseBackboneElement {
288        /**
289         * Describes the specification type, such as, serial number, part number, hardware revision, software revision, etc.
290         */
291        @Child(name = "specType", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
292        @Description(shortDefinition="Specification type", formalDefinition="Describes the specification type, such as, serial number, part number, hardware revision, software revision, etc." )
293        protected CodeableConcept specType;
294
295        /**
296         * Describes the internal component unique identification. This is a provision for manufacture specific standard components using a private OID. 11073-10101 has a partition for private OID semantic that the manufacture can make use of.
297         */
298        @Child(name = "componentId", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=true)
299        @Description(shortDefinition="Internal component unique identification", formalDefinition="Describes the internal component unique identification. This is a provision for manufacture specific standard components using a private OID. 11073-10101 has a partition for private OID semantic that the manufacture can make use of." )
300        protected Identifier componentId;
301
302        /**
303         * Describes the printable string defining the component.
304         */
305        @Child(name = "productionSpec", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
306        @Description(shortDefinition="A printable string defining the component", formalDefinition="Describes the printable string defining the component." )
307        protected StringType productionSpec;
308
309        private static final long serialVersionUID = -1476597516L;
310
311    /*
312     * Constructor
313     */
314      public DeviceComponentProductionSpecificationComponent() {
315        super();
316      }
317
318        /**
319         * @return {@link #specType} (Describes the specification type, such as, serial number, part number, hardware revision, software revision, etc.)
320         */
321        public CodeableConcept getSpecType() { 
322          if (this.specType == null)
323            if (Configuration.errorOnAutoCreate())
324              throw new Error("Attempt to auto-create DeviceComponentProductionSpecificationComponent.specType");
325            else if (Configuration.doAutoCreate())
326              this.specType = new CodeableConcept(); // cc
327          return this.specType;
328        }
329
330        public boolean hasSpecType() { 
331          return this.specType != null && !this.specType.isEmpty();
332        }
333
334        /**
335         * @param value {@link #specType} (Describes the specification type, such as, serial number, part number, hardware revision, software revision, etc.)
336         */
337        public DeviceComponentProductionSpecificationComponent setSpecType(CodeableConcept value) { 
338          this.specType = value;
339          return this;
340        }
341
342        /**
343         * @return {@link #componentId} (Describes the internal component unique identification. This is a provision for manufacture specific standard components using a private OID. 11073-10101 has a partition for private OID semantic that the manufacture can make use of.)
344         */
345        public Identifier getComponentId() { 
346          if (this.componentId == null)
347            if (Configuration.errorOnAutoCreate())
348              throw new Error("Attempt to auto-create DeviceComponentProductionSpecificationComponent.componentId");
349            else if (Configuration.doAutoCreate())
350              this.componentId = new Identifier(); // cc
351          return this.componentId;
352        }
353
354        public boolean hasComponentId() { 
355          return this.componentId != null && !this.componentId.isEmpty();
356        }
357
358        /**
359         * @param value {@link #componentId} (Describes the internal component unique identification. This is a provision for manufacture specific standard components using a private OID. 11073-10101 has a partition for private OID semantic that the manufacture can make use of.)
360         */
361        public DeviceComponentProductionSpecificationComponent setComponentId(Identifier value) { 
362          this.componentId = value;
363          return this;
364        }
365
366        /**
367         * @return {@link #productionSpec} (Describes the printable string defining the component.). This is the underlying object with id, value and extensions. The accessor "getProductionSpec" gives direct access to the value
368         */
369        public StringType getProductionSpecElement() { 
370          if (this.productionSpec == null)
371            if (Configuration.errorOnAutoCreate())
372              throw new Error("Attempt to auto-create DeviceComponentProductionSpecificationComponent.productionSpec");
373            else if (Configuration.doAutoCreate())
374              this.productionSpec = new StringType(); // bb
375          return this.productionSpec;
376        }
377
378        public boolean hasProductionSpecElement() { 
379          return this.productionSpec != null && !this.productionSpec.isEmpty();
380        }
381
382        public boolean hasProductionSpec() { 
383          return this.productionSpec != null && !this.productionSpec.isEmpty();
384        }
385
386        /**
387         * @param value {@link #productionSpec} (Describes the printable string defining the component.). This is the underlying object with id, value and extensions. The accessor "getProductionSpec" gives direct access to the value
388         */
389        public DeviceComponentProductionSpecificationComponent setProductionSpecElement(StringType value) { 
390          this.productionSpec = value;
391          return this;
392        }
393
394        /**
395         * @return Describes the printable string defining the component.
396         */
397        public String getProductionSpec() { 
398          return this.productionSpec == null ? null : this.productionSpec.getValue();
399        }
400
401        /**
402         * @param value Describes the printable string defining the component.
403         */
404        public DeviceComponentProductionSpecificationComponent setProductionSpec(String value) { 
405          if (Utilities.noString(value))
406            this.productionSpec = null;
407          else {
408            if (this.productionSpec == null)
409              this.productionSpec = new StringType();
410            this.productionSpec.setValue(value);
411          }
412          return this;
413        }
414
415        protected void listChildren(List<Property> childrenList) {
416          super.listChildren(childrenList);
417          childrenList.add(new Property("specType", "CodeableConcept", "Describes the specification type, such as, serial number, part number, hardware revision, software revision, etc.", 0, java.lang.Integer.MAX_VALUE, specType));
418          childrenList.add(new Property("componentId", "Identifier", "Describes the internal component unique identification. This is a provision for manufacture specific standard components using a private OID. 11073-10101 has a partition for private OID semantic that the manufacture can make use of.", 0, java.lang.Integer.MAX_VALUE, componentId));
419          childrenList.add(new Property("productionSpec", "string", "Describes the printable string defining the component.", 0, java.lang.Integer.MAX_VALUE, productionSpec));
420        }
421
422      @Override
423      public void setProperty(String name, Base value) throws FHIRException {
424        if (name.equals("specType"))
425          this.specType = castToCodeableConcept(value); // CodeableConcept
426        else if (name.equals("componentId"))
427          this.componentId = castToIdentifier(value); // Identifier
428        else if (name.equals("productionSpec"))
429          this.productionSpec = castToString(value); // StringType
430        else
431          super.setProperty(name, value);
432      }
433
434      @Override
435      public Base addChild(String name) throws FHIRException {
436        if (name.equals("specType")) {
437          this.specType = new CodeableConcept();
438          return this.specType;
439        }
440        else if (name.equals("componentId")) {
441          this.componentId = new Identifier();
442          return this.componentId;
443        }
444        else if (name.equals("productionSpec")) {
445          throw new FHIRException("Cannot call addChild on a primitive type DeviceComponent.productionSpec");
446        }
447        else
448          return super.addChild(name);
449      }
450
451      public DeviceComponentProductionSpecificationComponent copy() {
452        DeviceComponentProductionSpecificationComponent dst = new DeviceComponentProductionSpecificationComponent();
453        copyValues(dst);
454        dst.specType = specType == null ? null : specType.copy();
455        dst.componentId = componentId == null ? null : componentId.copy();
456        dst.productionSpec = productionSpec == null ? null : productionSpec.copy();
457        return dst;
458      }
459
460      @Override
461      public boolean equalsDeep(Base other) {
462        if (!super.equalsDeep(other))
463          return false;
464        if (!(other instanceof DeviceComponentProductionSpecificationComponent))
465          return false;
466        DeviceComponentProductionSpecificationComponent o = (DeviceComponentProductionSpecificationComponent) other;
467        return compareDeep(specType, o.specType, true) && compareDeep(componentId, o.componentId, true)
468           && compareDeep(productionSpec, o.productionSpec, true);
469      }
470
471      @Override
472      public boolean equalsShallow(Base other) {
473        if (!super.equalsShallow(other))
474          return false;
475        if (!(other instanceof DeviceComponentProductionSpecificationComponent))
476          return false;
477        DeviceComponentProductionSpecificationComponent o = (DeviceComponentProductionSpecificationComponent) other;
478        return compareValues(productionSpec, o.productionSpec, true);
479      }
480
481      public boolean isEmpty() {
482        return super.isEmpty() && (specType == null || specType.isEmpty()) && (componentId == null || componentId.isEmpty())
483           && (productionSpec == null || productionSpec.isEmpty());
484      }
485
486  public String fhirType() {
487    return "DeviceComponent.productionSpecification";
488
489  }
490
491  }
492
493    /**
494     * Describes the specific component type as defined in the object-oriented or metric nomenclature partition.
495     */
496    @Child(name = "type", type = {CodeableConcept.class}, order=0, min=1, max=1, modifier=false, summary=true)
497    @Description(shortDefinition="What kind of component it is", formalDefinition="Describes the specific component type as defined in the object-oriented or metric nomenclature partition." )
498    protected CodeableConcept type;
499
500    /**
501     * Describes the local assigned unique identification by the software. For example: handle ID.
502     */
503    @Child(name = "identifier", type = {Identifier.class}, order=1, min=1, max=1, modifier=false, summary=true)
504    @Description(shortDefinition="Instance id assigned by the software stack", formalDefinition="Describes the local assigned unique identification by the software. For example: handle ID." )
505    protected Identifier identifier;
506
507    /**
508     * Describes the timestamp for the most recent system change which includes device configuration or setting change.
509     */
510    @Child(name = "lastSystemChange", type = {InstantType.class}, order=2, min=1, max=1, modifier=false, summary=true)
511    @Description(shortDefinition="Recent system change timestamp", formalDefinition="Describes the timestamp for the most recent system change which includes device configuration or setting change." )
512    protected InstantType lastSystemChange;
513
514    /**
515     * Describes the link to the source Device that contains administrative device information such as manufacture, serial number, etc.
516     */
517    @Child(name = "source", type = {Device.class}, order=3, min=0, max=1, modifier=false, summary=true)
518    @Description(shortDefinition="A source device of this component", formalDefinition="Describes the link to the source Device that contains administrative device information such as manufacture, serial number, etc." )
519    protected Reference source;
520
521    /**
522     * The actual object that is the target of the reference (Describes the link to the source Device that contains administrative device information such as manufacture, serial number, etc.)
523     */
524    protected Device sourceTarget;
525
526    /**
527     * Describes the link to the parent resource. For example: Channel is linked to its VMD parent.
528     */
529    @Child(name = "parent", type = {DeviceComponent.class}, order=4, min=0, max=1, modifier=false, summary=true)
530    @Description(shortDefinition="Parent resource link", formalDefinition="Describes the link to the parent resource. For example: Channel is linked to its VMD parent." )
531    protected Reference parent;
532
533    /**
534     * The actual object that is the target of the reference (Describes the link to the parent resource. For example: Channel is linked to its VMD parent.)
535     */
536    protected DeviceComponent parentTarget;
537
538    /**
539     * Indicates current operational status of the device. For example: On, Off, Standby, etc.
540     */
541    @Child(name = "operationalStatus", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
542    @Description(shortDefinition="Component operational status", formalDefinition="Indicates current operational status of the device. For example: On, Off, Standby, etc." )
543    protected List<CodeableConcept> operationalStatus;
544
545    /**
546     * Describes the parameter group supported by the current device component that is based on some nomenclature, e.g. cardiovascular.
547     */
548    @Child(name = "parameterGroup", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true)
549    @Description(shortDefinition="Current supported parameter group", formalDefinition="Describes the parameter group supported by the current device component that is based on some nomenclature, e.g. cardiovascular." )
550    protected CodeableConcept parameterGroup;
551
552    /**
553     * Describes the physical principle of the measurement. For example: thermal, chemical, acoustical, etc.
554     */
555    @Child(name = "measurementPrinciple", type = {CodeType.class}, order=7, min=0, max=1, modifier=false, summary=true)
556    @Description(shortDefinition="other | chemical | electrical | impedance | nuclear | optical | thermal | biological | mechanical | acoustical | manual+", formalDefinition="Describes the physical principle of the measurement. For example: thermal, chemical, acoustical, etc." )
557    protected Enumeration<MeasmntPrinciple> measurementPrinciple;
558
559    /**
560     * Describes the production specification such as component revision, serial number, etc.
561     */
562    @Child(name = "productionSpecification", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
563    @Description(shortDefinition="Production specification of the component", formalDefinition="Describes the production specification such as component revision, serial number, etc." )
564    protected List<DeviceComponentProductionSpecificationComponent> productionSpecification;
565
566    /**
567     * Describes the language code for the human-readable text string produced by the device. This language code will follow the IETF language tag. Example: en-US.
568     */
569    @Child(name = "languageCode", type = {CodeableConcept.class}, order=9, min=0, max=1, modifier=false, summary=true)
570    @Description(shortDefinition="Language code for the human-readable text strings produced by the device", formalDefinition="Describes the language code for the human-readable text string produced by the device. This language code will follow the IETF language tag. Example: en-US." )
571    protected CodeableConcept languageCode;
572
573    private static final long serialVersionUID = -1742890034L;
574
575  /*
576   * Constructor
577   */
578    public DeviceComponent() {
579      super();
580    }
581
582  /*
583   * Constructor
584   */
585    public DeviceComponent(CodeableConcept type, Identifier identifier, InstantType lastSystemChange) {
586      super();
587      this.type = type;
588      this.identifier = identifier;
589      this.lastSystemChange = lastSystemChange;
590    }
591
592    /**
593     * @return {@link #type} (Describes the specific component type as defined in the object-oriented or metric nomenclature partition.)
594     */
595    public CodeableConcept getType() { 
596      if (this.type == null)
597        if (Configuration.errorOnAutoCreate())
598          throw new Error("Attempt to auto-create DeviceComponent.type");
599        else if (Configuration.doAutoCreate())
600          this.type = new CodeableConcept(); // cc
601      return this.type;
602    }
603
604    public boolean hasType() { 
605      return this.type != null && !this.type.isEmpty();
606    }
607
608    /**
609     * @param value {@link #type} (Describes the specific component type as defined in the object-oriented or metric nomenclature partition.)
610     */
611    public DeviceComponent setType(CodeableConcept value) { 
612      this.type = value;
613      return this;
614    }
615
616    /**
617     * @return {@link #identifier} (Describes the local assigned unique identification by the software. For example: handle ID.)
618     */
619    public Identifier getIdentifier() { 
620      if (this.identifier == null)
621        if (Configuration.errorOnAutoCreate())
622          throw new Error("Attempt to auto-create DeviceComponent.identifier");
623        else if (Configuration.doAutoCreate())
624          this.identifier = new Identifier(); // cc
625      return this.identifier;
626    }
627
628    public boolean hasIdentifier() { 
629      return this.identifier != null && !this.identifier.isEmpty();
630    }
631
632    /**
633     * @param value {@link #identifier} (Describes the local assigned unique identification by the software. For example: handle ID.)
634     */
635    public DeviceComponent setIdentifier(Identifier value) { 
636      this.identifier = value;
637      return this;
638    }
639
640    /**
641     * @return {@link #lastSystemChange} (Describes the timestamp for the most recent system change which includes device configuration or setting change.). This is the underlying object with id, value and extensions. The accessor "getLastSystemChange" gives direct access to the value
642     */
643    public InstantType getLastSystemChangeElement() { 
644      if (this.lastSystemChange == null)
645        if (Configuration.errorOnAutoCreate())
646          throw new Error("Attempt to auto-create DeviceComponent.lastSystemChange");
647        else if (Configuration.doAutoCreate())
648          this.lastSystemChange = new InstantType(); // bb
649      return this.lastSystemChange;
650    }
651
652    public boolean hasLastSystemChangeElement() { 
653      return this.lastSystemChange != null && !this.lastSystemChange.isEmpty();
654    }
655
656    public boolean hasLastSystemChange() { 
657      return this.lastSystemChange != null && !this.lastSystemChange.isEmpty();
658    }
659
660    /**
661     * @param value {@link #lastSystemChange} (Describes the timestamp for the most recent system change which includes device configuration or setting change.). This is the underlying object with id, value and extensions. The accessor "getLastSystemChange" gives direct access to the value
662     */
663    public DeviceComponent setLastSystemChangeElement(InstantType value) { 
664      this.lastSystemChange = value;
665      return this;
666    }
667
668    /**
669     * @return Describes the timestamp for the most recent system change which includes device configuration or setting change.
670     */
671    public Date getLastSystemChange() { 
672      return this.lastSystemChange == null ? null : this.lastSystemChange.getValue();
673    }
674
675    /**
676     * @param value Describes the timestamp for the most recent system change which includes device configuration or setting change.
677     */
678    public DeviceComponent setLastSystemChange(Date value) { 
679        if (this.lastSystemChange == null)
680          this.lastSystemChange = new InstantType();
681        this.lastSystemChange.setValue(value);
682      return this;
683    }
684
685    /**
686     * @return {@link #source} (Describes the link to the source Device that contains administrative device information such as manufacture, serial number, etc.)
687     */
688    public Reference getSource() { 
689      if (this.source == null)
690        if (Configuration.errorOnAutoCreate())
691          throw new Error("Attempt to auto-create DeviceComponent.source");
692        else if (Configuration.doAutoCreate())
693          this.source = new Reference(); // cc
694      return this.source;
695    }
696
697    public boolean hasSource() { 
698      return this.source != null && !this.source.isEmpty();
699    }
700
701    /**
702     * @param value {@link #source} (Describes the link to the source Device that contains administrative device information such as manufacture, serial number, etc.)
703     */
704    public DeviceComponent setSource(Reference value) { 
705      this.source = value;
706      return this;
707    }
708
709    /**
710     * @return {@link #source} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Describes the link to the source Device that contains administrative device information such as manufacture, serial number, etc.)
711     */
712    public Device getSourceTarget() { 
713      if (this.sourceTarget == null)
714        if (Configuration.errorOnAutoCreate())
715          throw new Error("Attempt to auto-create DeviceComponent.source");
716        else if (Configuration.doAutoCreate())
717          this.sourceTarget = new Device(); // aa
718      return this.sourceTarget;
719    }
720
721    /**
722     * @param value {@link #source} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Describes the link to the source Device that contains administrative device information such as manufacture, serial number, etc.)
723     */
724    public DeviceComponent setSourceTarget(Device value) { 
725      this.sourceTarget = value;
726      return this;
727    }
728
729    /**
730     * @return {@link #parent} (Describes the link to the parent resource. For example: Channel is linked to its VMD parent.)
731     */
732    public Reference getParent() { 
733      if (this.parent == null)
734        if (Configuration.errorOnAutoCreate())
735          throw new Error("Attempt to auto-create DeviceComponent.parent");
736        else if (Configuration.doAutoCreate())
737          this.parent = new Reference(); // cc
738      return this.parent;
739    }
740
741    public boolean hasParent() { 
742      return this.parent != null && !this.parent.isEmpty();
743    }
744
745    /**
746     * @param value {@link #parent} (Describes the link to the parent resource. For example: Channel is linked to its VMD parent.)
747     */
748    public DeviceComponent setParent(Reference value) { 
749      this.parent = value;
750      return this;
751    }
752
753    /**
754     * @return {@link #parent} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Describes the link to the parent resource. For example: Channel is linked to its VMD parent.)
755     */
756    public DeviceComponent getParentTarget() { 
757      if (this.parentTarget == null)
758        if (Configuration.errorOnAutoCreate())
759          throw new Error("Attempt to auto-create DeviceComponent.parent");
760        else if (Configuration.doAutoCreate())
761          this.parentTarget = new DeviceComponent(); // aa
762      return this.parentTarget;
763    }
764
765    /**
766     * @param value {@link #parent} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Describes the link to the parent resource. For example: Channel is linked to its VMD parent.)
767     */
768    public DeviceComponent setParentTarget(DeviceComponent value) { 
769      this.parentTarget = value;
770      return this;
771    }
772
773    /**
774     * @return {@link #operationalStatus} (Indicates current operational status of the device. For example: On, Off, Standby, etc.)
775     */
776    public List<CodeableConcept> getOperationalStatus() { 
777      if (this.operationalStatus == null)
778        this.operationalStatus = new ArrayList<CodeableConcept>();
779      return this.operationalStatus;
780    }
781
782    public boolean hasOperationalStatus() { 
783      if (this.operationalStatus == null)
784        return false;
785      for (CodeableConcept item : this.operationalStatus)
786        if (!item.isEmpty())
787          return true;
788      return false;
789    }
790
791    /**
792     * @return {@link #operationalStatus} (Indicates current operational status of the device. For example: On, Off, Standby, etc.)
793     */
794    // syntactic sugar
795    public CodeableConcept addOperationalStatus() { //3
796      CodeableConcept t = new CodeableConcept();
797      if (this.operationalStatus == null)
798        this.operationalStatus = new ArrayList<CodeableConcept>();
799      this.operationalStatus.add(t);
800      return t;
801    }
802
803    // syntactic sugar
804    public DeviceComponent addOperationalStatus(CodeableConcept t) { //3
805      if (t == null)
806        return this;
807      if (this.operationalStatus == null)
808        this.operationalStatus = new ArrayList<CodeableConcept>();
809      this.operationalStatus.add(t);
810      return this;
811    }
812
813    /**
814     * @return {@link #parameterGroup} (Describes the parameter group supported by the current device component that is based on some nomenclature, e.g. cardiovascular.)
815     */
816    public CodeableConcept getParameterGroup() { 
817      if (this.parameterGroup == null)
818        if (Configuration.errorOnAutoCreate())
819          throw new Error("Attempt to auto-create DeviceComponent.parameterGroup");
820        else if (Configuration.doAutoCreate())
821          this.parameterGroup = new CodeableConcept(); // cc
822      return this.parameterGroup;
823    }
824
825    public boolean hasParameterGroup() { 
826      return this.parameterGroup != null && !this.parameterGroup.isEmpty();
827    }
828
829    /**
830     * @param value {@link #parameterGroup} (Describes the parameter group supported by the current device component that is based on some nomenclature, e.g. cardiovascular.)
831     */
832    public DeviceComponent setParameterGroup(CodeableConcept value) { 
833      this.parameterGroup = value;
834      return this;
835    }
836
837    /**
838     * @return {@link #measurementPrinciple} (Describes the physical principle of the measurement. For example: thermal, chemical, acoustical, etc.). This is the underlying object with id, value and extensions. The accessor "getMeasurementPrinciple" gives direct access to the value
839     */
840    public Enumeration<MeasmntPrinciple> getMeasurementPrincipleElement() { 
841      if (this.measurementPrinciple == null)
842        if (Configuration.errorOnAutoCreate())
843          throw new Error("Attempt to auto-create DeviceComponent.measurementPrinciple");
844        else if (Configuration.doAutoCreate())
845          this.measurementPrinciple = new Enumeration<MeasmntPrinciple>(new MeasmntPrincipleEnumFactory()); // bb
846      return this.measurementPrinciple;
847    }
848
849    public boolean hasMeasurementPrincipleElement() { 
850      return this.measurementPrinciple != null && !this.measurementPrinciple.isEmpty();
851    }
852
853    public boolean hasMeasurementPrinciple() { 
854      return this.measurementPrinciple != null && !this.measurementPrinciple.isEmpty();
855    }
856
857    /**
858     * @param value {@link #measurementPrinciple} (Describes the physical principle of the measurement. For example: thermal, chemical, acoustical, etc.). This is the underlying object with id, value and extensions. The accessor "getMeasurementPrinciple" gives direct access to the value
859     */
860    public DeviceComponent setMeasurementPrincipleElement(Enumeration<MeasmntPrinciple> value) { 
861      this.measurementPrinciple = value;
862      return this;
863    }
864
865    /**
866     * @return Describes the physical principle of the measurement. For example: thermal, chemical, acoustical, etc.
867     */
868    public MeasmntPrinciple getMeasurementPrinciple() { 
869      return this.measurementPrinciple == null ? null : this.measurementPrinciple.getValue();
870    }
871
872    /**
873     * @param value Describes the physical principle of the measurement. For example: thermal, chemical, acoustical, etc.
874     */
875    public DeviceComponent setMeasurementPrinciple(MeasmntPrinciple value) { 
876      if (value == null)
877        this.measurementPrinciple = null;
878      else {
879        if (this.measurementPrinciple == null)
880          this.measurementPrinciple = new Enumeration<MeasmntPrinciple>(new MeasmntPrincipleEnumFactory());
881        this.measurementPrinciple.setValue(value);
882      }
883      return this;
884    }
885
886    /**
887     * @return {@link #productionSpecification} (Describes the production specification such as component revision, serial number, etc.)
888     */
889    public List<DeviceComponentProductionSpecificationComponent> getProductionSpecification() { 
890      if (this.productionSpecification == null)
891        this.productionSpecification = new ArrayList<DeviceComponentProductionSpecificationComponent>();
892      return this.productionSpecification;
893    }
894
895    public boolean hasProductionSpecification() { 
896      if (this.productionSpecification == null)
897        return false;
898      for (DeviceComponentProductionSpecificationComponent item : this.productionSpecification)
899        if (!item.isEmpty())
900          return true;
901      return false;
902    }
903
904    /**
905     * @return {@link #productionSpecification} (Describes the production specification such as component revision, serial number, etc.)
906     */
907    // syntactic sugar
908    public DeviceComponentProductionSpecificationComponent addProductionSpecification() { //3
909      DeviceComponentProductionSpecificationComponent t = new DeviceComponentProductionSpecificationComponent();
910      if (this.productionSpecification == null)
911        this.productionSpecification = new ArrayList<DeviceComponentProductionSpecificationComponent>();
912      this.productionSpecification.add(t);
913      return t;
914    }
915
916    // syntactic sugar
917    public DeviceComponent addProductionSpecification(DeviceComponentProductionSpecificationComponent t) { //3
918      if (t == null)
919        return this;
920      if (this.productionSpecification == null)
921        this.productionSpecification = new ArrayList<DeviceComponentProductionSpecificationComponent>();
922      this.productionSpecification.add(t);
923      return this;
924    }
925
926    /**
927     * @return {@link #languageCode} (Describes the language code for the human-readable text string produced by the device. This language code will follow the IETF language tag. Example: en-US.)
928     */
929    public CodeableConcept getLanguageCode() { 
930      if (this.languageCode == null)
931        if (Configuration.errorOnAutoCreate())
932          throw new Error("Attempt to auto-create DeviceComponent.languageCode");
933        else if (Configuration.doAutoCreate())
934          this.languageCode = new CodeableConcept(); // cc
935      return this.languageCode;
936    }
937
938    public boolean hasLanguageCode() { 
939      return this.languageCode != null && !this.languageCode.isEmpty();
940    }
941
942    /**
943     * @param value {@link #languageCode} (Describes the language code for the human-readable text string produced by the device. This language code will follow the IETF language tag. Example: en-US.)
944     */
945    public DeviceComponent setLanguageCode(CodeableConcept value) { 
946      this.languageCode = value;
947      return this;
948    }
949
950      protected void listChildren(List<Property> childrenList) {
951        super.listChildren(childrenList);
952        childrenList.add(new Property("type", "CodeableConcept", "Describes the specific component type as defined in the object-oriented or metric nomenclature partition.", 0, java.lang.Integer.MAX_VALUE, type));
953        childrenList.add(new Property("identifier", "Identifier", "Describes the local assigned unique identification by the software. For example: handle ID.", 0, java.lang.Integer.MAX_VALUE, identifier));
954        childrenList.add(new Property("lastSystemChange", "instant", "Describes the timestamp for the most recent system change which includes device configuration or setting change.", 0, java.lang.Integer.MAX_VALUE, lastSystemChange));
955        childrenList.add(new Property("source", "Reference(Device)", "Describes the link to the source Device that contains administrative device information such as manufacture, serial number, etc.", 0, java.lang.Integer.MAX_VALUE, source));
956        childrenList.add(new Property("parent", "Reference(DeviceComponent)", "Describes the link to the parent resource. For example: Channel is linked to its VMD parent.", 0, java.lang.Integer.MAX_VALUE, parent));
957        childrenList.add(new Property("operationalStatus", "CodeableConcept", "Indicates current operational status of the device. For example: On, Off, Standby, etc.", 0, java.lang.Integer.MAX_VALUE, operationalStatus));
958        childrenList.add(new Property("parameterGroup", "CodeableConcept", "Describes the parameter group supported by the current device component that is based on some nomenclature, e.g. cardiovascular.", 0, java.lang.Integer.MAX_VALUE, parameterGroup));
959        childrenList.add(new Property("measurementPrinciple", "code", "Describes the physical principle of the measurement. For example: thermal, chemical, acoustical, etc.", 0, java.lang.Integer.MAX_VALUE, measurementPrinciple));
960        childrenList.add(new Property("productionSpecification", "", "Describes the production specification such as component revision, serial number, etc.", 0, java.lang.Integer.MAX_VALUE, productionSpecification));
961        childrenList.add(new Property("languageCode", "CodeableConcept", "Describes the language code for the human-readable text string produced by the device. This language code will follow the IETF language tag. Example: en-US.", 0, java.lang.Integer.MAX_VALUE, languageCode));
962      }
963
964      @Override
965      public void setProperty(String name, Base value) throws FHIRException {
966        if (name.equals("type"))
967          this.type = castToCodeableConcept(value); // CodeableConcept
968        else if (name.equals("identifier"))
969          this.identifier = castToIdentifier(value); // Identifier
970        else if (name.equals("lastSystemChange"))
971          this.lastSystemChange = castToInstant(value); // InstantType
972        else if (name.equals("source"))
973          this.source = castToReference(value); // Reference
974        else if (name.equals("parent"))
975          this.parent = castToReference(value); // Reference
976        else if (name.equals("operationalStatus"))
977          this.getOperationalStatus().add(castToCodeableConcept(value));
978        else if (name.equals("parameterGroup"))
979          this.parameterGroup = castToCodeableConcept(value); // CodeableConcept
980        else if (name.equals("measurementPrinciple"))
981          this.measurementPrinciple = new MeasmntPrincipleEnumFactory().fromType(value); // Enumeration<MeasmntPrinciple>
982        else if (name.equals("productionSpecification"))
983          this.getProductionSpecification().add((DeviceComponentProductionSpecificationComponent) value);
984        else if (name.equals("languageCode"))
985          this.languageCode = castToCodeableConcept(value); // CodeableConcept
986        else
987          super.setProperty(name, value);
988      }
989
990      @Override
991      public Base addChild(String name) throws FHIRException {
992        if (name.equals("type")) {
993          this.type = new CodeableConcept();
994          return this.type;
995        }
996        else if (name.equals("identifier")) {
997          this.identifier = new Identifier();
998          return this.identifier;
999        }
1000        else if (name.equals("lastSystemChange")) {
1001          throw new FHIRException("Cannot call addChild on a primitive type DeviceComponent.lastSystemChange");
1002        }
1003        else if (name.equals("source")) {
1004          this.source = new Reference();
1005          return this.source;
1006        }
1007        else if (name.equals("parent")) {
1008          this.parent = new Reference();
1009          return this.parent;
1010        }
1011        else if (name.equals("operationalStatus")) {
1012          return addOperationalStatus();
1013        }
1014        else if (name.equals("parameterGroup")) {
1015          this.parameterGroup = new CodeableConcept();
1016          return this.parameterGroup;
1017        }
1018        else if (name.equals("measurementPrinciple")) {
1019          throw new FHIRException("Cannot call addChild on a primitive type DeviceComponent.measurementPrinciple");
1020        }
1021        else if (name.equals("productionSpecification")) {
1022          return addProductionSpecification();
1023        }
1024        else if (name.equals("languageCode")) {
1025          this.languageCode = new CodeableConcept();
1026          return this.languageCode;
1027        }
1028        else
1029          return super.addChild(name);
1030      }
1031
1032  public String fhirType() {
1033    return "DeviceComponent";
1034
1035  }
1036
1037      public DeviceComponent copy() {
1038        DeviceComponent dst = new DeviceComponent();
1039        copyValues(dst);
1040        dst.type = type == null ? null : type.copy();
1041        dst.identifier = identifier == null ? null : identifier.copy();
1042        dst.lastSystemChange = lastSystemChange == null ? null : lastSystemChange.copy();
1043        dst.source = source == null ? null : source.copy();
1044        dst.parent = parent == null ? null : parent.copy();
1045        if (operationalStatus != null) {
1046          dst.operationalStatus = new ArrayList<CodeableConcept>();
1047          for (CodeableConcept i : operationalStatus)
1048            dst.operationalStatus.add(i.copy());
1049        };
1050        dst.parameterGroup = parameterGroup == null ? null : parameterGroup.copy();
1051        dst.measurementPrinciple = measurementPrinciple == null ? null : measurementPrinciple.copy();
1052        if (productionSpecification != null) {
1053          dst.productionSpecification = new ArrayList<DeviceComponentProductionSpecificationComponent>();
1054          for (DeviceComponentProductionSpecificationComponent i : productionSpecification)
1055            dst.productionSpecification.add(i.copy());
1056        };
1057        dst.languageCode = languageCode == null ? null : languageCode.copy();
1058        return dst;
1059      }
1060
1061      protected DeviceComponent typedCopy() {
1062        return copy();
1063      }
1064
1065      @Override
1066      public boolean equalsDeep(Base other) {
1067        if (!super.equalsDeep(other))
1068          return false;
1069        if (!(other instanceof DeviceComponent))
1070          return false;
1071        DeviceComponent o = (DeviceComponent) other;
1072        return compareDeep(type, o.type, true) && compareDeep(identifier, o.identifier, true) && compareDeep(lastSystemChange, o.lastSystemChange, true)
1073           && compareDeep(source, o.source, true) && compareDeep(parent, o.parent, true) && compareDeep(operationalStatus, o.operationalStatus, true)
1074           && compareDeep(parameterGroup, o.parameterGroup, true) && compareDeep(measurementPrinciple, o.measurementPrinciple, true)
1075           && compareDeep(productionSpecification, o.productionSpecification, true) && compareDeep(languageCode, o.languageCode, true)
1076          ;
1077      }
1078
1079      @Override
1080      public boolean equalsShallow(Base other) {
1081        if (!super.equalsShallow(other))
1082          return false;
1083        if (!(other instanceof DeviceComponent))
1084          return false;
1085        DeviceComponent o = (DeviceComponent) other;
1086        return compareValues(lastSystemChange, o.lastSystemChange, true) && compareValues(measurementPrinciple, o.measurementPrinciple, true)
1087          ;
1088      }
1089
1090      public boolean isEmpty() {
1091        return super.isEmpty() && (type == null || type.isEmpty()) && (identifier == null || identifier.isEmpty())
1092           && (lastSystemChange == null || lastSystemChange.isEmpty()) && (source == null || source.isEmpty())
1093           && (parent == null || parent.isEmpty()) && (operationalStatus == null || operationalStatus.isEmpty())
1094           && (parameterGroup == null || parameterGroup.isEmpty()) && (measurementPrinciple == null || measurementPrinciple.isEmpty())
1095           && (productionSpecification == null || productionSpecification.isEmpty()) && (languageCode == null || languageCode.isEmpty())
1096          ;
1097      }
1098
1099  @Override
1100  public ResourceType getResourceType() {
1101    return ResourceType.DeviceComponent;
1102   }
1103
1104  @SearchParamDefinition(name="parent", path="DeviceComponent.parent", description="The parent DeviceComponent resource", type="reference" )
1105  public static final String SP_PARENT = "parent";
1106  @SearchParamDefinition(name="source", path="DeviceComponent.source", description="The device source", type="reference" )
1107  public static final String SP_SOURCE = "source";
1108  @SearchParamDefinition(name="type", path="DeviceComponent.type", description="The device component type", type="token" )
1109  public static final String SP_TYPE = "type";
1110
1111}