001package org.hl7.fhir.dstu2.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.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import ca.uhn.fhir.model.api.annotation.Block;
038import ca.uhn.fhir.model.api.annotation.Child;
039import ca.uhn.fhir.model.api.annotation.Description;
040import ca.uhn.fhir.model.api.annotation.ResourceDef;
041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
042import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
043import org.hl7.fhir.exceptions.FHIRException;
044
045/**
046 * Describes a measurement, calculation or setting capability of a medical
047 * device.
048 */
049@ResourceDef(name = "DeviceMetric", profile = "http://hl7.org/fhir/Profile/DeviceMetric")
050public class DeviceMetric extends DomainResource {
051
052  public enum DeviceMetricOperationalStatus {
053    /**
054     * The DeviceMetric is operating and will generate DeviceObservations.
055     */
056    ON,
057    /**
058     * The DeviceMetric is not operating.
059     */
060    OFF,
061    /**
062     * The DeviceMetric is operating, but will not generate any DeviceObservations.
063     */
064    STANDBY,
065    /**
066     * added to help the parsers
067     */
068    NULL;
069
070    public static DeviceMetricOperationalStatus fromCode(String codeString) throws FHIRException {
071      if (codeString == null || "".equals(codeString))
072        return null;
073      if ("on".equals(codeString))
074        return ON;
075      if ("off".equals(codeString))
076        return OFF;
077      if ("standby".equals(codeString))
078        return STANDBY;
079      throw new FHIRException("Unknown DeviceMetricOperationalStatus code '" + codeString + "'");
080    }
081
082    public String toCode() {
083      switch (this) {
084      case ON:
085        return "on";
086      case OFF:
087        return "off";
088      case STANDBY:
089        return "standby";
090      case NULL:
091        return null;
092      default:
093        return "?";
094      }
095    }
096
097    public String getSystem() {
098      switch (this) {
099      case ON:
100        return "http://hl7.org/fhir/metric-operational-status";
101      case OFF:
102        return "http://hl7.org/fhir/metric-operational-status";
103      case STANDBY:
104        return "http://hl7.org/fhir/metric-operational-status";
105      case NULL:
106        return null;
107      default:
108        return "?";
109      }
110    }
111
112    public String getDefinition() {
113      switch (this) {
114      case ON:
115        return "The DeviceMetric is operating and will generate DeviceObservations.";
116      case OFF:
117        return "The DeviceMetric is not operating.";
118      case STANDBY:
119        return "The DeviceMetric is operating, but will not generate any DeviceObservations.";
120      case NULL:
121        return null;
122      default:
123        return "?";
124      }
125    }
126
127    public String getDisplay() {
128      switch (this) {
129      case ON:
130        return "On";
131      case OFF:
132        return "Off";
133      case STANDBY:
134        return "Standby";
135      case NULL:
136        return null;
137      default:
138        return "?";
139      }
140    }
141  }
142
143  public static class DeviceMetricOperationalStatusEnumFactory implements EnumFactory<DeviceMetricOperationalStatus> {
144    public DeviceMetricOperationalStatus fromCode(String codeString) throws IllegalArgumentException {
145      if (codeString == null || "".equals(codeString))
146        if (codeString == null || "".equals(codeString))
147          return null;
148      if ("on".equals(codeString))
149        return DeviceMetricOperationalStatus.ON;
150      if ("off".equals(codeString))
151        return DeviceMetricOperationalStatus.OFF;
152      if ("standby".equals(codeString))
153        return DeviceMetricOperationalStatus.STANDBY;
154      throw new IllegalArgumentException("Unknown DeviceMetricOperationalStatus code '" + codeString + "'");
155    }
156
157    public Enumeration<DeviceMetricOperationalStatus> fromType(Base code) throws FHIRException {
158      if (code == null || code.isEmpty())
159        return null;
160      String codeString = ((PrimitiveType) code).asStringValue();
161      if (codeString == null || "".equals(codeString))
162        return null;
163      if ("on".equals(codeString))
164        return new Enumeration<DeviceMetricOperationalStatus>(this, DeviceMetricOperationalStatus.ON);
165      if ("off".equals(codeString))
166        return new Enumeration<DeviceMetricOperationalStatus>(this, DeviceMetricOperationalStatus.OFF);
167      if ("standby".equals(codeString))
168        return new Enumeration<DeviceMetricOperationalStatus>(this, DeviceMetricOperationalStatus.STANDBY);
169      throw new FHIRException("Unknown DeviceMetricOperationalStatus code '" + codeString + "'");
170    }
171
172    public String toCode(DeviceMetricOperationalStatus code) {
173      if (code == DeviceMetricOperationalStatus.ON)
174        return "on";
175      if (code == DeviceMetricOperationalStatus.OFF)
176        return "off";
177      if (code == DeviceMetricOperationalStatus.STANDBY)
178        return "standby";
179      return "?";
180    }
181  }
182
183  public enum DeviceMetricColor {
184    /**
185     * Color for representation - black.
186     */
187    BLACK,
188    /**
189     * Color for representation - red.
190     */
191    RED,
192    /**
193     * Color for representation - green.
194     */
195    GREEN,
196    /**
197     * Color for representation - yellow.
198     */
199    YELLOW,
200    /**
201     * Color for representation - blue.
202     */
203    BLUE,
204    /**
205     * Color for representation - magenta.
206     */
207    MAGENTA,
208    /**
209     * Color for representation - cyan.
210     */
211    CYAN,
212    /**
213     * Color for representation - white.
214     */
215    WHITE,
216    /**
217     * added to help the parsers
218     */
219    NULL;
220
221    public static DeviceMetricColor fromCode(String codeString) throws FHIRException {
222      if (codeString == null || "".equals(codeString))
223        return null;
224      if ("black".equals(codeString))
225        return BLACK;
226      if ("red".equals(codeString))
227        return RED;
228      if ("green".equals(codeString))
229        return GREEN;
230      if ("yellow".equals(codeString))
231        return YELLOW;
232      if ("blue".equals(codeString))
233        return BLUE;
234      if ("magenta".equals(codeString))
235        return MAGENTA;
236      if ("cyan".equals(codeString))
237        return CYAN;
238      if ("white".equals(codeString))
239        return WHITE;
240      throw new FHIRException("Unknown DeviceMetricColor code '" + codeString + "'");
241    }
242
243    public String toCode() {
244      switch (this) {
245      case BLACK:
246        return "black";
247      case RED:
248        return "red";
249      case GREEN:
250        return "green";
251      case YELLOW:
252        return "yellow";
253      case BLUE:
254        return "blue";
255      case MAGENTA:
256        return "magenta";
257      case CYAN:
258        return "cyan";
259      case WHITE:
260        return "white";
261      case NULL:
262        return null;
263      default:
264        return "?";
265      }
266    }
267
268    public String getSystem() {
269      switch (this) {
270      case BLACK:
271        return "http://hl7.org/fhir/metric-color";
272      case RED:
273        return "http://hl7.org/fhir/metric-color";
274      case GREEN:
275        return "http://hl7.org/fhir/metric-color";
276      case YELLOW:
277        return "http://hl7.org/fhir/metric-color";
278      case BLUE:
279        return "http://hl7.org/fhir/metric-color";
280      case MAGENTA:
281        return "http://hl7.org/fhir/metric-color";
282      case CYAN:
283        return "http://hl7.org/fhir/metric-color";
284      case WHITE:
285        return "http://hl7.org/fhir/metric-color";
286      case NULL:
287        return null;
288      default:
289        return "?";
290      }
291    }
292
293    public String getDefinition() {
294      switch (this) {
295      case BLACK:
296        return "Color for representation - black.";
297      case RED:
298        return "Color for representation - red.";
299      case GREEN:
300        return "Color for representation - green.";
301      case YELLOW:
302        return "Color for representation - yellow.";
303      case BLUE:
304        return "Color for representation - blue.";
305      case MAGENTA:
306        return "Color for representation - magenta.";
307      case CYAN:
308        return "Color for representation - cyan.";
309      case WHITE:
310        return "Color for representation - white.";
311      case NULL:
312        return null;
313      default:
314        return "?";
315      }
316    }
317
318    public String getDisplay() {
319      switch (this) {
320      case BLACK:
321        return "Color Black";
322      case RED:
323        return "Color Red";
324      case GREEN:
325        return "Color Green";
326      case YELLOW:
327        return "Color Yellow";
328      case BLUE:
329        return "Color Blue";
330      case MAGENTA:
331        return "Color Magenta";
332      case CYAN:
333        return "Color Cyan";
334      case WHITE:
335        return "Color White";
336      case NULL:
337        return null;
338      default:
339        return "?";
340      }
341    }
342  }
343
344  public static class DeviceMetricColorEnumFactory implements EnumFactory<DeviceMetricColor> {
345    public DeviceMetricColor fromCode(String codeString) throws IllegalArgumentException {
346      if (codeString == null || "".equals(codeString))
347        if (codeString == null || "".equals(codeString))
348          return null;
349      if ("black".equals(codeString))
350        return DeviceMetricColor.BLACK;
351      if ("red".equals(codeString))
352        return DeviceMetricColor.RED;
353      if ("green".equals(codeString))
354        return DeviceMetricColor.GREEN;
355      if ("yellow".equals(codeString))
356        return DeviceMetricColor.YELLOW;
357      if ("blue".equals(codeString))
358        return DeviceMetricColor.BLUE;
359      if ("magenta".equals(codeString))
360        return DeviceMetricColor.MAGENTA;
361      if ("cyan".equals(codeString))
362        return DeviceMetricColor.CYAN;
363      if ("white".equals(codeString))
364        return DeviceMetricColor.WHITE;
365      throw new IllegalArgumentException("Unknown DeviceMetricColor code '" + codeString + "'");
366    }
367
368    public Enumeration<DeviceMetricColor> fromType(Base code) throws FHIRException {
369      if (code == null || code.isEmpty())
370        return null;
371      String codeString = ((PrimitiveType) code).asStringValue();
372      if (codeString == null || "".equals(codeString))
373        return null;
374      if ("black".equals(codeString))
375        return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.BLACK);
376      if ("red".equals(codeString))
377        return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.RED);
378      if ("green".equals(codeString))
379        return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.GREEN);
380      if ("yellow".equals(codeString))
381        return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.YELLOW);
382      if ("blue".equals(codeString))
383        return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.BLUE);
384      if ("magenta".equals(codeString))
385        return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.MAGENTA);
386      if ("cyan".equals(codeString))
387        return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.CYAN);
388      if ("white".equals(codeString))
389        return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.WHITE);
390      throw new FHIRException("Unknown DeviceMetricColor code '" + codeString + "'");
391    }
392
393    public String toCode(DeviceMetricColor code) {
394      if (code == DeviceMetricColor.BLACK)
395        return "black";
396      if (code == DeviceMetricColor.RED)
397        return "red";
398      if (code == DeviceMetricColor.GREEN)
399        return "green";
400      if (code == DeviceMetricColor.YELLOW)
401        return "yellow";
402      if (code == DeviceMetricColor.BLUE)
403        return "blue";
404      if (code == DeviceMetricColor.MAGENTA)
405        return "magenta";
406      if (code == DeviceMetricColor.CYAN)
407        return "cyan";
408      if (code == DeviceMetricColor.WHITE)
409        return "white";
410      return "?";
411    }
412  }
413
414  public enum DeviceMetricCategory {
415    /**
416     * DeviceObservations generated for this DeviceMetric are measured.
417     */
418    MEASUREMENT,
419    /**
420     * DeviceObservations generated for this DeviceMetric is a setting that will
421     * influence the behavior of the Device.
422     */
423    SETTING,
424    /**
425     * DeviceObservations generated for this DeviceMetric are calculated.
426     */
427    CALCULATION,
428    /**
429     * The category of this DeviceMetric is unspecified.
430     */
431    UNSPECIFIED,
432    /**
433     * added to help the parsers
434     */
435    NULL;
436
437    public static DeviceMetricCategory fromCode(String codeString) throws FHIRException {
438      if (codeString == null || "".equals(codeString))
439        return null;
440      if ("measurement".equals(codeString))
441        return MEASUREMENT;
442      if ("setting".equals(codeString))
443        return SETTING;
444      if ("calculation".equals(codeString))
445        return CALCULATION;
446      if ("unspecified".equals(codeString))
447        return UNSPECIFIED;
448      throw new FHIRException("Unknown DeviceMetricCategory code '" + codeString + "'");
449    }
450
451    public String toCode() {
452      switch (this) {
453      case MEASUREMENT:
454        return "measurement";
455      case SETTING:
456        return "setting";
457      case CALCULATION:
458        return "calculation";
459      case UNSPECIFIED:
460        return "unspecified";
461      case NULL:
462        return null;
463      default:
464        return "?";
465      }
466    }
467
468    public String getSystem() {
469      switch (this) {
470      case MEASUREMENT:
471        return "http://hl7.org/fhir/metric-category";
472      case SETTING:
473        return "http://hl7.org/fhir/metric-category";
474      case CALCULATION:
475        return "http://hl7.org/fhir/metric-category";
476      case UNSPECIFIED:
477        return "http://hl7.org/fhir/metric-category";
478      case NULL:
479        return null;
480      default:
481        return "?";
482      }
483    }
484
485    public String getDefinition() {
486      switch (this) {
487      case MEASUREMENT:
488        return "DeviceObservations generated for this DeviceMetric are measured.";
489      case SETTING:
490        return "DeviceObservations generated for this DeviceMetric is a setting that will influence the behavior of the Device.";
491      case CALCULATION:
492        return "DeviceObservations generated for this DeviceMetric are calculated.";
493      case UNSPECIFIED:
494        return "The category of this DeviceMetric is unspecified.";
495      case NULL:
496        return null;
497      default:
498        return "?";
499      }
500    }
501
502    public String getDisplay() {
503      switch (this) {
504      case MEASUREMENT:
505        return "Measurement";
506      case SETTING:
507        return "Setting";
508      case CALCULATION:
509        return "Calculation";
510      case UNSPECIFIED:
511        return "Unspecified";
512      case NULL:
513        return null;
514      default:
515        return "?";
516      }
517    }
518  }
519
520  public static class DeviceMetricCategoryEnumFactory implements EnumFactory<DeviceMetricCategory> {
521    public DeviceMetricCategory fromCode(String codeString) throws IllegalArgumentException {
522      if (codeString == null || "".equals(codeString))
523        if (codeString == null || "".equals(codeString))
524          return null;
525      if ("measurement".equals(codeString))
526        return DeviceMetricCategory.MEASUREMENT;
527      if ("setting".equals(codeString))
528        return DeviceMetricCategory.SETTING;
529      if ("calculation".equals(codeString))
530        return DeviceMetricCategory.CALCULATION;
531      if ("unspecified".equals(codeString))
532        return DeviceMetricCategory.UNSPECIFIED;
533      throw new IllegalArgumentException("Unknown DeviceMetricCategory code '" + codeString + "'");
534    }
535
536    public Enumeration<DeviceMetricCategory> fromType(Base code) throws FHIRException {
537      if (code == null || code.isEmpty())
538        return null;
539      String codeString = ((PrimitiveType) code).asStringValue();
540      if (codeString == null || "".equals(codeString))
541        return null;
542      if ("measurement".equals(codeString))
543        return new Enumeration<DeviceMetricCategory>(this, DeviceMetricCategory.MEASUREMENT);
544      if ("setting".equals(codeString))
545        return new Enumeration<DeviceMetricCategory>(this, DeviceMetricCategory.SETTING);
546      if ("calculation".equals(codeString))
547        return new Enumeration<DeviceMetricCategory>(this, DeviceMetricCategory.CALCULATION);
548      if ("unspecified".equals(codeString))
549        return new Enumeration<DeviceMetricCategory>(this, DeviceMetricCategory.UNSPECIFIED);
550      throw new FHIRException("Unknown DeviceMetricCategory code '" + codeString + "'");
551    }
552
553    public String toCode(DeviceMetricCategory code) {
554      if (code == DeviceMetricCategory.MEASUREMENT)
555        return "measurement";
556      if (code == DeviceMetricCategory.SETTING)
557        return "setting";
558      if (code == DeviceMetricCategory.CALCULATION)
559        return "calculation";
560      if (code == DeviceMetricCategory.UNSPECIFIED)
561        return "unspecified";
562      return "?";
563    }
564  }
565
566  public enum DeviceMetricCalibrationType {
567    /**
568     * TODO
569     */
570    UNSPECIFIED,
571    /**
572     * TODO
573     */
574    OFFSET,
575    /**
576     * TODO
577     */
578    GAIN,
579    /**
580     * TODO
581     */
582    TWOPOINT,
583    /**
584     * added to help the parsers
585     */
586    NULL;
587
588    public static DeviceMetricCalibrationType fromCode(String codeString) throws FHIRException {
589      if (codeString == null || "".equals(codeString))
590        return null;
591      if ("unspecified".equals(codeString))
592        return UNSPECIFIED;
593      if ("offset".equals(codeString))
594        return OFFSET;
595      if ("gain".equals(codeString))
596        return GAIN;
597      if ("two-point".equals(codeString))
598        return TWOPOINT;
599      throw new FHIRException("Unknown DeviceMetricCalibrationType code '" + codeString + "'");
600    }
601
602    public String toCode() {
603      switch (this) {
604      case UNSPECIFIED:
605        return "unspecified";
606      case OFFSET:
607        return "offset";
608      case GAIN:
609        return "gain";
610      case TWOPOINT:
611        return "two-point";
612      case NULL:
613        return null;
614      default:
615        return "?";
616      }
617    }
618
619    public String getSystem() {
620      switch (this) {
621      case UNSPECIFIED:
622        return "http://hl7.org/fhir/metric-calibration-type";
623      case OFFSET:
624        return "http://hl7.org/fhir/metric-calibration-type";
625      case GAIN:
626        return "http://hl7.org/fhir/metric-calibration-type";
627      case TWOPOINT:
628        return "http://hl7.org/fhir/metric-calibration-type";
629      case NULL:
630        return null;
631      default:
632        return "?";
633      }
634    }
635
636    public String getDefinition() {
637      switch (this) {
638      case UNSPECIFIED:
639        return "TODO";
640      case OFFSET:
641        return "TODO";
642      case GAIN:
643        return "TODO";
644      case TWOPOINT:
645        return "TODO";
646      case NULL:
647        return null;
648      default:
649        return "?";
650      }
651    }
652
653    public String getDisplay() {
654      switch (this) {
655      case UNSPECIFIED:
656        return "Unspecified";
657      case OFFSET:
658        return "Offset";
659      case GAIN:
660        return "Gain";
661      case TWOPOINT:
662        return "Two Point";
663      case NULL:
664        return null;
665      default:
666        return "?";
667      }
668    }
669  }
670
671  public static class DeviceMetricCalibrationTypeEnumFactory implements EnumFactory<DeviceMetricCalibrationType> {
672    public DeviceMetricCalibrationType fromCode(String codeString) throws IllegalArgumentException {
673      if (codeString == null || "".equals(codeString))
674        if (codeString == null || "".equals(codeString))
675          return null;
676      if ("unspecified".equals(codeString))
677        return DeviceMetricCalibrationType.UNSPECIFIED;
678      if ("offset".equals(codeString))
679        return DeviceMetricCalibrationType.OFFSET;
680      if ("gain".equals(codeString))
681        return DeviceMetricCalibrationType.GAIN;
682      if ("two-point".equals(codeString))
683        return DeviceMetricCalibrationType.TWOPOINT;
684      throw new IllegalArgumentException("Unknown DeviceMetricCalibrationType code '" + codeString + "'");
685    }
686
687    public Enumeration<DeviceMetricCalibrationType> fromType(Base code) throws FHIRException {
688      if (code == null || code.isEmpty())
689        return null;
690      String codeString = ((PrimitiveType) code).asStringValue();
691      if (codeString == null || "".equals(codeString))
692        return null;
693      if ("unspecified".equals(codeString))
694        return new Enumeration<DeviceMetricCalibrationType>(this, DeviceMetricCalibrationType.UNSPECIFIED);
695      if ("offset".equals(codeString))
696        return new Enumeration<DeviceMetricCalibrationType>(this, DeviceMetricCalibrationType.OFFSET);
697      if ("gain".equals(codeString))
698        return new Enumeration<DeviceMetricCalibrationType>(this, DeviceMetricCalibrationType.GAIN);
699      if ("two-point".equals(codeString))
700        return new Enumeration<DeviceMetricCalibrationType>(this, DeviceMetricCalibrationType.TWOPOINT);
701      throw new FHIRException("Unknown DeviceMetricCalibrationType code '" + codeString + "'");
702    }
703
704    public String toCode(DeviceMetricCalibrationType code) {
705      if (code == DeviceMetricCalibrationType.UNSPECIFIED)
706        return "unspecified";
707      if (code == DeviceMetricCalibrationType.OFFSET)
708        return "offset";
709      if (code == DeviceMetricCalibrationType.GAIN)
710        return "gain";
711      if (code == DeviceMetricCalibrationType.TWOPOINT)
712        return "two-point";
713      return "?";
714    }
715  }
716
717  public enum DeviceMetricCalibrationState {
718    /**
719     * The metric has not been calibrated.
720     */
721    NOTCALIBRATED,
722    /**
723     * The metric needs to be calibrated.
724     */
725    CALIBRATIONREQUIRED,
726    /**
727     * The metric has been calibrated.
728     */
729    CALIBRATED,
730    /**
731     * The state of calibration of this metric is unspecified.
732     */
733    UNSPECIFIED,
734    /**
735     * added to help the parsers
736     */
737    NULL;
738
739    public static DeviceMetricCalibrationState fromCode(String codeString) throws FHIRException {
740      if (codeString == null || "".equals(codeString))
741        return null;
742      if ("not-calibrated".equals(codeString))
743        return NOTCALIBRATED;
744      if ("calibration-required".equals(codeString))
745        return CALIBRATIONREQUIRED;
746      if ("calibrated".equals(codeString))
747        return CALIBRATED;
748      if ("unspecified".equals(codeString))
749        return UNSPECIFIED;
750      throw new FHIRException("Unknown DeviceMetricCalibrationState code '" + codeString + "'");
751    }
752
753    public String toCode() {
754      switch (this) {
755      case NOTCALIBRATED:
756        return "not-calibrated";
757      case CALIBRATIONREQUIRED:
758        return "calibration-required";
759      case CALIBRATED:
760        return "calibrated";
761      case UNSPECIFIED:
762        return "unspecified";
763      case NULL:
764        return null;
765      default:
766        return "?";
767      }
768    }
769
770    public String getSystem() {
771      switch (this) {
772      case NOTCALIBRATED:
773        return "http://hl7.org/fhir/metric-calibration-state";
774      case CALIBRATIONREQUIRED:
775        return "http://hl7.org/fhir/metric-calibration-state";
776      case CALIBRATED:
777        return "http://hl7.org/fhir/metric-calibration-state";
778      case UNSPECIFIED:
779        return "http://hl7.org/fhir/metric-calibration-state";
780      case NULL:
781        return null;
782      default:
783        return "?";
784      }
785    }
786
787    public String getDefinition() {
788      switch (this) {
789      case NOTCALIBRATED:
790        return "The metric has not been calibrated.";
791      case CALIBRATIONREQUIRED:
792        return "The metric needs to be calibrated.";
793      case CALIBRATED:
794        return "The metric has been calibrated.";
795      case UNSPECIFIED:
796        return "The state of calibration of this metric is unspecified.";
797      case NULL:
798        return null;
799      default:
800        return "?";
801      }
802    }
803
804    public String getDisplay() {
805      switch (this) {
806      case NOTCALIBRATED:
807        return "Not Calibrated";
808      case CALIBRATIONREQUIRED:
809        return "Calibration Required";
810      case CALIBRATED:
811        return "Calibrated";
812      case UNSPECIFIED:
813        return "Unspecified";
814      case NULL:
815        return null;
816      default:
817        return "?";
818      }
819    }
820  }
821
822  public static class DeviceMetricCalibrationStateEnumFactory implements EnumFactory<DeviceMetricCalibrationState> {
823    public DeviceMetricCalibrationState fromCode(String codeString) throws IllegalArgumentException {
824      if (codeString == null || "".equals(codeString))
825        if (codeString == null || "".equals(codeString))
826          return null;
827      if ("not-calibrated".equals(codeString))
828        return DeviceMetricCalibrationState.NOTCALIBRATED;
829      if ("calibration-required".equals(codeString))
830        return DeviceMetricCalibrationState.CALIBRATIONREQUIRED;
831      if ("calibrated".equals(codeString))
832        return DeviceMetricCalibrationState.CALIBRATED;
833      if ("unspecified".equals(codeString))
834        return DeviceMetricCalibrationState.UNSPECIFIED;
835      throw new IllegalArgumentException("Unknown DeviceMetricCalibrationState code '" + codeString + "'");
836    }
837
838    public Enumeration<DeviceMetricCalibrationState> fromType(Base code) throws FHIRException {
839      if (code == null || code.isEmpty())
840        return null;
841      String codeString = ((PrimitiveType) code).asStringValue();
842      if (codeString == null || "".equals(codeString))
843        return null;
844      if ("not-calibrated".equals(codeString))
845        return new Enumeration<DeviceMetricCalibrationState>(this, DeviceMetricCalibrationState.NOTCALIBRATED);
846      if ("calibration-required".equals(codeString))
847        return new Enumeration<DeviceMetricCalibrationState>(this, DeviceMetricCalibrationState.CALIBRATIONREQUIRED);
848      if ("calibrated".equals(codeString))
849        return new Enumeration<DeviceMetricCalibrationState>(this, DeviceMetricCalibrationState.CALIBRATED);
850      if ("unspecified".equals(codeString))
851        return new Enumeration<DeviceMetricCalibrationState>(this, DeviceMetricCalibrationState.UNSPECIFIED);
852      throw new FHIRException("Unknown DeviceMetricCalibrationState code '" + codeString + "'");
853    }
854
855    public String toCode(DeviceMetricCalibrationState code) {
856      if (code == DeviceMetricCalibrationState.NOTCALIBRATED)
857        return "not-calibrated";
858      if (code == DeviceMetricCalibrationState.CALIBRATIONREQUIRED)
859        return "calibration-required";
860      if (code == DeviceMetricCalibrationState.CALIBRATED)
861        return "calibrated";
862      if (code == DeviceMetricCalibrationState.UNSPECIFIED)
863        return "unspecified";
864      return "?";
865    }
866  }
867
868  @Block()
869  public static class DeviceMetricCalibrationComponent extends BackboneElement implements IBaseBackboneElement {
870    /**
871     * Describes the type of the calibration method.
872     */
873    @Child(name = "type", type = { CodeType.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
874    @Description(shortDefinition = "unspecified | offset | gain | two-point", formalDefinition = "Describes the type of the calibration method.")
875    protected Enumeration<DeviceMetricCalibrationType> type;
876
877    /**
878     * Describes the state of the calibration.
879     */
880    @Child(name = "state", type = { CodeType.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
881    @Description(shortDefinition = "not-calibrated | calibration-required | calibrated | unspecified", formalDefinition = "Describes the state of the calibration.")
882    protected Enumeration<DeviceMetricCalibrationState> state;
883
884    /**
885     * Describes the time last calibration has been performed.
886     */
887    @Child(name = "time", type = { InstantType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
888    @Description(shortDefinition = "Describes the time last calibration has been performed", formalDefinition = "Describes the time last calibration has been performed.")
889    protected InstantType time;
890
891    private static final long serialVersionUID = 1163986578L;
892
893    /*
894     * Constructor
895     */
896    public DeviceMetricCalibrationComponent() {
897      super();
898    }
899
900    /**
901     * @return {@link #type} (Describes the type of the calibration method.). This
902     *         is the underlying object with id, value and extensions. The accessor
903     *         "getType" gives direct access to the value
904     */
905    public Enumeration<DeviceMetricCalibrationType> getTypeElement() {
906      if (this.type == null)
907        if (Configuration.errorOnAutoCreate())
908          throw new Error("Attempt to auto-create DeviceMetricCalibrationComponent.type");
909        else if (Configuration.doAutoCreate())
910          this.type = new Enumeration<DeviceMetricCalibrationType>(new DeviceMetricCalibrationTypeEnumFactory()); // bb
911      return this.type;
912    }
913
914    public boolean hasTypeElement() {
915      return this.type != null && !this.type.isEmpty();
916    }
917
918    public boolean hasType() {
919      return this.type != null && !this.type.isEmpty();
920    }
921
922    /**
923     * @param value {@link #type} (Describes the type of the calibration method.).
924     *              This is the underlying object with id, value and extensions. The
925     *              accessor "getType" gives direct access to the value
926     */
927    public DeviceMetricCalibrationComponent setTypeElement(Enumeration<DeviceMetricCalibrationType> value) {
928      this.type = value;
929      return this;
930    }
931
932    /**
933     * @return Describes the type of the calibration method.
934     */
935    public DeviceMetricCalibrationType getType() {
936      return this.type == null ? null : this.type.getValue();
937    }
938
939    /**
940     * @param value Describes the type of the calibration method.
941     */
942    public DeviceMetricCalibrationComponent setType(DeviceMetricCalibrationType value) {
943      if (value == null)
944        this.type = null;
945      else {
946        if (this.type == null)
947          this.type = new Enumeration<DeviceMetricCalibrationType>(new DeviceMetricCalibrationTypeEnumFactory());
948        this.type.setValue(value);
949      }
950      return this;
951    }
952
953    /**
954     * @return {@link #state} (Describes the state of the calibration.). This is the
955     *         underlying object with id, value and extensions. The accessor
956     *         "getState" gives direct access to the value
957     */
958    public Enumeration<DeviceMetricCalibrationState> getStateElement() {
959      if (this.state == null)
960        if (Configuration.errorOnAutoCreate())
961          throw new Error("Attempt to auto-create DeviceMetricCalibrationComponent.state");
962        else if (Configuration.doAutoCreate())
963          this.state = new Enumeration<DeviceMetricCalibrationState>(new DeviceMetricCalibrationStateEnumFactory()); // bb
964      return this.state;
965    }
966
967    public boolean hasStateElement() {
968      return this.state != null && !this.state.isEmpty();
969    }
970
971    public boolean hasState() {
972      return this.state != null && !this.state.isEmpty();
973    }
974
975    /**
976     * @param value {@link #state} (Describes the state of the calibration.). This
977     *              is the underlying object with id, value and extensions. The
978     *              accessor "getState" gives direct access to the value
979     */
980    public DeviceMetricCalibrationComponent setStateElement(Enumeration<DeviceMetricCalibrationState> value) {
981      this.state = value;
982      return this;
983    }
984
985    /**
986     * @return Describes the state of the calibration.
987     */
988    public DeviceMetricCalibrationState getState() {
989      return this.state == null ? null : this.state.getValue();
990    }
991
992    /**
993     * @param value Describes the state of the calibration.
994     */
995    public DeviceMetricCalibrationComponent setState(DeviceMetricCalibrationState value) {
996      if (value == null)
997        this.state = null;
998      else {
999        if (this.state == null)
1000          this.state = new Enumeration<DeviceMetricCalibrationState>(new DeviceMetricCalibrationStateEnumFactory());
1001        this.state.setValue(value);
1002      }
1003      return this;
1004    }
1005
1006    /**
1007     * @return {@link #time} (Describes the time last calibration has been
1008     *         performed.). This is the underlying object with id, value and
1009     *         extensions. The accessor "getTime" gives direct access to the value
1010     */
1011    public InstantType getTimeElement() {
1012      if (this.time == null)
1013        if (Configuration.errorOnAutoCreate())
1014          throw new Error("Attempt to auto-create DeviceMetricCalibrationComponent.time");
1015        else if (Configuration.doAutoCreate())
1016          this.time = new InstantType(); // bb
1017      return this.time;
1018    }
1019
1020    public boolean hasTimeElement() {
1021      return this.time != null && !this.time.isEmpty();
1022    }
1023
1024    public boolean hasTime() {
1025      return this.time != null && !this.time.isEmpty();
1026    }
1027
1028    /**
1029     * @param value {@link #time} (Describes the time last calibration has been
1030     *              performed.). This is the underlying object with id, value and
1031     *              extensions. The accessor "getTime" gives direct access to the
1032     *              value
1033     */
1034    public DeviceMetricCalibrationComponent setTimeElement(InstantType value) {
1035      this.time = value;
1036      return this;
1037    }
1038
1039    /**
1040     * @return Describes the time last calibration has been performed.
1041     */
1042    public Date getTime() {
1043      return this.time == null ? null : this.time.getValue();
1044    }
1045
1046    /**
1047     * @param value Describes the time last calibration has been performed.
1048     */
1049    public DeviceMetricCalibrationComponent setTime(Date value) {
1050      if (value == null)
1051        this.time = null;
1052      else {
1053        if (this.time == null)
1054          this.time = new InstantType();
1055        this.time.setValue(value);
1056      }
1057      return this;
1058    }
1059
1060    protected void listChildren(List<Property> childrenList) {
1061      super.listChildren(childrenList);
1062      childrenList.add(new Property("type", "code", "Describes the type of the calibration method.", 0,
1063          java.lang.Integer.MAX_VALUE, type));
1064      childrenList.add(new Property("state", "code", "Describes the state of the calibration.", 0,
1065          java.lang.Integer.MAX_VALUE, state));
1066      childrenList.add(new Property("time", "instant", "Describes the time last calibration has been performed.", 0,
1067          java.lang.Integer.MAX_VALUE, time));
1068    }
1069
1070    @Override
1071    public void setProperty(String name, Base value) throws FHIRException {
1072      if (name.equals("type"))
1073        this.type = new DeviceMetricCalibrationTypeEnumFactory().fromType(value); // Enumeration<DeviceMetricCalibrationType>
1074      else if (name.equals("state"))
1075        this.state = new DeviceMetricCalibrationStateEnumFactory().fromType(value); // Enumeration<DeviceMetricCalibrationState>
1076      else if (name.equals("time"))
1077        this.time = castToInstant(value); // InstantType
1078      else
1079        super.setProperty(name, value);
1080    }
1081
1082    @Override
1083    public Base addChild(String name) throws FHIRException {
1084      if (name.equals("type")) {
1085        throw new FHIRException("Cannot call addChild on a singleton property DeviceMetric.type");
1086      } else if (name.equals("state")) {
1087        throw new FHIRException("Cannot call addChild on a singleton property DeviceMetric.state");
1088      } else if (name.equals("time")) {
1089        throw new FHIRException("Cannot call addChild on a singleton property DeviceMetric.time");
1090      } else
1091        return super.addChild(name);
1092    }
1093
1094    public DeviceMetricCalibrationComponent copy() {
1095      DeviceMetricCalibrationComponent dst = new DeviceMetricCalibrationComponent();
1096      copyValues(dst);
1097      dst.type = type == null ? null : type.copy();
1098      dst.state = state == null ? null : state.copy();
1099      dst.time = time == null ? null : time.copy();
1100      return dst;
1101    }
1102
1103    @Override
1104    public boolean equalsDeep(Base other) {
1105      if (!super.equalsDeep(other))
1106        return false;
1107      if (!(other instanceof DeviceMetricCalibrationComponent))
1108        return false;
1109      DeviceMetricCalibrationComponent o = (DeviceMetricCalibrationComponent) other;
1110      return compareDeep(type, o.type, true) && compareDeep(state, o.state, true) && compareDeep(time, o.time, true);
1111    }
1112
1113    @Override
1114    public boolean equalsShallow(Base other) {
1115      if (!super.equalsShallow(other))
1116        return false;
1117      if (!(other instanceof DeviceMetricCalibrationComponent))
1118        return false;
1119      DeviceMetricCalibrationComponent o = (DeviceMetricCalibrationComponent) other;
1120      return compareValues(type, o.type, true) && compareValues(state, o.state, true)
1121          && compareValues(time, o.time, true);
1122    }
1123
1124    public boolean isEmpty() {
1125      return super.isEmpty() && (type == null || type.isEmpty()) && (state == null || state.isEmpty())
1126          && (time == null || time.isEmpty());
1127    }
1128
1129    public String fhirType() {
1130      return "DeviceMetric.calibration";
1131
1132    }
1133
1134  }
1135
1136  /**
1137   * Describes the type of the metric. For example: Heart Rate, PEEP Setting, etc.
1138   */
1139  @Child(name = "type", type = { CodeableConcept.class }, order = 0, min = 1, max = 1, modifier = false, summary = true)
1140  @Description(shortDefinition = "Type of metric", formalDefinition = "Describes the type of the metric. For example: Heart Rate, PEEP Setting, etc.")
1141  protected CodeableConcept type;
1142
1143  /**
1144   * Describes the unique identification of this metric that has been assigned by
1145   * the device or gateway software. For example: handle ID. It should be noted
1146   * that in order to make the identifier unique, the system element of the
1147   * identifier should be set to the unique identifier of the device.
1148   */
1149  @Child(name = "identifier", type = {
1150      Identifier.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
1151  @Description(shortDefinition = "Unique identifier of this DeviceMetric", formalDefinition = "Describes the unique identification of this metric that has been assigned by the device or gateway software. For example: handle ID.  It should be noted that in order to make the identifier unique, the system element of the identifier should be set to the unique identifier of the device.")
1152  protected Identifier identifier;
1153
1154  /**
1155   * Describes the unit that an observed value determined for this metric will
1156   * have. For example: Percent, Seconds, etc.
1157   */
1158  @Child(name = "unit", type = { CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
1159  @Description(shortDefinition = "Unit of metric", formalDefinition = "Describes the unit that an observed value determined for this metric will have. For example: Percent, Seconds, etc.")
1160  protected CodeableConcept unit;
1161
1162  /**
1163   * Describes the link to the Device that this DeviceMetric belongs to and that
1164   * contains administrative device information such as manufacture, serial
1165   * number, etc.
1166   */
1167  @Child(name = "source", type = { Device.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
1168  @Description(shortDefinition = "Describes the link to the source Device", formalDefinition = "Describes the link to the  Device that this DeviceMetric belongs to and that contains administrative device information such as manufacture, serial number, etc.")
1169  protected Reference source;
1170
1171  /**
1172   * The actual object that is the target of the reference (Describes the link to
1173   * the Device that this DeviceMetric belongs to and that contains administrative
1174   * device information such as manufacture, serial number, etc.)
1175   */
1176  protected Device sourceTarget;
1177
1178  /**
1179   * Describes the link to the DeviceComponent that this DeviceMetric belongs to
1180   * and that provide information about the location of this DeviceMetric in the
1181   * containment structure of the parent Device. An example would be a
1182   * DeviceComponent that represents a Channel. This reference can be used by a
1183   * client application to distinguish DeviceMetrics that have the same type, but
1184   * should be interpreted based on their containment location.
1185   */
1186  @Child(name = "parent", type = {
1187      DeviceComponent.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
1188  @Description(shortDefinition = "Describes the link to the parent DeviceComponent", formalDefinition = "Describes the link to the  DeviceComponent that this DeviceMetric belongs to and that provide information about the location of this DeviceMetric in the containment structure of the parent Device. An example would be a DeviceComponent that represents a Channel. This reference can be used by a client application to distinguish DeviceMetrics that have the same type, but should be interpreted based on their containment location.")
1189  protected Reference parent;
1190
1191  /**
1192   * The actual object that is the target of the reference (Describes the link to
1193   * the DeviceComponent that this DeviceMetric belongs to and that provide
1194   * information about the location of this DeviceMetric in the containment
1195   * structure of the parent Device. An example would be a DeviceComponent that
1196   * represents a Channel. This reference can be used by a client application to
1197   * distinguish DeviceMetrics that have the same type, but should be interpreted
1198   * based on their containment location.)
1199   */
1200  protected DeviceComponent parentTarget;
1201
1202  /**
1203   * Indicates current operational state of the device. For example: On, Off,
1204   * Standby, etc.
1205   */
1206  @Child(name = "operationalStatus", type = {
1207      CodeType.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
1208  @Description(shortDefinition = "on | off | standby", formalDefinition = "Indicates current operational state of the device. For example: On, Off, Standby, etc.")
1209  protected Enumeration<DeviceMetricOperationalStatus> operationalStatus;
1210
1211  /**
1212   * Describes the color representation for the metric. This is often used to aid
1213   * clinicians to track and identify parameter types by color. In practice,
1214   * consider a Patient Monitor that has ECG/HR and Pleth for example; the
1215   * parameters are displayed in different characteristic colors, such as HR-blue,
1216   * BP-green, and PR and SpO2- magenta.
1217   */
1218  @Child(name = "color", type = { CodeType.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
1219  @Description(shortDefinition = "black | red | green | yellow | blue | magenta | cyan | white", formalDefinition = "Describes the color representation for the metric. This is often used to aid clinicians to track and identify parameter types by color. In practice, consider a Patient Monitor that has ECG/HR and Pleth for example; the parameters are displayed in different characteristic colors, such as HR-blue, BP-green, and PR and SpO2- magenta.")
1220  protected Enumeration<DeviceMetricColor> color;
1221
1222  /**
1223   * Indicates the category of the observation generation process. A DeviceMetric
1224   * can be for example a setting, measurement, or calculation.
1225   */
1226  @Child(name = "category", type = { CodeType.class }, order = 7, min = 1, max = 1, modifier = false, summary = true)
1227  @Description(shortDefinition = "measurement | setting | calculation | unspecified", formalDefinition = "Indicates the category of the observation generation process. A DeviceMetric can be for example a setting, measurement, or calculation.")
1228  protected Enumeration<DeviceMetricCategory> category;
1229
1230  /**
1231   * Describes the measurement repetition time. This is not necessarily the same
1232   * as the update period. The measurement repetition time can range from
1233   * milliseconds up to hours. An example for a measurement repetition time in the
1234   * range of milliseconds is the sampling rate of an ECG. An example for a
1235   * measurement repetition time in the range of hours is a NIBP that is triggered
1236   * automatically every hour. The update period may be different than the
1237   * measurement repetition time, if the device does not update the published
1238   * observed value with the same frequency as it was measured.
1239   */
1240  @Child(name = "measurementPeriod", type = {
1241      Timing.class }, order = 8, min = 0, max = 1, modifier = false, summary = true)
1242  @Description(shortDefinition = "Describes the measurement repetition time", formalDefinition = "Describes the measurement repetition time. This is not necessarily the same as the update period. The measurement repetition time can range from milliseconds up to hours. An example for a measurement repetition time in the range of milliseconds is the sampling rate of an ECG. An example for a measurement repetition time in the range of hours is a NIBP that is triggered automatically every hour. The update period may be different than the measurement repetition time, if the device does not update the published observed value with the same frequency as it was measured.")
1243  protected Timing measurementPeriod;
1244
1245  /**
1246   * Describes the calibrations that have been performed or that are required to
1247   * be performed.
1248   */
1249  @Child(name = "calibration", type = {}, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1250  @Description(shortDefinition = "Describes the calibrations that have been performed or that are required to be performed", formalDefinition = "Describes the calibrations that have been performed or that are required to be performed.")
1251  protected List<DeviceMetricCalibrationComponent> calibration;
1252
1253  private static final long serialVersionUID = 1786401018L;
1254
1255  /*
1256   * Constructor
1257   */
1258  public DeviceMetric() {
1259    super();
1260  }
1261
1262  /*
1263   * Constructor
1264   */
1265  public DeviceMetric(CodeableConcept type, Identifier identifier, Enumeration<DeviceMetricCategory> category) {
1266    super();
1267    this.type = type;
1268    this.identifier = identifier;
1269    this.category = category;
1270  }
1271
1272  /**
1273   * @return {@link #type} (Describes the type of the metric. For example: Heart
1274   *         Rate, PEEP Setting, etc.)
1275   */
1276  public CodeableConcept getType() {
1277    if (this.type == null)
1278      if (Configuration.errorOnAutoCreate())
1279        throw new Error("Attempt to auto-create DeviceMetric.type");
1280      else if (Configuration.doAutoCreate())
1281        this.type = new CodeableConcept(); // cc
1282    return this.type;
1283  }
1284
1285  public boolean hasType() {
1286    return this.type != null && !this.type.isEmpty();
1287  }
1288
1289  /**
1290   * @param value {@link #type} (Describes the type of the metric. For example:
1291   *              Heart Rate, PEEP Setting, etc.)
1292   */
1293  public DeviceMetric setType(CodeableConcept value) {
1294    this.type = value;
1295    return this;
1296  }
1297
1298  /**
1299   * @return {@link #identifier} (Describes the unique identification of this
1300   *         metric that has been assigned by the device or gateway software. For
1301   *         example: handle ID. It should be noted that in order to make the
1302   *         identifier unique, the system element of the identifier should be set
1303   *         to the unique identifier of the device.)
1304   */
1305  public Identifier getIdentifier() {
1306    if (this.identifier == null)
1307      if (Configuration.errorOnAutoCreate())
1308        throw new Error("Attempt to auto-create DeviceMetric.identifier");
1309      else if (Configuration.doAutoCreate())
1310        this.identifier = new Identifier(); // cc
1311    return this.identifier;
1312  }
1313
1314  public boolean hasIdentifier() {
1315    return this.identifier != null && !this.identifier.isEmpty();
1316  }
1317
1318  /**
1319   * @param value {@link #identifier} (Describes the unique identification of this
1320   *              metric that has been assigned by the device or gateway software.
1321   *              For example: handle ID. It should be noted that in order to make
1322   *              the identifier unique, the system element of the identifier
1323   *              should be set to the unique identifier of the device.)
1324   */
1325  public DeviceMetric setIdentifier(Identifier value) {
1326    this.identifier = value;
1327    return this;
1328  }
1329
1330  /**
1331   * @return {@link #unit} (Describes the unit that an observed value determined
1332   *         for this metric will have. For example: Percent, Seconds, etc.)
1333   */
1334  public CodeableConcept getUnit() {
1335    if (this.unit == null)
1336      if (Configuration.errorOnAutoCreate())
1337        throw new Error("Attempt to auto-create DeviceMetric.unit");
1338      else if (Configuration.doAutoCreate())
1339        this.unit = new CodeableConcept(); // cc
1340    return this.unit;
1341  }
1342
1343  public boolean hasUnit() {
1344    return this.unit != null && !this.unit.isEmpty();
1345  }
1346
1347  /**
1348   * @param value {@link #unit} (Describes the unit that an observed value
1349   *              determined for this metric will have. For example: Percent,
1350   *              Seconds, etc.)
1351   */
1352  public DeviceMetric setUnit(CodeableConcept value) {
1353    this.unit = value;
1354    return this;
1355  }
1356
1357  /**
1358   * @return {@link #source} (Describes the link to the Device that this
1359   *         DeviceMetric belongs to and that contains administrative device
1360   *         information such as manufacture, serial number, etc.)
1361   */
1362  public Reference getSource() {
1363    if (this.source == null)
1364      if (Configuration.errorOnAutoCreate())
1365        throw new Error("Attempt to auto-create DeviceMetric.source");
1366      else if (Configuration.doAutoCreate())
1367        this.source = new Reference(); // cc
1368    return this.source;
1369  }
1370
1371  public boolean hasSource() {
1372    return this.source != null && !this.source.isEmpty();
1373  }
1374
1375  /**
1376   * @param value {@link #source} (Describes the link to the Device that this
1377   *              DeviceMetric belongs to and that contains administrative device
1378   *              information such as manufacture, serial number, etc.)
1379   */
1380  public DeviceMetric setSource(Reference value) {
1381    this.source = value;
1382    return this;
1383  }
1384
1385  /**
1386   * @return {@link #source} The actual object that is the target of the
1387   *         reference. The reference library doesn't populate this, but you can
1388   *         use it to hold the resource if you resolve it. (Describes the link to
1389   *         the Device that this DeviceMetric belongs to and that contains
1390   *         administrative device information such as manufacture, serial number,
1391   *         etc.)
1392   */
1393  public Device getSourceTarget() {
1394    if (this.sourceTarget == null)
1395      if (Configuration.errorOnAutoCreate())
1396        throw new Error("Attempt to auto-create DeviceMetric.source");
1397      else if (Configuration.doAutoCreate())
1398        this.sourceTarget = new Device(); // aa
1399    return this.sourceTarget;
1400  }
1401
1402  /**
1403   * @param value {@link #source} The actual object that is the target of the
1404   *              reference. The reference library doesn't use these, but you can
1405   *              use it to hold the resource if you resolve it. (Describes the
1406   *              link to the Device that this DeviceMetric belongs to and that
1407   *              contains administrative device information such as manufacture,
1408   *              serial number, etc.)
1409   */
1410  public DeviceMetric setSourceTarget(Device value) {
1411    this.sourceTarget = value;
1412    return this;
1413  }
1414
1415  /**
1416   * @return {@link #parent} (Describes the link to the DeviceComponent that this
1417   *         DeviceMetric belongs to and that provide information about the
1418   *         location of this DeviceMetric in the containment structure of the
1419   *         parent Device. An example would be a DeviceComponent that represents
1420   *         a Channel. This reference can be used by a client application to
1421   *         distinguish DeviceMetrics that have the same type, but should be
1422   *         interpreted based on their containment location.)
1423   */
1424  public Reference getParent() {
1425    if (this.parent == null)
1426      if (Configuration.errorOnAutoCreate())
1427        throw new Error("Attempt to auto-create DeviceMetric.parent");
1428      else if (Configuration.doAutoCreate())
1429        this.parent = new Reference(); // cc
1430    return this.parent;
1431  }
1432
1433  public boolean hasParent() {
1434    return this.parent != null && !this.parent.isEmpty();
1435  }
1436
1437  /**
1438   * @param value {@link #parent} (Describes the link to the DeviceComponent that
1439   *              this DeviceMetric belongs to and that provide information about
1440   *              the location of this DeviceMetric in the containment structure
1441   *              of the parent Device. An example would be a DeviceComponent that
1442   *              represents a Channel. This reference can be used by a client
1443   *              application to distinguish DeviceMetrics that have the same
1444   *              type, but should be interpreted based on their containment
1445   *              location.)
1446   */
1447  public DeviceMetric setParent(Reference value) {
1448    this.parent = value;
1449    return this;
1450  }
1451
1452  /**
1453   * @return {@link #parent} The actual object that is the target of the
1454   *         reference. The reference library doesn't populate this, but you can
1455   *         use it to hold the resource if you resolve it. (Describes the link to
1456   *         the DeviceComponent that this DeviceMetric belongs to and that
1457   *         provide information about the location of this DeviceMetric in the
1458   *         containment structure of the parent Device. An example would be a
1459   *         DeviceComponent that represents a Channel. This reference can be used
1460   *         by a client application to distinguish DeviceMetrics that have the
1461   *         same type, but should be interpreted based on their containment
1462   *         location.)
1463   */
1464  public DeviceComponent getParentTarget() {
1465    if (this.parentTarget == null)
1466      if (Configuration.errorOnAutoCreate())
1467        throw new Error("Attempt to auto-create DeviceMetric.parent");
1468      else if (Configuration.doAutoCreate())
1469        this.parentTarget = new DeviceComponent(); // aa
1470    return this.parentTarget;
1471  }
1472
1473  /**
1474   * @param value {@link #parent} The actual object that is the target of the
1475   *              reference. The reference library doesn't use these, but you can
1476   *              use it to hold the resource if you resolve it. (Describes the
1477   *              link to the DeviceComponent that this DeviceMetric belongs to
1478   *              and that provide information about the location of this
1479   *              DeviceMetric in the containment structure of the parent Device.
1480   *              An example would be a DeviceComponent that represents a Channel.
1481   *              This reference can be used by a client application to
1482   *              distinguish DeviceMetrics that have the same type, but should be
1483   *              interpreted based on their containment location.)
1484   */
1485  public DeviceMetric setParentTarget(DeviceComponent value) {
1486    this.parentTarget = value;
1487    return this;
1488  }
1489
1490  /**
1491   * @return {@link #operationalStatus} (Indicates current operational state of
1492   *         the device. For example: On, Off, Standby, etc.). This is the
1493   *         underlying object with id, value and extensions. The accessor
1494   *         "getOperationalStatus" gives direct access to the value
1495   */
1496  public Enumeration<DeviceMetricOperationalStatus> getOperationalStatusElement() {
1497    if (this.operationalStatus == null)
1498      if (Configuration.errorOnAutoCreate())
1499        throw new Error("Attempt to auto-create DeviceMetric.operationalStatus");
1500      else if (Configuration.doAutoCreate())
1501        this.operationalStatus = new Enumeration<DeviceMetricOperationalStatus>(
1502            new DeviceMetricOperationalStatusEnumFactory()); // bb
1503    return this.operationalStatus;
1504  }
1505
1506  public boolean hasOperationalStatusElement() {
1507    return this.operationalStatus != null && !this.operationalStatus.isEmpty();
1508  }
1509
1510  public boolean hasOperationalStatus() {
1511    return this.operationalStatus != null && !this.operationalStatus.isEmpty();
1512  }
1513
1514  /**
1515   * @param value {@link #operationalStatus} (Indicates current operational state
1516   *              of the device. For example: On, Off, Standby, etc.). This is the
1517   *              underlying object with id, value and extensions. The accessor
1518   *              "getOperationalStatus" gives direct access to the value
1519   */
1520  public DeviceMetric setOperationalStatusElement(Enumeration<DeviceMetricOperationalStatus> value) {
1521    this.operationalStatus = value;
1522    return this;
1523  }
1524
1525  /**
1526   * @return Indicates current operational state of the device. For example: On,
1527   *         Off, Standby, etc.
1528   */
1529  public DeviceMetricOperationalStatus getOperationalStatus() {
1530    return this.operationalStatus == null ? null : this.operationalStatus.getValue();
1531  }
1532
1533  /**
1534   * @param value Indicates current operational state of the device. For example:
1535   *              On, Off, Standby, etc.
1536   */
1537  public DeviceMetric setOperationalStatus(DeviceMetricOperationalStatus value) {
1538    if (value == null)
1539      this.operationalStatus = null;
1540    else {
1541      if (this.operationalStatus == null)
1542        this.operationalStatus = new Enumeration<DeviceMetricOperationalStatus>(
1543            new DeviceMetricOperationalStatusEnumFactory());
1544      this.operationalStatus.setValue(value);
1545    }
1546    return this;
1547  }
1548
1549  /**
1550   * @return {@link #color} (Describes the color representation for the metric.
1551   *         This is often used to aid clinicians to track and identify parameter
1552   *         types by color. In practice, consider a Patient Monitor that has
1553   *         ECG/HR and Pleth for example; the parameters are displayed in
1554   *         different characteristic colors, such as HR-blue, BP-green, and PR
1555   *         and SpO2- magenta.). This is the underlying object with id, value and
1556   *         extensions. The accessor "getColor" gives direct access to the value
1557   */
1558  public Enumeration<DeviceMetricColor> getColorElement() {
1559    if (this.color == null)
1560      if (Configuration.errorOnAutoCreate())
1561        throw new Error("Attempt to auto-create DeviceMetric.color");
1562      else if (Configuration.doAutoCreate())
1563        this.color = new Enumeration<DeviceMetricColor>(new DeviceMetricColorEnumFactory()); // bb
1564    return this.color;
1565  }
1566
1567  public boolean hasColorElement() {
1568    return this.color != null && !this.color.isEmpty();
1569  }
1570
1571  public boolean hasColor() {
1572    return this.color != null && !this.color.isEmpty();
1573  }
1574
1575  /**
1576   * @param value {@link #color} (Describes the color representation for the
1577   *              metric. This is often used to aid clinicians to track and
1578   *              identify parameter types by color. In practice, consider a
1579   *              Patient Monitor that has ECG/HR and Pleth for example; the
1580   *              parameters are displayed in different characteristic colors,
1581   *              such as HR-blue, BP-green, and PR and SpO2- magenta.). This is
1582   *              the underlying object with id, value and extensions. The
1583   *              accessor "getColor" gives direct access to the value
1584   */
1585  public DeviceMetric setColorElement(Enumeration<DeviceMetricColor> value) {
1586    this.color = value;
1587    return this;
1588  }
1589
1590  /**
1591   * @return Describes the color representation for the metric. This is often used
1592   *         to aid clinicians to track and identify parameter types by color. In
1593   *         practice, consider a Patient Monitor that has ECG/HR and Pleth for
1594   *         example; the parameters are displayed in different characteristic
1595   *         colors, such as HR-blue, BP-green, and PR and SpO2- magenta.
1596   */
1597  public DeviceMetricColor getColor() {
1598    return this.color == null ? null : this.color.getValue();
1599  }
1600
1601  /**
1602   * @param value Describes the color representation for the metric. This is often
1603   *              used to aid clinicians to track and identify parameter types by
1604   *              color. In practice, consider a Patient Monitor that has ECG/HR
1605   *              and Pleth for example; the parameters are displayed in different
1606   *              characteristic colors, such as HR-blue, BP-green, and PR and
1607   *              SpO2- magenta.
1608   */
1609  public DeviceMetric setColor(DeviceMetricColor value) {
1610    if (value == null)
1611      this.color = null;
1612    else {
1613      if (this.color == null)
1614        this.color = new Enumeration<DeviceMetricColor>(new DeviceMetricColorEnumFactory());
1615      this.color.setValue(value);
1616    }
1617    return this;
1618  }
1619
1620  /**
1621   * @return {@link #category} (Indicates the category of the observation
1622   *         generation process. A DeviceMetric can be for example a setting,
1623   *         measurement, or calculation.). This is the underlying object with id,
1624   *         value and extensions. The accessor "getCategory" gives direct access
1625   *         to the value
1626   */
1627  public Enumeration<DeviceMetricCategory> getCategoryElement() {
1628    if (this.category == null)
1629      if (Configuration.errorOnAutoCreate())
1630        throw new Error("Attempt to auto-create DeviceMetric.category");
1631      else if (Configuration.doAutoCreate())
1632        this.category = new Enumeration<DeviceMetricCategory>(new DeviceMetricCategoryEnumFactory()); // bb
1633    return this.category;
1634  }
1635
1636  public boolean hasCategoryElement() {
1637    return this.category != null && !this.category.isEmpty();
1638  }
1639
1640  public boolean hasCategory() {
1641    return this.category != null && !this.category.isEmpty();
1642  }
1643
1644  /**
1645   * @param value {@link #category} (Indicates the category of the observation
1646   *              generation process. A DeviceMetric can be for example a setting,
1647   *              measurement, or calculation.). This is the underlying object
1648   *              with id, value and extensions. The accessor "getCategory" gives
1649   *              direct access to the value
1650   */
1651  public DeviceMetric setCategoryElement(Enumeration<DeviceMetricCategory> value) {
1652    this.category = value;
1653    return this;
1654  }
1655
1656  /**
1657   * @return Indicates the category of the observation generation process. A
1658   *         DeviceMetric can be for example a setting, measurement, or
1659   *         calculation.
1660   */
1661  public DeviceMetricCategory getCategory() {
1662    return this.category == null ? null : this.category.getValue();
1663  }
1664
1665  /**
1666   * @param value Indicates the category of the observation generation process. A
1667   *              DeviceMetric can be for example a setting, measurement, or
1668   *              calculation.
1669   */
1670  public DeviceMetric setCategory(DeviceMetricCategory value) {
1671    if (this.category == null)
1672      this.category = new Enumeration<DeviceMetricCategory>(new DeviceMetricCategoryEnumFactory());
1673    this.category.setValue(value);
1674    return this;
1675  }
1676
1677  /**
1678   * @return {@link #measurementPeriod} (Describes the measurement repetition
1679   *         time. This is not necessarily the same as the update period. The
1680   *         measurement repetition time can range from milliseconds up to hours.
1681   *         An example for a measurement repetition time in the range of
1682   *         milliseconds is the sampling rate of an ECG. An example for a
1683   *         measurement repetition time in the range of hours is a NIBP that is
1684   *         triggered automatically every hour. The update period may be
1685   *         different than the measurement repetition time, if the device does
1686   *         not update the published observed value with the same frequency as it
1687   *         was measured.)
1688   */
1689  public Timing getMeasurementPeriod() {
1690    if (this.measurementPeriod == null)
1691      if (Configuration.errorOnAutoCreate())
1692        throw new Error("Attempt to auto-create DeviceMetric.measurementPeriod");
1693      else if (Configuration.doAutoCreate())
1694        this.measurementPeriod = new Timing(); // cc
1695    return this.measurementPeriod;
1696  }
1697
1698  public boolean hasMeasurementPeriod() {
1699    return this.measurementPeriod != null && !this.measurementPeriod.isEmpty();
1700  }
1701
1702  /**
1703   * @param value {@link #measurementPeriod} (Describes the measurement repetition
1704   *              time. This is not necessarily the same as the update period. The
1705   *              measurement repetition time can range from milliseconds up to
1706   *              hours. An example for a measurement repetition time in the range
1707   *              of milliseconds is the sampling rate of an ECG. An example for a
1708   *              measurement repetition time in the range of hours is a NIBP that
1709   *              is triggered automatically every hour. The update period may be
1710   *              different than the measurement repetition time, if the device
1711   *              does not update the published observed value with the same
1712   *              frequency as it was measured.)
1713   */
1714  public DeviceMetric setMeasurementPeriod(Timing value) {
1715    this.measurementPeriod = value;
1716    return this;
1717  }
1718
1719  /**
1720   * @return {@link #calibration} (Describes the calibrations that have been
1721   *         performed or that are required to be performed.)
1722   */
1723  public List<DeviceMetricCalibrationComponent> getCalibration() {
1724    if (this.calibration == null)
1725      this.calibration = new ArrayList<DeviceMetricCalibrationComponent>();
1726    return this.calibration;
1727  }
1728
1729  public boolean hasCalibration() {
1730    if (this.calibration == null)
1731      return false;
1732    for (DeviceMetricCalibrationComponent item : this.calibration)
1733      if (!item.isEmpty())
1734        return true;
1735    return false;
1736  }
1737
1738  /**
1739   * @return {@link #calibration} (Describes the calibrations that have been
1740   *         performed or that are required to be performed.)
1741   */
1742  // syntactic sugar
1743  public DeviceMetricCalibrationComponent addCalibration() { // 3
1744    DeviceMetricCalibrationComponent t = new DeviceMetricCalibrationComponent();
1745    if (this.calibration == null)
1746      this.calibration = new ArrayList<DeviceMetricCalibrationComponent>();
1747    this.calibration.add(t);
1748    return t;
1749  }
1750
1751  // syntactic sugar
1752  public DeviceMetric addCalibration(DeviceMetricCalibrationComponent t) { // 3
1753    if (t == null)
1754      return this;
1755    if (this.calibration == null)
1756      this.calibration = new ArrayList<DeviceMetricCalibrationComponent>();
1757    this.calibration.add(t);
1758    return this;
1759  }
1760
1761  protected void listChildren(List<Property> childrenList) {
1762    super.listChildren(childrenList);
1763    childrenList.add(new Property("type", "CodeableConcept",
1764        "Describes the type of the metric. For example: Heart Rate, PEEP Setting, etc.", 0, java.lang.Integer.MAX_VALUE,
1765        type));
1766    childrenList.add(new Property("identifier", "Identifier",
1767        "Describes the unique identification of this metric that has been assigned by the device or gateway software. For example: handle ID.  It should be noted that in order to make the identifier unique, the system element of the identifier should be set to the unique identifier of the device.",
1768        0, java.lang.Integer.MAX_VALUE, identifier));
1769    childrenList.add(new Property("unit", "CodeableConcept",
1770        "Describes the unit that an observed value determined for this metric will have. For example: Percent, Seconds, etc.",
1771        0, java.lang.Integer.MAX_VALUE, unit));
1772    childrenList.add(new Property("source", "Reference(Device)",
1773        "Describes the link to the  Device that this DeviceMetric belongs to and that contains administrative device information such as manufacture, serial number, etc.",
1774        0, java.lang.Integer.MAX_VALUE, source));
1775    childrenList.add(new Property("parent", "Reference(DeviceComponent)",
1776        "Describes the link to the  DeviceComponent that this DeviceMetric belongs to and that provide information about the location of this DeviceMetric in the containment structure of the parent Device. An example would be a DeviceComponent that represents a Channel. This reference can be used by a client application to distinguish DeviceMetrics that have the same type, but should be interpreted based on their containment location.",
1777        0, java.lang.Integer.MAX_VALUE, parent));
1778    childrenList.add(new Property("operationalStatus", "code",
1779        "Indicates current operational state of the device. For example: On, Off, Standby, etc.", 0,
1780        java.lang.Integer.MAX_VALUE, operationalStatus));
1781    childrenList.add(new Property("color", "code",
1782        "Describes the color representation for the metric. This is often used to aid clinicians to track and identify parameter types by color. In practice, consider a Patient Monitor that has ECG/HR and Pleth for example; the parameters are displayed in different characteristic colors, such as HR-blue, BP-green, and PR and SpO2- magenta.",
1783        0, java.lang.Integer.MAX_VALUE, color));
1784    childrenList.add(new Property("category", "code",
1785        "Indicates the category of the observation generation process. A DeviceMetric can be for example a setting, measurement, or calculation.",
1786        0, java.lang.Integer.MAX_VALUE, category));
1787    childrenList.add(new Property("measurementPeriod", "Timing",
1788        "Describes the measurement repetition time. This is not necessarily the same as the update period. The measurement repetition time can range from milliseconds up to hours. An example for a measurement repetition time in the range of milliseconds is the sampling rate of an ECG. An example for a measurement repetition time in the range of hours is a NIBP that is triggered automatically every hour. The update period may be different than the measurement repetition time, if the device does not update the published observed value with the same frequency as it was measured.",
1789        0, java.lang.Integer.MAX_VALUE, measurementPeriod));
1790    childrenList.add(new Property("calibration", "",
1791        "Describes the calibrations that have been performed or that are required to be performed.", 0,
1792        java.lang.Integer.MAX_VALUE, calibration));
1793  }
1794
1795  @Override
1796  public void setProperty(String name, Base value) throws FHIRException {
1797    if (name.equals("type"))
1798      this.type = castToCodeableConcept(value); // CodeableConcept
1799    else if (name.equals("identifier"))
1800      this.identifier = castToIdentifier(value); // Identifier
1801    else if (name.equals("unit"))
1802      this.unit = castToCodeableConcept(value); // CodeableConcept
1803    else if (name.equals("source"))
1804      this.source = castToReference(value); // Reference
1805    else if (name.equals("parent"))
1806      this.parent = castToReference(value); // Reference
1807    else if (name.equals("operationalStatus"))
1808      this.operationalStatus = new DeviceMetricOperationalStatusEnumFactory().fromType(value); // Enumeration<DeviceMetricOperationalStatus>
1809    else if (name.equals("color"))
1810      this.color = new DeviceMetricColorEnumFactory().fromType(value); // Enumeration<DeviceMetricColor>
1811    else if (name.equals("category"))
1812      this.category = new DeviceMetricCategoryEnumFactory().fromType(value); // Enumeration<DeviceMetricCategory>
1813    else if (name.equals("measurementPeriod"))
1814      this.measurementPeriod = castToTiming(value); // Timing
1815    else if (name.equals("calibration"))
1816      this.getCalibration().add((DeviceMetricCalibrationComponent) value);
1817    else
1818      super.setProperty(name, value);
1819  }
1820
1821  @Override
1822  public Base addChild(String name) throws FHIRException {
1823    if (name.equals("type")) {
1824      this.type = new CodeableConcept();
1825      return this.type;
1826    } else if (name.equals("identifier")) {
1827      this.identifier = new Identifier();
1828      return this.identifier;
1829    } else if (name.equals("unit")) {
1830      this.unit = new CodeableConcept();
1831      return this.unit;
1832    } else if (name.equals("source")) {
1833      this.source = new Reference();
1834      return this.source;
1835    } else if (name.equals("parent")) {
1836      this.parent = new Reference();
1837      return this.parent;
1838    } else if (name.equals("operationalStatus")) {
1839      throw new FHIRException("Cannot call addChild on a singleton property DeviceMetric.operationalStatus");
1840    } else if (name.equals("color")) {
1841      throw new FHIRException("Cannot call addChild on a singleton property DeviceMetric.color");
1842    } else if (name.equals("category")) {
1843      throw new FHIRException("Cannot call addChild on a singleton property DeviceMetric.category");
1844    } else if (name.equals("measurementPeriod")) {
1845      this.measurementPeriod = new Timing();
1846      return this.measurementPeriod;
1847    } else if (name.equals("calibration")) {
1848      return addCalibration();
1849    } else
1850      return super.addChild(name);
1851  }
1852
1853  public String fhirType() {
1854    return "DeviceMetric";
1855
1856  }
1857
1858  public DeviceMetric copy() {
1859    DeviceMetric dst = new DeviceMetric();
1860    copyValues(dst);
1861    dst.type = type == null ? null : type.copy();
1862    dst.identifier = identifier == null ? null : identifier.copy();
1863    dst.unit = unit == null ? null : unit.copy();
1864    dst.source = source == null ? null : source.copy();
1865    dst.parent = parent == null ? null : parent.copy();
1866    dst.operationalStatus = operationalStatus == null ? null : operationalStatus.copy();
1867    dst.color = color == null ? null : color.copy();
1868    dst.category = category == null ? null : category.copy();
1869    dst.measurementPeriod = measurementPeriod == null ? null : measurementPeriod.copy();
1870    if (calibration != null) {
1871      dst.calibration = new ArrayList<DeviceMetricCalibrationComponent>();
1872      for (DeviceMetricCalibrationComponent i : calibration)
1873        dst.calibration.add(i.copy());
1874    }
1875    ;
1876    return dst;
1877  }
1878
1879  protected DeviceMetric typedCopy() {
1880    return copy();
1881  }
1882
1883  @Override
1884  public boolean equalsDeep(Base other) {
1885    if (!super.equalsDeep(other))
1886      return false;
1887    if (!(other instanceof DeviceMetric))
1888      return false;
1889    DeviceMetric o = (DeviceMetric) other;
1890    return compareDeep(type, o.type, true) && compareDeep(identifier, o.identifier, true)
1891        && compareDeep(unit, o.unit, true) && compareDeep(source, o.source, true) && compareDeep(parent, o.parent, true)
1892        && compareDeep(operationalStatus, o.operationalStatus, true) && compareDeep(color, o.color, true)
1893        && compareDeep(category, o.category, true) && compareDeep(measurementPeriod, o.measurementPeriod, true)
1894        && compareDeep(calibration, o.calibration, true);
1895  }
1896
1897  @Override
1898  public boolean equalsShallow(Base other) {
1899    if (!super.equalsShallow(other))
1900      return false;
1901    if (!(other instanceof DeviceMetric))
1902      return false;
1903    DeviceMetric o = (DeviceMetric) other;
1904    return compareValues(operationalStatus, o.operationalStatus, true) && compareValues(color, o.color, true)
1905        && compareValues(category, o.category, true);
1906  }
1907
1908  public boolean isEmpty() {
1909    return super.isEmpty() && (type == null || type.isEmpty()) && (identifier == null || identifier.isEmpty())
1910        && (unit == null || unit.isEmpty()) && (source == null || source.isEmpty())
1911        && (parent == null || parent.isEmpty()) && (operationalStatus == null || operationalStatus.isEmpty())
1912        && (color == null || color.isEmpty()) && (category == null || category.isEmpty())
1913        && (measurementPeriod == null || measurementPeriod.isEmpty()) && (calibration == null || calibration.isEmpty());
1914  }
1915
1916  @Override
1917  public ResourceType getResourceType() {
1918    return ResourceType.DeviceMetric;
1919  }
1920
1921  @SearchParamDefinition(name = "parent", path = "DeviceMetric.parent", description = "The parent DeviceMetric resource", type = "reference")
1922  public static final String SP_PARENT = "parent";
1923  @SearchParamDefinition(name = "identifier", path = "DeviceMetric.identifier", description = "The identifier of the metric", type = "token")
1924  public static final String SP_IDENTIFIER = "identifier";
1925  @SearchParamDefinition(name = "source", path = "DeviceMetric.source", description = "The device resource", type = "reference")
1926  public static final String SP_SOURCE = "source";
1927  @SearchParamDefinition(name = "type", path = "DeviceMetric.type", description = "The component type", type = "token")
1928  public static final String SP_TYPE = "type";
1929  @SearchParamDefinition(name = "category", path = "DeviceMetric.category", description = "The category of the metric", type = "token")
1930  public static final String SP_CATEGORY = "category";
1931
1932}