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            default: return "?";
144          }
145        }
146        public String getSystem() {
147          switch (this) {
148            case OTHER: return "http://hl7.org/fhir/measurement-principle";
149            case CHEMICAL: return "http://hl7.org/fhir/measurement-principle";
150            case ELECTRICAL: return "http://hl7.org/fhir/measurement-principle";
151            case IMPEDANCE: return "http://hl7.org/fhir/measurement-principle";
152            case NUCLEAR: return "http://hl7.org/fhir/measurement-principle";
153            case OPTICAL: return "http://hl7.org/fhir/measurement-principle";
154            case THERMAL: return "http://hl7.org/fhir/measurement-principle";
155            case BIOLOGICAL: return "http://hl7.org/fhir/measurement-principle";
156            case MECHANICAL: return "http://hl7.org/fhir/measurement-principle";
157            case ACOUSTICAL: return "http://hl7.org/fhir/measurement-principle";
158            case MANUAL: return "http://hl7.org/fhir/measurement-principle";
159            default: return "?";
160          }
161        }
162        public String getDefinition() {
163          switch (this) {
164            case OTHER: return "Measurement principle isn't in the list.";
165            case CHEMICAL: return "Measurement is done using the chemical principle.";
166            case ELECTRICAL: return "Measurement is done using the electrical principle.";
167            case IMPEDANCE: return "Measurement is done using the impedance principle.";
168            case NUCLEAR: return "Measurement is done using the nuclear principle.";
169            case OPTICAL: return "Measurement is done using the optical principle.";
170            case THERMAL: return "Measurement is done using the thermal principle.";
171            case BIOLOGICAL: return "Measurement is done using the biological principle.";
172            case MECHANICAL: return "Measurement is done using the mechanical principle.";
173            case ACOUSTICAL: return "Measurement is done using the acoustical principle.";
174            case MANUAL: return "Measurement is done using the manual principle.";
175            default: return "?";
176          }
177        }
178        public String getDisplay() {
179          switch (this) {
180            case OTHER: return "MSP Other";
181            case CHEMICAL: return "MSP Chemical";
182            case ELECTRICAL: return "MSP Electrical";
183            case IMPEDANCE: return "MSP Impedance";
184            case NUCLEAR: return "MSP Nuclear";
185            case OPTICAL: return "MSP Optical";
186            case THERMAL: return "MSP Thermal";
187            case BIOLOGICAL: return "MSP Biological";
188            case MECHANICAL: return "MSP Mechanical";
189            case ACOUSTICAL: return "MSP Acoustical";
190            case MANUAL: return "MSP Manual";
191            default: return "?";
192          }
193        }
194    }
195
196  public static class MeasmntPrincipleEnumFactory implements EnumFactory<MeasmntPrinciple> {
197    public MeasmntPrinciple fromCode(String codeString) throws IllegalArgumentException {
198      if (codeString == null || "".equals(codeString))
199            if (codeString == null || "".equals(codeString))
200                return null;
201        if ("other".equals(codeString))
202          return MeasmntPrinciple.OTHER;
203        if ("chemical".equals(codeString))
204          return MeasmntPrinciple.CHEMICAL;
205        if ("electrical".equals(codeString))
206          return MeasmntPrinciple.ELECTRICAL;
207        if ("impedance".equals(codeString))
208          return MeasmntPrinciple.IMPEDANCE;
209        if ("nuclear".equals(codeString))
210          return MeasmntPrinciple.NUCLEAR;
211        if ("optical".equals(codeString))
212          return MeasmntPrinciple.OPTICAL;
213        if ("thermal".equals(codeString))
214          return MeasmntPrinciple.THERMAL;
215        if ("biological".equals(codeString))
216          return MeasmntPrinciple.BIOLOGICAL;
217        if ("mechanical".equals(codeString))
218          return MeasmntPrinciple.MECHANICAL;
219        if ("acoustical".equals(codeString))
220          return MeasmntPrinciple.ACOUSTICAL;
221        if ("manual".equals(codeString))
222          return MeasmntPrinciple.MANUAL;
223        throw new IllegalArgumentException("Unknown MeasmntPrinciple code '"+codeString+"'");
224        }
225        public Enumeration<MeasmntPrinciple> fromType(Base code) throws FHIRException {
226          if (code == null || code.isEmpty())
227            return null;
228          String codeString = ((PrimitiveType) code).asStringValue();
229          if (codeString == null || "".equals(codeString))
230            return null;
231        if ("other".equals(codeString))
232          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.OTHER);
233        if ("chemical".equals(codeString))
234          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.CHEMICAL);
235        if ("electrical".equals(codeString))
236          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.ELECTRICAL);
237        if ("impedance".equals(codeString))
238          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.IMPEDANCE);
239        if ("nuclear".equals(codeString))
240          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.NUCLEAR);
241        if ("optical".equals(codeString))
242          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.OPTICAL);
243        if ("thermal".equals(codeString))
244          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.THERMAL);
245        if ("biological".equals(codeString))
246          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.BIOLOGICAL);
247        if ("mechanical".equals(codeString))
248          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.MECHANICAL);
249        if ("acoustical".equals(codeString))
250          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.ACOUSTICAL);
251        if ("manual".equals(codeString))
252          return new Enumeration<MeasmntPrinciple>(this, MeasmntPrinciple.MANUAL);
253        throw new FHIRException("Unknown MeasmntPrinciple code '"+codeString+"'");
254        }
255    public String toCode(MeasmntPrinciple code) {
256      if (code == MeasmntPrinciple.OTHER)
257        return "other";
258      if (code == MeasmntPrinciple.CHEMICAL)
259        return "chemical";
260      if (code == MeasmntPrinciple.ELECTRICAL)
261        return "electrical";
262      if (code == MeasmntPrinciple.IMPEDANCE)
263        return "impedance";
264      if (code == MeasmntPrinciple.NUCLEAR)
265        return "nuclear";
266      if (code == MeasmntPrinciple.OPTICAL)
267        return "optical";
268      if (code == MeasmntPrinciple.THERMAL)
269        return "thermal";
270      if (code == MeasmntPrinciple.BIOLOGICAL)
271        return "biological";
272      if (code == MeasmntPrinciple.MECHANICAL)
273        return "mechanical";
274      if (code == MeasmntPrinciple.ACOUSTICAL)
275        return "acoustical";
276      if (code == MeasmntPrinciple.MANUAL)
277        return "manual";
278      return "?";
279      }
280    }
281
282    @Block()
283    public static class DeviceComponentProductionSpecificationComponent extends BackboneElement implements IBaseBackboneElement {
284        /**
285         * Describes the specification type, such as, serial number, part number, hardware revision, software revision, etc.
286         */
287        @Child(name = "specType", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
288        @Description(shortDefinition="Specification type", formalDefinition="Describes the specification type, such as, serial number, part number, hardware revision, software revision, etc." )
289        protected CodeableConcept specType;
290
291        /**
292         * 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.
293         */
294        @Child(name = "componentId", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=true)
295        @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." )
296        protected Identifier componentId;
297
298        /**
299         * Describes the printable string defining the component.
300         */
301        @Child(name = "productionSpec", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
302        @Description(shortDefinition="A printable string defining the component", formalDefinition="Describes the printable string defining the component." )
303        protected StringType productionSpec;
304
305        private static final long serialVersionUID = -1476597516L;
306
307    /*
308     * Constructor
309     */
310      public DeviceComponentProductionSpecificationComponent() {
311        super();
312      }
313
314        /**
315         * @return {@link #specType} (Describes the specification type, such as, serial number, part number, hardware revision, software revision, etc.)
316         */
317        public CodeableConcept getSpecType() { 
318          if (this.specType == null)
319            if (Configuration.errorOnAutoCreate())
320              throw new Error("Attempt to auto-create DeviceComponentProductionSpecificationComponent.specType");
321            else if (Configuration.doAutoCreate())
322              this.specType = new CodeableConcept(); // cc
323          return this.specType;
324        }
325
326        public boolean hasSpecType() { 
327          return this.specType != null && !this.specType.isEmpty();
328        }
329
330        /**
331         * @param value {@link #specType} (Describes the specification type, such as, serial number, part number, hardware revision, software revision, etc.)
332         */
333        public DeviceComponentProductionSpecificationComponent setSpecType(CodeableConcept value) { 
334          this.specType = value;
335          return this;
336        }
337
338        /**
339         * @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.)
340         */
341        public Identifier getComponentId() { 
342          if (this.componentId == null)
343            if (Configuration.errorOnAutoCreate())
344              throw new Error("Attempt to auto-create DeviceComponentProductionSpecificationComponent.componentId");
345            else if (Configuration.doAutoCreate())
346              this.componentId = new Identifier(); // cc
347          return this.componentId;
348        }
349
350        public boolean hasComponentId() { 
351          return this.componentId != null && !this.componentId.isEmpty();
352        }
353
354        /**
355         * @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.)
356         */
357        public DeviceComponentProductionSpecificationComponent setComponentId(Identifier value) { 
358          this.componentId = value;
359          return this;
360        }
361
362        /**
363         * @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
364         */
365        public StringType getProductionSpecElement() { 
366          if (this.productionSpec == null)
367            if (Configuration.errorOnAutoCreate())
368              throw new Error("Attempt to auto-create DeviceComponentProductionSpecificationComponent.productionSpec");
369            else if (Configuration.doAutoCreate())
370              this.productionSpec = new StringType(); // bb
371          return this.productionSpec;
372        }
373
374        public boolean hasProductionSpecElement() { 
375          return this.productionSpec != null && !this.productionSpec.isEmpty();
376        }
377
378        public boolean hasProductionSpec() { 
379          return this.productionSpec != null && !this.productionSpec.isEmpty();
380        }
381
382        /**
383         * @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
384         */
385        public DeviceComponentProductionSpecificationComponent setProductionSpecElement(StringType value) { 
386          this.productionSpec = value;
387          return this;
388        }
389
390        /**
391         * @return Describes the printable string defining the component.
392         */
393        public String getProductionSpec() { 
394          return this.productionSpec == null ? null : this.productionSpec.getValue();
395        }
396
397        /**
398         * @param value Describes the printable string defining the component.
399         */
400        public DeviceComponentProductionSpecificationComponent setProductionSpec(String value) { 
401          if (Utilities.noString(value))
402            this.productionSpec = null;
403          else {
404            if (this.productionSpec == null)
405              this.productionSpec = new StringType();
406            this.productionSpec.setValue(value);
407          }
408          return this;
409        }
410
411        protected void listChildren(List<Property> childrenList) {
412          super.listChildren(childrenList);
413          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));
414          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));
415          childrenList.add(new Property("productionSpec", "string", "Describes the printable string defining the component.", 0, java.lang.Integer.MAX_VALUE, productionSpec));
416        }
417
418      @Override
419      public void setProperty(String name, Base value) throws FHIRException {
420        if (name.equals("specType"))
421          this.specType = castToCodeableConcept(value); // CodeableConcept
422        else if (name.equals("componentId"))
423          this.componentId = castToIdentifier(value); // Identifier
424        else if (name.equals("productionSpec"))
425          this.productionSpec = castToString(value); // StringType
426        else
427          super.setProperty(name, value);
428      }
429
430      @Override
431      public Base addChild(String name) throws FHIRException {
432        if (name.equals("specType")) {
433          this.specType = new CodeableConcept();
434          return this.specType;
435        }
436        else if (name.equals("componentId")) {
437          this.componentId = new Identifier();
438          return this.componentId;
439        }
440        else if (name.equals("productionSpec")) {
441          throw new FHIRException("Cannot call addChild on a primitive type DeviceComponent.productionSpec");
442        }
443        else
444          return super.addChild(name);
445      }
446
447      public DeviceComponentProductionSpecificationComponent copy() {
448        DeviceComponentProductionSpecificationComponent dst = new DeviceComponentProductionSpecificationComponent();
449        copyValues(dst);
450        dst.specType = specType == null ? null : specType.copy();
451        dst.componentId = componentId == null ? null : componentId.copy();
452        dst.productionSpec = productionSpec == null ? null : productionSpec.copy();
453        return dst;
454      }
455
456      @Override
457      public boolean equalsDeep(Base other) {
458        if (!super.equalsDeep(other))
459          return false;
460        if (!(other instanceof DeviceComponentProductionSpecificationComponent))
461          return false;
462        DeviceComponentProductionSpecificationComponent o = (DeviceComponentProductionSpecificationComponent) other;
463        return compareDeep(specType, o.specType, true) && compareDeep(componentId, o.componentId, true)
464           && compareDeep(productionSpec, o.productionSpec, true);
465      }
466
467      @Override
468      public boolean equalsShallow(Base other) {
469        if (!super.equalsShallow(other))
470          return false;
471        if (!(other instanceof DeviceComponentProductionSpecificationComponent))
472          return false;
473        DeviceComponentProductionSpecificationComponent o = (DeviceComponentProductionSpecificationComponent) other;
474        return compareValues(productionSpec, o.productionSpec, true);
475      }
476
477      public boolean isEmpty() {
478        return super.isEmpty() && (specType == null || specType.isEmpty()) && (componentId == null || componentId.isEmpty())
479           && (productionSpec == null || productionSpec.isEmpty());
480      }
481
482  public String fhirType() {
483    return "DeviceComponent.productionSpecification";
484
485  }
486
487  }
488
489    /**
490     * Describes the specific component type as defined in the object-oriented or metric nomenclature partition.
491     */
492    @Child(name = "type", type = {CodeableConcept.class}, order=0, min=1, max=1, modifier=false, summary=true)
493    @Description(shortDefinition="What kind of component it is", formalDefinition="Describes the specific component type as defined in the object-oriented or metric nomenclature partition." )
494    protected CodeableConcept type;
495
496    /**
497     * Describes the local assigned unique identification by the software. For example: handle ID.
498     */
499    @Child(name = "identifier", type = {Identifier.class}, order=1, min=1, max=1, modifier=false, summary=true)
500    @Description(shortDefinition="Instance id assigned by the software stack", formalDefinition="Describes the local assigned unique identification by the software. For example: handle ID." )
501    protected Identifier identifier;
502
503    /**
504     * Describes the timestamp for the most recent system change which includes device configuration or setting change.
505     */
506    @Child(name = "lastSystemChange", type = {InstantType.class}, order=2, min=1, max=1, modifier=false, summary=true)
507    @Description(shortDefinition="Recent system change timestamp", formalDefinition="Describes the timestamp for the most recent system change which includes device configuration or setting change." )
508    protected InstantType lastSystemChange;
509
510    /**
511     * Describes the link to the source Device that contains administrative device information such as manufacture, serial number, etc.
512     */
513    @Child(name = "source", type = {Device.class}, order=3, min=0, max=1, modifier=false, summary=true)
514    @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." )
515    protected Reference source;
516
517    /**
518     * 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.)
519     */
520    protected Device sourceTarget;
521
522    /**
523     * Describes the link to the parent resource. For example: Channel is linked to its VMD parent.
524     */
525    @Child(name = "parent", type = {DeviceComponent.class}, order=4, min=0, max=1, modifier=false, summary=true)
526    @Description(shortDefinition="Parent resource link", formalDefinition="Describes the link to the parent resource. For example: Channel is linked to its VMD parent." )
527    protected Reference parent;
528
529    /**
530     * 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.)
531     */
532    protected DeviceComponent parentTarget;
533
534    /**
535     * Indicates current operational status of the device. For example: On, Off, Standby, etc.
536     */
537    @Child(name = "operationalStatus", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
538    @Description(shortDefinition="Component operational status", formalDefinition="Indicates current operational status of the device. For example: On, Off, Standby, etc." )
539    protected List<CodeableConcept> operationalStatus;
540
541    /**
542     * Describes the parameter group supported by the current device component that is based on some nomenclature, e.g. cardiovascular.
543     */
544    @Child(name = "parameterGroup", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true)
545    @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." )
546    protected CodeableConcept parameterGroup;
547
548    /**
549     * Describes the physical principle of the measurement. For example: thermal, chemical, acoustical, etc.
550     */
551    @Child(name = "measurementPrinciple", type = {CodeType.class}, order=7, min=0, max=1, modifier=false, summary=true)
552    @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." )
553    protected Enumeration<MeasmntPrinciple> measurementPrinciple;
554
555    /**
556     * Describes the production specification such as component revision, serial number, etc.
557     */
558    @Child(name = "productionSpecification", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
559    @Description(shortDefinition="Production specification of the component", formalDefinition="Describes the production specification such as component revision, serial number, etc." )
560    protected List<DeviceComponentProductionSpecificationComponent> productionSpecification;
561
562    /**
563     * 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.
564     */
565    @Child(name = "languageCode", type = {CodeableConcept.class}, order=9, min=0, max=1, modifier=false, summary=true)
566    @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." )
567    protected CodeableConcept languageCode;
568
569    private static final long serialVersionUID = -1742890034L;
570
571  /*
572   * Constructor
573   */
574    public DeviceComponent() {
575      super();
576    }
577
578  /*
579   * Constructor
580   */
581    public DeviceComponent(CodeableConcept type, Identifier identifier, InstantType lastSystemChange) {
582      super();
583      this.type = type;
584      this.identifier = identifier;
585      this.lastSystemChange = lastSystemChange;
586    }
587
588    /**
589     * @return {@link #type} (Describes the specific component type as defined in the object-oriented or metric nomenclature partition.)
590     */
591    public CodeableConcept getType() { 
592      if (this.type == null)
593        if (Configuration.errorOnAutoCreate())
594          throw new Error("Attempt to auto-create DeviceComponent.type");
595        else if (Configuration.doAutoCreate())
596          this.type = new CodeableConcept(); // cc
597      return this.type;
598    }
599
600    public boolean hasType() { 
601      return this.type != null && !this.type.isEmpty();
602    }
603
604    /**
605     * @param value {@link #type} (Describes the specific component type as defined in the object-oriented or metric nomenclature partition.)
606     */
607    public DeviceComponent setType(CodeableConcept value) { 
608      this.type = value;
609      return this;
610    }
611
612    /**
613     * @return {@link #identifier} (Describes the local assigned unique identification by the software. For example: handle ID.)
614     */
615    public Identifier getIdentifier() { 
616      if (this.identifier == null)
617        if (Configuration.errorOnAutoCreate())
618          throw new Error("Attempt to auto-create DeviceComponent.identifier");
619        else if (Configuration.doAutoCreate())
620          this.identifier = new Identifier(); // cc
621      return this.identifier;
622    }
623
624    public boolean hasIdentifier() { 
625      return this.identifier != null && !this.identifier.isEmpty();
626    }
627
628    /**
629     * @param value {@link #identifier} (Describes the local assigned unique identification by the software. For example: handle ID.)
630     */
631    public DeviceComponent setIdentifier(Identifier value) { 
632      this.identifier = value;
633      return this;
634    }
635
636    /**
637     * @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
638     */
639    public InstantType getLastSystemChangeElement() { 
640      if (this.lastSystemChange == null)
641        if (Configuration.errorOnAutoCreate())
642          throw new Error("Attempt to auto-create DeviceComponent.lastSystemChange");
643        else if (Configuration.doAutoCreate())
644          this.lastSystemChange = new InstantType(); // bb
645      return this.lastSystemChange;
646    }
647
648    public boolean hasLastSystemChangeElement() { 
649      return this.lastSystemChange != null && !this.lastSystemChange.isEmpty();
650    }
651
652    public boolean hasLastSystemChange() { 
653      return this.lastSystemChange != null && !this.lastSystemChange.isEmpty();
654    }
655
656    /**
657     * @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
658     */
659    public DeviceComponent setLastSystemChangeElement(InstantType value) { 
660      this.lastSystemChange = value;
661      return this;
662    }
663
664    /**
665     * @return Describes the timestamp for the most recent system change which includes device configuration or setting change.
666     */
667    public Date getLastSystemChange() { 
668      return this.lastSystemChange == null ? null : this.lastSystemChange.getValue();
669    }
670
671    /**
672     * @param value Describes the timestamp for the most recent system change which includes device configuration or setting change.
673     */
674    public DeviceComponent setLastSystemChange(Date value) { 
675        if (this.lastSystemChange == null)
676          this.lastSystemChange = new InstantType();
677        this.lastSystemChange.setValue(value);
678      return this;
679    }
680
681    /**
682     * @return {@link #source} (Describes the link to the source Device that contains administrative device information such as manufacture, serial number, etc.)
683     */
684    public Reference getSource() { 
685      if (this.source == null)
686        if (Configuration.errorOnAutoCreate())
687          throw new Error("Attempt to auto-create DeviceComponent.source");
688        else if (Configuration.doAutoCreate())
689          this.source = new Reference(); // cc
690      return this.source;
691    }
692
693    public boolean hasSource() { 
694      return this.source != null && !this.source.isEmpty();
695    }
696
697    /**
698     * @param value {@link #source} (Describes the link to the source Device that contains administrative device information such as manufacture, serial number, etc.)
699     */
700    public DeviceComponent setSource(Reference value) { 
701      this.source = value;
702      return this;
703    }
704
705    /**
706     * @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.)
707     */
708    public Device getSourceTarget() { 
709      if (this.sourceTarget == null)
710        if (Configuration.errorOnAutoCreate())
711          throw new Error("Attempt to auto-create DeviceComponent.source");
712        else if (Configuration.doAutoCreate())
713          this.sourceTarget = new Device(); // aa
714      return this.sourceTarget;
715    }
716
717    /**
718     * @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.)
719     */
720    public DeviceComponent setSourceTarget(Device value) { 
721      this.sourceTarget = value;
722      return this;
723    }
724
725    /**
726     * @return {@link #parent} (Describes the link to the parent resource. For example: Channel is linked to its VMD parent.)
727     */
728    public Reference getParent() { 
729      if (this.parent == null)
730        if (Configuration.errorOnAutoCreate())
731          throw new Error("Attempt to auto-create DeviceComponent.parent");
732        else if (Configuration.doAutoCreate())
733          this.parent = new Reference(); // cc
734      return this.parent;
735    }
736
737    public boolean hasParent() { 
738      return this.parent != null && !this.parent.isEmpty();
739    }
740
741    /**
742     * @param value {@link #parent} (Describes the link to the parent resource. For example: Channel is linked to its VMD parent.)
743     */
744    public DeviceComponent setParent(Reference value) { 
745      this.parent = value;
746      return this;
747    }
748
749    /**
750     * @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.)
751     */
752    public DeviceComponent getParentTarget() { 
753      if (this.parentTarget == null)
754        if (Configuration.errorOnAutoCreate())
755          throw new Error("Attempt to auto-create DeviceComponent.parent");
756        else if (Configuration.doAutoCreate())
757          this.parentTarget = new DeviceComponent(); // aa
758      return this.parentTarget;
759    }
760
761    /**
762     * @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.)
763     */
764    public DeviceComponent setParentTarget(DeviceComponent value) { 
765      this.parentTarget = value;
766      return this;
767    }
768
769    /**
770     * @return {@link #operationalStatus} (Indicates current operational status of the device. For example: On, Off, Standby, etc.)
771     */
772    public List<CodeableConcept> getOperationalStatus() { 
773      if (this.operationalStatus == null)
774        this.operationalStatus = new ArrayList<CodeableConcept>();
775      return this.operationalStatus;
776    }
777
778    public boolean hasOperationalStatus() { 
779      if (this.operationalStatus == null)
780        return false;
781      for (CodeableConcept item : this.operationalStatus)
782        if (!item.isEmpty())
783          return true;
784      return false;
785    }
786
787    /**
788     * @return {@link #operationalStatus} (Indicates current operational status of the device. For example: On, Off, Standby, etc.)
789     */
790    // syntactic sugar
791    public CodeableConcept addOperationalStatus() { //3
792      CodeableConcept t = new CodeableConcept();
793      if (this.operationalStatus == null)
794        this.operationalStatus = new ArrayList<CodeableConcept>();
795      this.operationalStatus.add(t);
796      return t;
797    }
798
799    // syntactic sugar
800    public DeviceComponent addOperationalStatus(CodeableConcept t) { //3
801      if (t == null)
802        return this;
803      if (this.operationalStatus == null)
804        this.operationalStatus = new ArrayList<CodeableConcept>();
805      this.operationalStatus.add(t);
806      return this;
807    }
808
809    /**
810     * @return {@link #parameterGroup} (Describes the parameter group supported by the current device component that is based on some nomenclature, e.g. cardiovascular.)
811     */
812    public CodeableConcept getParameterGroup() { 
813      if (this.parameterGroup == null)
814        if (Configuration.errorOnAutoCreate())
815          throw new Error("Attempt to auto-create DeviceComponent.parameterGroup");
816        else if (Configuration.doAutoCreate())
817          this.parameterGroup = new CodeableConcept(); // cc
818      return this.parameterGroup;
819    }
820
821    public boolean hasParameterGroup() { 
822      return this.parameterGroup != null && !this.parameterGroup.isEmpty();
823    }
824
825    /**
826     * @param value {@link #parameterGroup} (Describes the parameter group supported by the current device component that is based on some nomenclature, e.g. cardiovascular.)
827     */
828    public DeviceComponent setParameterGroup(CodeableConcept value) { 
829      this.parameterGroup = value;
830      return this;
831    }
832
833    /**
834     * @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
835     */
836    public Enumeration<MeasmntPrinciple> getMeasurementPrincipleElement() { 
837      if (this.measurementPrinciple == null)
838        if (Configuration.errorOnAutoCreate())
839          throw new Error("Attempt to auto-create DeviceComponent.measurementPrinciple");
840        else if (Configuration.doAutoCreate())
841          this.measurementPrinciple = new Enumeration<MeasmntPrinciple>(new MeasmntPrincipleEnumFactory()); // bb
842      return this.measurementPrinciple;
843    }
844
845    public boolean hasMeasurementPrincipleElement() { 
846      return this.measurementPrinciple != null && !this.measurementPrinciple.isEmpty();
847    }
848
849    public boolean hasMeasurementPrinciple() { 
850      return this.measurementPrinciple != null && !this.measurementPrinciple.isEmpty();
851    }
852
853    /**
854     * @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
855     */
856    public DeviceComponent setMeasurementPrincipleElement(Enumeration<MeasmntPrinciple> value) { 
857      this.measurementPrinciple = value;
858      return this;
859    }
860
861    /**
862     * @return Describes the physical principle of the measurement. For example: thermal, chemical, acoustical, etc.
863     */
864    public MeasmntPrinciple getMeasurementPrinciple() { 
865      return this.measurementPrinciple == null ? null : this.measurementPrinciple.getValue();
866    }
867
868    /**
869     * @param value Describes the physical principle of the measurement. For example: thermal, chemical, acoustical, etc.
870     */
871    public DeviceComponent setMeasurementPrinciple(MeasmntPrinciple value) { 
872      if (value == null)
873        this.measurementPrinciple = null;
874      else {
875        if (this.measurementPrinciple == null)
876          this.measurementPrinciple = new Enumeration<MeasmntPrinciple>(new MeasmntPrincipleEnumFactory());
877        this.measurementPrinciple.setValue(value);
878      }
879      return this;
880    }
881
882    /**
883     * @return {@link #productionSpecification} (Describes the production specification such as component revision, serial number, etc.)
884     */
885    public List<DeviceComponentProductionSpecificationComponent> getProductionSpecification() { 
886      if (this.productionSpecification == null)
887        this.productionSpecification = new ArrayList<DeviceComponentProductionSpecificationComponent>();
888      return this.productionSpecification;
889    }
890
891    public boolean hasProductionSpecification() { 
892      if (this.productionSpecification == null)
893        return false;
894      for (DeviceComponentProductionSpecificationComponent item : this.productionSpecification)
895        if (!item.isEmpty())
896          return true;
897      return false;
898    }
899
900    /**
901     * @return {@link #productionSpecification} (Describes the production specification such as component revision, serial number, etc.)
902     */
903    // syntactic sugar
904    public DeviceComponentProductionSpecificationComponent addProductionSpecification() { //3
905      DeviceComponentProductionSpecificationComponent t = new DeviceComponentProductionSpecificationComponent();
906      if (this.productionSpecification == null)
907        this.productionSpecification = new ArrayList<DeviceComponentProductionSpecificationComponent>();
908      this.productionSpecification.add(t);
909      return t;
910    }
911
912    // syntactic sugar
913    public DeviceComponent addProductionSpecification(DeviceComponentProductionSpecificationComponent t) { //3
914      if (t == null)
915        return this;
916      if (this.productionSpecification == null)
917        this.productionSpecification = new ArrayList<DeviceComponentProductionSpecificationComponent>();
918      this.productionSpecification.add(t);
919      return this;
920    }
921
922    /**
923     * @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.)
924     */
925    public CodeableConcept getLanguageCode() { 
926      if (this.languageCode == null)
927        if (Configuration.errorOnAutoCreate())
928          throw new Error("Attempt to auto-create DeviceComponent.languageCode");
929        else if (Configuration.doAutoCreate())
930          this.languageCode = new CodeableConcept(); // cc
931      return this.languageCode;
932    }
933
934    public boolean hasLanguageCode() { 
935      return this.languageCode != null && !this.languageCode.isEmpty();
936    }
937
938    /**
939     * @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.)
940     */
941    public DeviceComponent setLanguageCode(CodeableConcept value) { 
942      this.languageCode = value;
943      return this;
944    }
945
946      protected void listChildren(List<Property> childrenList) {
947        super.listChildren(childrenList);
948        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));
949        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));
950        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));
951        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));
952        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));
953        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));
954        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));
955        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));
956        childrenList.add(new Property("productionSpecification", "", "Describes the production specification such as component revision, serial number, etc.", 0, java.lang.Integer.MAX_VALUE, productionSpecification));
957        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));
958      }
959
960      @Override
961      public void setProperty(String name, Base value) throws FHIRException {
962        if (name.equals("type"))
963          this.type = castToCodeableConcept(value); // CodeableConcept
964        else if (name.equals("identifier"))
965          this.identifier = castToIdentifier(value); // Identifier
966        else if (name.equals("lastSystemChange"))
967          this.lastSystemChange = castToInstant(value); // InstantType
968        else if (name.equals("source"))
969          this.source = castToReference(value); // Reference
970        else if (name.equals("parent"))
971          this.parent = castToReference(value); // Reference
972        else if (name.equals("operationalStatus"))
973          this.getOperationalStatus().add(castToCodeableConcept(value));
974        else if (name.equals("parameterGroup"))
975          this.parameterGroup = castToCodeableConcept(value); // CodeableConcept
976        else if (name.equals("measurementPrinciple"))
977          this.measurementPrinciple = new MeasmntPrincipleEnumFactory().fromType(value); // Enumeration<MeasmntPrinciple>
978        else if (name.equals("productionSpecification"))
979          this.getProductionSpecification().add((DeviceComponentProductionSpecificationComponent) value);
980        else if (name.equals("languageCode"))
981          this.languageCode = castToCodeableConcept(value); // CodeableConcept
982        else
983          super.setProperty(name, value);
984      }
985
986      @Override
987      public Base addChild(String name) throws FHIRException {
988        if (name.equals("type")) {
989          this.type = new CodeableConcept();
990          return this.type;
991        }
992        else if (name.equals("identifier")) {
993          this.identifier = new Identifier();
994          return this.identifier;
995        }
996        else if (name.equals("lastSystemChange")) {
997          throw new FHIRException("Cannot call addChild on a primitive type DeviceComponent.lastSystemChange");
998        }
999        else if (name.equals("source")) {
1000          this.source = new Reference();
1001          return this.source;
1002        }
1003        else if (name.equals("parent")) {
1004          this.parent = new Reference();
1005          return this.parent;
1006        }
1007        else if (name.equals("operationalStatus")) {
1008          return addOperationalStatus();
1009        }
1010        else if (name.equals("parameterGroup")) {
1011          this.parameterGroup = new CodeableConcept();
1012          return this.parameterGroup;
1013        }
1014        else if (name.equals("measurementPrinciple")) {
1015          throw new FHIRException("Cannot call addChild on a primitive type DeviceComponent.measurementPrinciple");
1016        }
1017        else if (name.equals("productionSpecification")) {
1018          return addProductionSpecification();
1019        }
1020        else if (name.equals("languageCode")) {
1021          this.languageCode = new CodeableConcept();
1022          return this.languageCode;
1023        }
1024        else
1025          return super.addChild(name);
1026      }
1027
1028  public String fhirType() {
1029    return "DeviceComponent";
1030
1031  }
1032
1033      public DeviceComponent copy() {
1034        DeviceComponent dst = new DeviceComponent();
1035        copyValues(dst);
1036        dst.type = type == null ? null : type.copy();
1037        dst.identifier = identifier == null ? null : identifier.copy();
1038        dst.lastSystemChange = lastSystemChange == null ? null : lastSystemChange.copy();
1039        dst.source = source == null ? null : source.copy();
1040        dst.parent = parent == null ? null : parent.copy();
1041        if (operationalStatus != null) {
1042          dst.operationalStatus = new ArrayList<CodeableConcept>();
1043          for (CodeableConcept i : operationalStatus)
1044            dst.operationalStatus.add(i.copy());
1045        };
1046        dst.parameterGroup = parameterGroup == null ? null : parameterGroup.copy();
1047        dst.measurementPrinciple = measurementPrinciple == null ? null : measurementPrinciple.copy();
1048        if (productionSpecification != null) {
1049          dst.productionSpecification = new ArrayList<DeviceComponentProductionSpecificationComponent>();
1050          for (DeviceComponentProductionSpecificationComponent i : productionSpecification)
1051            dst.productionSpecification.add(i.copy());
1052        };
1053        dst.languageCode = languageCode == null ? null : languageCode.copy();
1054        return dst;
1055      }
1056
1057      protected DeviceComponent typedCopy() {
1058        return copy();
1059      }
1060
1061      @Override
1062      public boolean equalsDeep(Base other) {
1063        if (!super.equalsDeep(other))
1064          return false;
1065        if (!(other instanceof DeviceComponent))
1066          return false;
1067        DeviceComponent o = (DeviceComponent) other;
1068        return compareDeep(type, o.type, true) && compareDeep(identifier, o.identifier, true) && compareDeep(lastSystemChange, o.lastSystemChange, true)
1069           && compareDeep(source, o.source, true) && compareDeep(parent, o.parent, true) && compareDeep(operationalStatus, o.operationalStatus, true)
1070           && compareDeep(parameterGroup, o.parameterGroup, true) && compareDeep(measurementPrinciple, o.measurementPrinciple, true)
1071           && compareDeep(productionSpecification, o.productionSpecification, true) && compareDeep(languageCode, o.languageCode, true)
1072          ;
1073      }
1074
1075      @Override
1076      public boolean equalsShallow(Base other) {
1077        if (!super.equalsShallow(other))
1078          return false;
1079        if (!(other instanceof DeviceComponent))
1080          return false;
1081        DeviceComponent o = (DeviceComponent) other;
1082        return compareValues(lastSystemChange, o.lastSystemChange, true) && compareValues(measurementPrinciple, o.measurementPrinciple, true)
1083          ;
1084      }
1085
1086      public boolean isEmpty() {
1087        return super.isEmpty() && (type == null || type.isEmpty()) && (identifier == null || identifier.isEmpty())
1088           && (lastSystemChange == null || lastSystemChange.isEmpty()) && (source == null || source.isEmpty())
1089           && (parent == null || parent.isEmpty()) && (operationalStatus == null || operationalStatus.isEmpty())
1090           && (parameterGroup == null || parameterGroup.isEmpty()) && (measurementPrinciple == null || measurementPrinciple.isEmpty())
1091           && (productionSpecification == null || productionSpecification.isEmpty()) && (languageCode == null || languageCode.isEmpty())
1092          ;
1093      }
1094
1095  @Override
1096  public ResourceType getResourceType() {
1097    return ResourceType.DeviceComponent;
1098   }
1099
1100  @SearchParamDefinition(name="parent", path="DeviceComponent.parent", description="The parent DeviceComponent resource", type="reference" )
1101  public static final String SP_PARENT = "parent";
1102  @SearchParamDefinition(name="source", path="DeviceComponent.source", description="The device source", type="reference" )
1103  public static final String SP_SOURCE = "source";
1104  @SearchParamDefinition(name="type", path="DeviceComponent.type", description="The device component type", type="token" )
1105  public static final String SP_TYPE = "type";
1106
1107}