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