001package org.hl7.fhir.r4.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 Sun, May 6, 2018 17:51-0400 for FHIR v3.4.0
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import ca.uhn.fhir.model.api.annotation.ResourceDef;
038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.ChildOrder;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.Block;
043import org.hl7.fhir.instance.model.api.*;
044import org.hl7.fhir.exceptions.FHIRException;
045/**
046 * A physical, countable instance of an item, for example one box or one unit.
047 */
048@ResourceDef(name="ItemInstance", profile="http://hl7.org/fhir/Profile/ItemInstance")
049public class ItemInstance extends DomainResource {
050
051    /**
052     * The quantity or amount of instances. For example if several units are being counted for inventory, this quantity can be more than one, provided they are not unique. Seriallized items are considered unique and as such would have a quantity max 1. This element is required and its presence asserts that the reource refers to a physical item.
053     */
054    @Child(name = "count", type = {IntegerType.class}, order=0, min=1, max=1, modifier=false, summary=true)
055    @Description(shortDefinition="The count of items", formalDefinition="The quantity or amount of instances. For example if several units are being counted for inventory, this quantity can be more than one, provided they are not unique. Seriallized items are considered unique and as such would have a quantity max 1. This element is required and its presence asserts that the reource refers to a physical item." )
056    protected IntegerType count;
057
058    /**
059     * The location where the item is phisically located.
060     */
061    @Child(name = "location", type = {Location.class}, order=1, min=0, max=1, modifier=false, summary=true)
062    @Description(shortDefinition="The physical location of the item", formalDefinition="The location where the item is phisically located." )
063    protected Reference location;
064
065    /**
066     * The actual object that is the target of the reference (The location where the item is phisically located.)
067     */
068    protected Location locationTarget;
069
070    /**
071     * The patient that the item is associated with (implanted in, given to).
072     */
073    @Child(name = "subject", type = {Patient.class}, order=2, min=0, max=1, modifier=false, summary=true)
074    @Description(shortDefinition="The patient that the item is affixed to", formalDefinition="The patient that the item is associated with (implanted in, given to)." )
075    protected Reference subject;
076
077    /**
078     * The actual object that is the target of the reference (The patient that the item is associated with (implanted in, given to).)
079     */
080    protected Patient subjectTarget;
081
082    /**
083     * The manufacture or preparation date and time. Times are necessary for several examples - for example biologically derived products, prepared or coumpounded medication, rapidly decaying isotopes.
084     */
085    @Child(name = "manufactureDate", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
086    @Description(shortDefinition="The manufacture or preparation date and time", formalDefinition="The manufacture or preparation date and time. Times are necessary for several examples - for example biologically derived products, prepared or coumpounded medication, rapidly decaying isotopes." )
087    protected DateTimeType manufactureDate;
088
089    /**
090     * The expiry or preparation date and time.
091     */
092    @Child(name = "expiryDate", type = {DateTimeType.class}, order=4, min=0, max=1, modifier=false, summary=true)
093    @Description(shortDefinition="The expiry or preparation date and time", formalDefinition="The expiry or preparation date and time." )
094    protected DateTimeType expiryDate;
095
096    /**
097     * The Software version associated with the device, typically only used for devices with embedded software or firmware.
098     */
099    @Child(name = "currentSWVersion", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
100    @Description(shortDefinition="The Software version associated with the device", formalDefinition="The Software version associated with the device, typically only used for devices with embedded software or firmware." )
101    protected StringType currentSWVersion;
102
103    /**
104     * The lot or batch number.
105     */
106    @Child(name = "lotNumber", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
107    @Description(shortDefinition="The lot or batch number", formalDefinition="The lot or batch number." )
108    protected StringType lotNumber;
109
110    /**
111     * The serial number if available.
112     */
113    @Child(name = "serialNumber", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
114    @Description(shortDefinition="The serial number if available", formalDefinition="The serial number if available." )
115    protected StringType serialNumber;
116
117    /**
118     * The machine-readable AIDC string in base64 encoding. Can correspond to the UDI pattern in devices.
119     */
120    @Child(name = "carrierAIDC", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=true)
121    @Description(shortDefinition="The machine-readable AIDC string in base64 encoding", formalDefinition="The machine-readable AIDC string in base64 encoding. Can correspond to the UDI pattern in devices." )
122    protected StringType carrierAIDC;
123
124    /**
125     * The human-readable barcode string. Can correspond to the UDI pattern in devices.
126     */
127    @Child(name = "carrierHRF", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=true)
128    @Description(shortDefinition="The human-readable barcode string", formalDefinition="The human-readable barcode string. Can correspond to the UDI pattern in devices." )
129    protected StringType carrierHRF;
130
131    private static final long serialVersionUID = 1664070945L;
132
133  /**
134   * Constructor
135   */
136    public ItemInstance() {
137      super();
138    }
139
140  /**
141   * Constructor
142   */
143    public ItemInstance(IntegerType count) {
144      super();
145      this.count = count;
146    }
147
148    /**
149     * @return {@link #count} (The quantity or amount of instances. For example if several units are being counted for inventory, this quantity can be more than one, provided they are not unique. Seriallized items are considered unique and as such would have a quantity max 1. This element is required and its presence asserts that the reource refers to a physical item.). This is the underlying object with id, value and extensions. The accessor "getCount" gives direct access to the value
150     */
151    public IntegerType getCountElement() { 
152      if (this.count == null)
153        if (Configuration.errorOnAutoCreate())
154          throw new Error("Attempt to auto-create ItemInstance.count");
155        else if (Configuration.doAutoCreate())
156          this.count = new IntegerType(); // bb
157      return this.count;
158    }
159
160    public boolean hasCountElement() { 
161      return this.count != null && !this.count.isEmpty();
162    }
163
164    public boolean hasCount() { 
165      return this.count != null && !this.count.isEmpty();
166    }
167
168    /**
169     * @param value {@link #count} (The quantity or amount of instances. For example if several units are being counted for inventory, this quantity can be more than one, provided they are not unique. Seriallized items are considered unique and as such would have a quantity max 1. This element is required and its presence asserts that the reource refers to a physical item.). This is the underlying object with id, value and extensions. The accessor "getCount" gives direct access to the value
170     */
171    public ItemInstance setCountElement(IntegerType value) { 
172      this.count = value;
173      return this;
174    }
175
176    /**
177     * @return The quantity or amount of instances. For example if several units are being counted for inventory, this quantity can be more than one, provided they are not unique. Seriallized items are considered unique and as such would have a quantity max 1. This element is required and its presence asserts that the reource refers to a physical item.
178     */
179    public int getCount() { 
180      return this.count == null || this.count.isEmpty() ? 0 : this.count.getValue();
181    }
182
183    /**
184     * @param value The quantity or amount of instances. For example if several units are being counted for inventory, this quantity can be more than one, provided they are not unique. Seriallized items are considered unique and as such would have a quantity max 1. This element is required and its presence asserts that the reource refers to a physical item.
185     */
186    public ItemInstance setCount(int value) { 
187        if (this.count == null)
188          this.count = new IntegerType();
189        this.count.setValue(value);
190      return this;
191    }
192
193    /**
194     * @return {@link #location} (The location where the item is phisically located.)
195     */
196    public Reference getLocation() { 
197      if (this.location == null)
198        if (Configuration.errorOnAutoCreate())
199          throw new Error("Attempt to auto-create ItemInstance.location");
200        else if (Configuration.doAutoCreate())
201          this.location = new Reference(); // cc
202      return this.location;
203    }
204
205    public boolean hasLocation() { 
206      return this.location != null && !this.location.isEmpty();
207    }
208
209    /**
210     * @param value {@link #location} (The location where the item is phisically located.)
211     */
212    public ItemInstance setLocation(Reference value) { 
213      this.location = value;
214      return this;
215    }
216
217    /**
218     * @return {@link #location} 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. (The location where the item is phisically located.)
219     */
220    public Location getLocationTarget() { 
221      if (this.locationTarget == null)
222        if (Configuration.errorOnAutoCreate())
223          throw new Error("Attempt to auto-create ItemInstance.location");
224        else if (Configuration.doAutoCreate())
225          this.locationTarget = new Location(); // aa
226      return this.locationTarget;
227    }
228
229    /**
230     * @param value {@link #location} 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. (The location where the item is phisically located.)
231     */
232    public ItemInstance setLocationTarget(Location value) { 
233      this.locationTarget = value;
234      return this;
235    }
236
237    /**
238     * @return {@link #subject} (The patient that the item is associated with (implanted in, given to).)
239     */
240    public Reference getSubject() { 
241      if (this.subject == null)
242        if (Configuration.errorOnAutoCreate())
243          throw new Error("Attempt to auto-create ItemInstance.subject");
244        else if (Configuration.doAutoCreate())
245          this.subject = new Reference(); // cc
246      return this.subject;
247    }
248
249    public boolean hasSubject() { 
250      return this.subject != null && !this.subject.isEmpty();
251    }
252
253    /**
254     * @param value {@link #subject} (The patient that the item is associated with (implanted in, given to).)
255     */
256    public ItemInstance setSubject(Reference value) { 
257      this.subject = value;
258      return this;
259    }
260
261    /**
262     * @return {@link #subject} 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. (The patient that the item is associated with (implanted in, given to).)
263     */
264    public Patient getSubjectTarget() { 
265      if (this.subjectTarget == null)
266        if (Configuration.errorOnAutoCreate())
267          throw new Error("Attempt to auto-create ItemInstance.subject");
268        else if (Configuration.doAutoCreate())
269          this.subjectTarget = new Patient(); // aa
270      return this.subjectTarget;
271    }
272
273    /**
274     * @param value {@link #subject} 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. (The patient that the item is associated with (implanted in, given to).)
275     */
276    public ItemInstance setSubjectTarget(Patient value) { 
277      this.subjectTarget = value;
278      return this;
279    }
280
281    /**
282     * @return {@link #manufactureDate} (The manufacture or preparation date and time. Times are necessary for several examples - for example biologically derived products, prepared or coumpounded medication, rapidly decaying isotopes.). This is the underlying object with id, value and extensions. The accessor "getManufactureDate" gives direct access to the value
283     */
284    public DateTimeType getManufactureDateElement() { 
285      if (this.manufactureDate == null)
286        if (Configuration.errorOnAutoCreate())
287          throw new Error("Attempt to auto-create ItemInstance.manufactureDate");
288        else if (Configuration.doAutoCreate())
289          this.manufactureDate = new DateTimeType(); // bb
290      return this.manufactureDate;
291    }
292
293    public boolean hasManufactureDateElement() { 
294      return this.manufactureDate != null && !this.manufactureDate.isEmpty();
295    }
296
297    public boolean hasManufactureDate() { 
298      return this.manufactureDate != null && !this.manufactureDate.isEmpty();
299    }
300
301    /**
302     * @param value {@link #manufactureDate} (The manufacture or preparation date and time. Times are necessary for several examples - for example biologically derived products, prepared or coumpounded medication, rapidly decaying isotopes.). This is the underlying object with id, value and extensions. The accessor "getManufactureDate" gives direct access to the value
303     */
304    public ItemInstance setManufactureDateElement(DateTimeType value) { 
305      this.manufactureDate = value;
306      return this;
307    }
308
309    /**
310     * @return The manufacture or preparation date and time. Times are necessary for several examples - for example biologically derived products, prepared or coumpounded medication, rapidly decaying isotopes.
311     */
312    public Date getManufactureDate() { 
313      return this.manufactureDate == null ? null : this.manufactureDate.getValue();
314    }
315
316    /**
317     * @param value The manufacture or preparation date and time. Times are necessary for several examples - for example biologically derived products, prepared or coumpounded medication, rapidly decaying isotopes.
318     */
319    public ItemInstance setManufactureDate(Date value) { 
320      if (value == null)
321        this.manufactureDate = null;
322      else {
323        if (this.manufactureDate == null)
324          this.manufactureDate = new DateTimeType();
325        this.manufactureDate.setValue(value);
326      }
327      return this;
328    }
329
330    /**
331     * @return {@link #expiryDate} (The expiry or preparation date and time.). This is the underlying object with id, value and extensions. The accessor "getExpiryDate" gives direct access to the value
332     */
333    public DateTimeType getExpiryDateElement() { 
334      if (this.expiryDate == null)
335        if (Configuration.errorOnAutoCreate())
336          throw new Error("Attempt to auto-create ItemInstance.expiryDate");
337        else if (Configuration.doAutoCreate())
338          this.expiryDate = new DateTimeType(); // bb
339      return this.expiryDate;
340    }
341
342    public boolean hasExpiryDateElement() { 
343      return this.expiryDate != null && !this.expiryDate.isEmpty();
344    }
345
346    public boolean hasExpiryDate() { 
347      return this.expiryDate != null && !this.expiryDate.isEmpty();
348    }
349
350    /**
351     * @param value {@link #expiryDate} (The expiry or preparation date and time.). This is the underlying object with id, value and extensions. The accessor "getExpiryDate" gives direct access to the value
352     */
353    public ItemInstance setExpiryDateElement(DateTimeType value) { 
354      this.expiryDate = value;
355      return this;
356    }
357
358    /**
359     * @return The expiry or preparation date and time.
360     */
361    public Date getExpiryDate() { 
362      return this.expiryDate == null ? null : this.expiryDate.getValue();
363    }
364
365    /**
366     * @param value The expiry or preparation date and time.
367     */
368    public ItemInstance setExpiryDate(Date value) { 
369      if (value == null)
370        this.expiryDate = null;
371      else {
372        if (this.expiryDate == null)
373          this.expiryDate = new DateTimeType();
374        this.expiryDate.setValue(value);
375      }
376      return this;
377    }
378
379    /**
380     * @return {@link #currentSWVersion} (The Software version associated with the device, typically only used for devices with embedded software or firmware.). This is the underlying object with id, value and extensions. The accessor "getCurrentSWVersion" gives direct access to the value
381     */
382    public StringType getCurrentSWVersionElement() { 
383      if (this.currentSWVersion == null)
384        if (Configuration.errorOnAutoCreate())
385          throw new Error("Attempt to auto-create ItemInstance.currentSWVersion");
386        else if (Configuration.doAutoCreate())
387          this.currentSWVersion = new StringType(); // bb
388      return this.currentSWVersion;
389    }
390
391    public boolean hasCurrentSWVersionElement() { 
392      return this.currentSWVersion != null && !this.currentSWVersion.isEmpty();
393    }
394
395    public boolean hasCurrentSWVersion() { 
396      return this.currentSWVersion != null && !this.currentSWVersion.isEmpty();
397    }
398
399    /**
400     * @param value {@link #currentSWVersion} (The Software version associated with the device, typically only used for devices with embedded software or firmware.). This is the underlying object with id, value and extensions. The accessor "getCurrentSWVersion" gives direct access to the value
401     */
402    public ItemInstance setCurrentSWVersionElement(StringType value) { 
403      this.currentSWVersion = value;
404      return this;
405    }
406
407    /**
408     * @return The Software version associated with the device, typically only used for devices with embedded software or firmware.
409     */
410    public String getCurrentSWVersion() { 
411      return this.currentSWVersion == null ? null : this.currentSWVersion.getValue();
412    }
413
414    /**
415     * @param value The Software version associated with the device, typically only used for devices with embedded software or firmware.
416     */
417    public ItemInstance setCurrentSWVersion(String value) { 
418      if (Utilities.noString(value))
419        this.currentSWVersion = null;
420      else {
421        if (this.currentSWVersion == null)
422          this.currentSWVersion = new StringType();
423        this.currentSWVersion.setValue(value);
424      }
425      return this;
426    }
427
428    /**
429     * @return {@link #lotNumber} (The lot or batch number.). This is the underlying object with id, value and extensions. The accessor "getLotNumber" gives direct access to the value
430     */
431    public StringType getLotNumberElement() { 
432      if (this.lotNumber == null)
433        if (Configuration.errorOnAutoCreate())
434          throw new Error("Attempt to auto-create ItemInstance.lotNumber");
435        else if (Configuration.doAutoCreate())
436          this.lotNumber = new StringType(); // bb
437      return this.lotNumber;
438    }
439
440    public boolean hasLotNumberElement() { 
441      return this.lotNumber != null && !this.lotNumber.isEmpty();
442    }
443
444    public boolean hasLotNumber() { 
445      return this.lotNumber != null && !this.lotNumber.isEmpty();
446    }
447
448    /**
449     * @param value {@link #lotNumber} (The lot or batch number.). This is the underlying object with id, value and extensions. The accessor "getLotNumber" gives direct access to the value
450     */
451    public ItemInstance setLotNumberElement(StringType value) { 
452      this.lotNumber = value;
453      return this;
454    }
455
456    /**
457     * @return The lot or batch number.
458     */
459    public String getLotNumber() { 
460      return this.lotNumber == null ? null : this.lotNumber.getValue();
461    }
462
463    /**
464     * @param value The lot or batch number.
465     */
466    public ItemInstance setLotNumber(String value) { 
467      if (Utilities.noString(value))
468        this.lotNumber = null;
469      else {
470        if (this.lotNumber == null)
471          this.lotNumber = new StringType();
472        this.lotNumber.setValue(value);
473      }
474      return this;
475    }
476
477    /**
478     * @return {@link #serialNumber} (The serial number if available.). This is the underlying object with id, value and extensions. The accessor "getSerialNumber" gives direct access to the value
479     */
480    public StringType getSerialNumberElement() { 
481      if (this.serialNumber == null)
482        if (Configuration.errorOnAutoCreate())
483          throw new Error("Attempt to auto-create ItemInstance.serialNumber");
484        else if (Configuration.doAutoCreate())
485          this.serialNumber = new StringType(); // bb
486      return this.serialNumber;
487    }
488
489    public boolean hasSerialNumberElement() { 
490      return this.serialNumber != null && !this.serialNumber.isEmpty();
491    }
492
493    public boolean hasSerialNumber() { 
494      return this.serialNumber != null && !this.serialNumber.isEmpty();
495    }
496
497    /**
498     * @param value {@link #serialNumber} (The serial number if available.). This is the underlying object with id, value and extensions. The accessor "getSerialNumber" gives direct access to the value
499     */
500    public ItemInstance setSerialNumberElement(StringType value) { 
501      this.serialNumber = value;
502      return this;
503    }
504
505    /**
506     * @return The serial number if available.
507     */
508    public String getSerialNumber() { 
509      return this.serialNumber == null ? null : this.serialNumber.getValue();
510    }
511
512    /**
513     * @param value The serial number if available.
514     */
515    public ItemInstance setSerialNumber(String value) { 
516      if (Utilities.noString(value))
517        this.serialNumber = null;
518      else {
519        if (this.serialNumber == null)
520          this.serialNumber = new StringType();
521        this.serialNumber.setValue(value);
522      }
523      return this;
524    }
525
526    /**
527     * @return {@link #carrierAIDC} (The machine-readable AIDC string in base64 encoding. Can correspond to the UDI pattern in devices.). This is the underlying object with id, value and extensions. The accessor "getCarrierAIDC" gives direct access to the value
528     */
529    public StringType getCarrierAIDCElement() { 
530      if (this.carrierAIDC == null)
531        if (Configuration.errorOnAutoCreate())
532          throw new Error("Attempt to auto-create ItemInstance.carrierAIDC");
533        else if (Configuration.doAutoCreate())
534          this.carrierAIDC = new StringType(); // bb
535      return this.carrierAIDC;
536    }
537
538    public boolean hasCarrierAIDCElement() { 
539      return this.carrierAIDC != null && !this.carrierAIDC.isEmpty();
540    }
541
542    public boolean hasCarrierAIDC() { 
543      return this.carrierAIDC != null && !this.carrierAIDC.isEmpty();
544    }
545
546    /**
547     * @param value {@link #carrierAIDC} (The machine-readable AIDC string in base64 encoding. Can correspond to the UDI pattern in devices.). This is the underlying object with id, value and extensions. The accessor "getCarrierAIDC" gives direct access to the value
548     */
549    public ItemInstance setCarrierAIDCElement(StringType value) { 
550      this.carrierAIDC = value;
551      return this;
552    }
553
554    /**
555     * @return The machine-readable AIDC string in base64 encoding. Can correspond to the UDI pattern in devices.
556     */
557    public String getCarrierAIDC() { 
558      return this.carrierAIDC == null ? null : this.carrierAIDC.getValue();
559    }
560
561    /**
562     * @param value The machine-readable AIDC string in base64 encoding. Can correspond to the UDI pattern in devices.
563     */
564    public ItemInstance setCarrierAIDC(String value) { 
565      if (Utilities.noString(value))
566        this.carrierAIDC = null;
567      else {
568        if (this.carrierAIDC == null)
569          this.carrierAIDC = new StringType();
570        this.carrierAIDC.setValue(value);
571      }
572      return this;
573    }
574
575    /**
576     * @return {@link #carrierHRF} (The human-readable barcode string. Can correspond to the UDI pattern in devices.). This is the underlying object with id, value and extensions. The accessor "getCarrierHRF" gives direct access to the value
577     */
578    public StringType getCarrierHRFElement() { 
579      if (this.carrierHRF == null)
580        if (Configuration.errorOnAutoCreate())
581          throw new Error("Attempt to auto-create ItemInstance.carrierHRF");
582        else if (Configuration.doAutoCreate())
583          this.carrierHRF = new StringType(); // bb
584      return this.carrierHRF;
585    }
586
587    public boolean hasCarrierHRFElement() { 
588      return this.carrierHRF != null && !this.carrierHRF.isEmpty();
589    }
590
591    public boolean hasCarrierHRF() { 
592      return this.carrierHRF != null && !this.carrierHRF.isEmpty();
593    }
594
595    /**
596     * @param value {@link #carrierHRF} (The human-readable barcode string. Can correspond to the UDI pattern in devices.). This is the underlying object with id, value and extensions. The accessor "getCarrierHRF" gives direct access to the value
597     */
598    public ItemInstance setCarrierHRFElement(StringType value) { 
599      this.carrierHRF = value;
600      return this;
601    }
602
603    /**
604     * @return The human-readable barcode string. Can correspond to the UDI pattern in devices.
605     */
606    public String getCarrierHRF() { 
607      return this.carrierHRF == null ? null : this.carrierHRF.getValue();
608    }
609
610    /**
611     * @param value The human-readable barcode string. Can correspond to the UDI pattern in devices.
612     */
613    public ItemInstance setCarrierHRF(String value) { 
614      if (Utilities.noString(value))
615        this.carrierHRF = null;
616      else {
617        if (this.carrierHRF == null)
618          this.carrierHRF = new StringType();
619        this.carrierHRF.setValue(value);
620      }
621      return this;
622    }
623
624      protected void listChildren(List<Property> children) {
625        super.listChildren(children);
626        children.add(new Property("count", "integer", "The quantity or amount of instances. For example if several units are being counted for inventory, this quantity can be more than one, provided they are not unique. Seriallized items are considered unique and as such would have a quantity max 1. This element is required and its presence asserts that the reource refers to a physical item.", 0, 1, count));
627        children.add(new Property("location", "Reference(Location)", "The location where the item is phisically located.", 0, 1, location));
628        children.add(new Property("subject", "Reference(Patient)", "The patient that the item is associated with (implanted in, given to).", 0, 1, subject));
629        children.add(new Property("manufactureDate", "dateTime", "The manufacture or preparation date and time. Times are necessary for several examples - for example biologically derived products, prepared or coumpounded medication, rapidly decaying isotopes.", 0, 1, manufactureDate));
630        children.add(new Property("expiryDate", "dateTime", "The expiry or preparation date and time.", 0, 1, expiryDate));
631        children.add(new Property("currentSWVersion", "string", "The Software version associated with the device, typically only used for devices with embedded software or firmware.", 0, 1, currentSWVersion));
632        children.add(new Property("lotNumber", "string", "The lot or batch number.", 0, 1, lotNumber));
633        children.add(new Property("serialNumber", "string", "The serial number if available.", 0, 1, serialNumber));
634        children.add(new Property("carrierAIDC", "string", "The machine-readable AIDC string in base64 encoding. Can correspond to the UDI pattern in devices.", 0, 1, carrierAIDC));
635        children.add(new Property("carrierHRF", "string", "The human-readable barcode string. Can correspond to the UDI pattern in devices.", 0, 1, carrierHRF));
636      }
637
638      @Override
639      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
640        switch (_hash) {
641        case 94851343: /*count*/  return new Property("count", "integer", "The quantity or amount of instances. For example if several units are being counted for inventory, this quantity can be more than one, provided they are not unique. Seriallized items are considered unique and as such would have a quantity max 1. This element is required and its presence asserts that the reource refers to a physical item.", 0, 1, count);
642        case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "The location where the item is phisically located.", 0, 1, location);
643        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient)", "The patient that the item is associated with (implanted in, given to).", 0, 1, subject);
644        case 416714767: /*manufactureDate*/  return new Property("manufactureDate", "dateTime", "The manufacture or preparation date and time. Times are necessary for several examples - for example biologically derived products, prepared or coumpounded medication, rapidly decaying isotopes.", 0, 1, manufactureDate);
645        case -816738431: /*expiryDate*/  return new Property("expiryDate", "dateTime", "The expiry or preparation date and time.", 0, 1, expiryDate);
646        case -1538044805: /*currentSWVersion*/  return new Property("currentSWVersion", "string", "The Software version associated with the device, typically only used for devices with embedded software or firmware.", 0, 1, currentSWVersion);
647        case 462547450: /*lotNumber*/  return new Property("lotNumber", "string", "The lot or batch number.", 0, 1, lotNumber);
648        case 83787357: /*serialNumber*/  return new Property("serialNumber", "string", "The serial number if available.", 0, 1, serialNumber);
649        case -768521825: /*carrierAIDC*/  return new Property("carrierAIDC", "string", "The machine-readable AIDC string in base64 encoding. Can correspond to the UDI pattern in devices.", 0, 1, carrierAIDC);
650        case 806499972: /*carrierHRF*/  return new Property("carrierHRF", "string", "The human-readable barcode string. Can correspond to the UDI pattern in devices.", 0, 1, carrierHRF);
651        default: return super.getNamedProperty(_hash, _name, _checkValid);
652        }
653
654      }
655
656      @Override
657      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
658        switch (hash) {
659        case 94851343: /*count*/ return this.count == null ? new Base[0] : new Base[] {this.count}; // IntegerType
660        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
661        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
662        case 416714767: /*manufactureDate*/ return this.manufactureDate == null ? new Base[0] : new Base[] {this.manufactureDate}; // DateTimeType
663        case -816738431: /*expiryDate*/ return this.expiryDate == null ? new Base[0] : new Base[] {this.expiryDate}; // DateTimeType
664        case -1538044805: /*currentSWVersion*/ return this.currentSWVersion == null ? new Base[0] : new Base[] {this.currentSWVersion}; // StringType
665        case 462547450: /*lotNumber*/ return this.lotNumber == null ? new Base[0] : new Base[] {this.lotNumber}; // StringType
666        case 83787357: /*serialNumber*/ return this.serialNumber == null ? new Base[0] : new Base[] {this.serialNumber}; // StringType
667        case -768521825: /*carrierAIDC*/ return this.carrierAIDC == null ? new Base[0] : new Base[] {this.carrierAIDC}; // StringType
668        case 806499972: /*carrierHRF*/ return this.carrierHRF == null ? new Base[0] : new Base[] {this.carrierHRF}; // StringType
669        default: return super.getProperty(hash, name, checkValid);
670        }
671
672      }
673
674      @Override
675      public Base setProperty(int hash, String name, Base value) throws FHIRException {
676        switch (hash) {
677        case 94851343: // count
678          this.count = castToInteger(value); // IntegerType
679          return value;
680        case 1901043637: // location
681          this.location = castToReference(value); // Reference
682          return value;
683        case -1867885268: // subject
684          this.subject = castToReference(value); // Reference
685          return value;
686        case 416714767: // manufactureDate
687          this.manufactureDate = castToDateTime(value); // DateTimeType
688          return value;
689        case -816738431: // expiryDate
690          this.expiryDate = castToDateTime(value); // DateTimeType
691          return value;
692        case -1538044805: // currentSWVersion
693          this.currentSWVersion = castToString(value); // StringType
694          return value;
695        case 462547450: // lotNumber
696          this.lotNumber = castToString(value); // StringType
697          return value;
698        case 83787357: // serialNumber
699          this.serialNumber = castToString(value); // StringType
700          return value;
701        case -768521825: // carrierAIDC
702          this.carrierAIDC = castToString(value); // StringType
703          return value;
704        case 806499972: // carrierHRF
705          this.carrierHRF = castToString(value); // StringType
706          return value;
707        default: return super.setProperty(hash, name, value);
708        }
709
710      }
711
712      @Override
713      public Base setProperty(String name, Base value) throws FHIRException {
714        if (name.equals("count")) {
715          this.count = castToInteger(value); // IntegerType
716        } else if (name.equals("location")) {
717          this.location = castToReference(value); // Reference
718        } else if (name.equals("subject")) {
719          this.subject = castToReference(value); // Reference
720        } else if (name.equals("manufactureDate")) {
721          this.manufactureDate = castToDateTime(value); // DateTimeType
722        } else if (name.equals("expiryDate")) {
723          this.expiryDate = castToDateTime(value); // DateTimeType
724        } else if (name.equals("currentSWVersion")) {
725          this.currentSWVersion = castToString(value); // StringType
726        } else if (name.equals("lotNumber")) {
727          this.lotNumber = castToString(value); // StringType
728        } else if (name.equals("serialNumber")) {
729          this.serialNumber = castToString(value); // StringType
730        } else if (name.equals("carrierAIDC")) {
731          this.carrierAIDC = castToString(value); // StringType
732        } else if (name.equals("carrierHRF")) {
733          this.carrierHRF = castToString(value); // StringType
734        } else
735          return super.setProperty(name, value);
736        return value;
737      }
738
739      @Override
740      public Base makeProperty(int hash, String name) throws FHIRException {
741        switch (hash) {
742        case 94851343:  return getCountElement();
743        case 1901043637:  return getLocation(); 
744        case -1867885268:  return getSubject(); 
745        case 416714767:  return getManufactureDateElement();
746        case -816738431:  return getExpiryDateElement();
747        case -1538044805:  return getCurrentSWVersionElement();
748        case 462547450:  return getLotNumberElement();
749        case 83787357:  return getSerialNumberElement();
750        case -768521825:  return getCarrierAIDCElement();
751        case 806499972:  return getCarrierHRFElement();
752        default: return super.makeProperty(hash, name);
753        }
754
755      }
756
757      @Override
758      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
759        switch (hash) {
760        case 94851343: /*count*/ return new String[] {"integer"};
761        case 1901043637: /*location*/ return new String[] {"Reference"};
762        case -1867885268: /*subject*/ return new String[] {"Reference"};
763        case 416714767: /*manufactureDate*/ return new String[] {"dateTime"};
764        case -816738431: /*expiryDate*/ return new String[] {"dateTime"};
765        case -1538044805: /*currentSWVersion*/ return new String[] {"string"};
766        case 462547450: /*lotNumber*/ return new String[] {"string"};
767        case 83787357: /*serialNumber*/ return new String[] {"string"};
768        case -768521825: /*carrierAIDC*/ return new String[] {"string"};
769        case 806499972: /*carrierHRF*/ return new String[] {"string"};
770        default: return super.getTypesForProperty(hash, name);
771        }
772
773      }
774
775      @Override
776      public Base addChild(String name) throws FHIRException {
777        if (name.equals("count")) {
778          throw new FHIRException("Cannot call addChild on a primitive type ItemInstance.count");
779        }
780        else if (name.equals("location")) {
781          this.location = new Reference();
782          return this.location;
783        }
784        else if (name.equals("subject")) {
785          this.subject = new Reference();
786          return this.subject;
787        }
788        else if (name.equals("manufactureDate")) {
789          throw new FHIRException("Cannot call addChild on a primitive type ItemInstance.manufactureDate");
790        }
791        else if (name.equals("expiryDate")) {
792          throw new FHIRException("Cannot call addChild on a primitive type ItemInstance.expiryDate");
793        }
794        else if (name.equals("currentSWVersion")) {
795          throw new FHIRException("Cannot call addChild on a primitive type ItemInstance.currentSWVersion");
796        }
797        else if (name.equals("lotNumber")) {
798          throw new FHIRException("Cannot call addChild on a primitive type ItemInstance.lotNumber");
799        }
800        else if (name.equals("serialNumber")) {
801          throw new FHIRException("Cannot call addChild on a primitive type ItemInstance.serialNumber");
802        }
803        else if (name.equals("carrierAIDC")) {
804          throw new FHIRException("Cannot call addChild on a primitive type ItemInstance.carrierAIDC");
805        }
806        else if (name.equals("carrierHRF")) {
807          throw new FHIRException("Cannot call addChild on a primitive type ItemInstance.carrierHRF");
808        }
809        else
810          return super.addChild(name);
811      }
812
813  public String fhirType() {
814    return "ItemInstance";
815
816  }
817
818      public ItemInstance copy() {
819        ItemInstance dst = new ItemInstance();
820        copyValues(dst);
821        dst.count = count == null ? null : count.copy();
822        dst.location = location == null ? null : location.copy();
823        dst.subject = subject == null ? null : subject.copy();
824        dst.manufactureDate = manufactureDate == null ? null : manufactureDate.copy();
825        dst.expiryDate = expiryDate == null ? null : expiryDate.copy();
826        dst.currentSWVersion = currentSWVersion == null ? null : currentSWVersion.copy();
827        dst.lotNumber = lotNumber == null ? null : lotNumber.copy();
828        dst.serialNumber = serialNumber == null ? null : serialNumber.copy();
829        dst.carrierAIDC = carrierAIDC == null ? null : carrierAIDC.copy();
830        dst.carrierHRF = carrierHRF == null ? null : carrierHRF.copy();
831        return dst;
832      }
833
834      protected ItemInstance typedCopy() {
835        return copy();
836      }
837
838      @Override
839      public boolean equalsDeep(Base other_) {
840        if (!super.equalsDeep(other_))
841          return false;
842        if (!(other_ instanceof ItemInstance))
843          return false;
844        ItemInstance o = (ItemInstance) other_;
845        return compareDeep(count, o.count, true) && compareDeep(location, o.location, true) && compareDeep(subject, o.subject, true)
846           && compareDeep(manufactureDate, o.manufactureDate, true) && compareDeep(expiryDate, o.expiryDate, true)
847           && compareDeep(currentSWVersion, o.currentSWVersion, true) && compareDeep(lotNumber, o.lotNumber, true)
848           && compareDeep(serialNumber, o.serialNumber, true) && compareDeep(carrierAIDC, o.carrierAIDC, true)
849           && compareDeep(carrierHRF, o.carrierHRF, true);
850      }
851
852      @Override
853      public boolean equalsShallow(Base other_) {
854        if (!super.equalsShallow(other_))
855          return false;
856        if (!(other_ instanceof ItemInstance))
857          return false;
858        ItemInstance o = (ItemInstance) other_;
859        return compareValues(count, o.count, true) && compareValues(manufactureDate, o.manufactureDate, true)
860           && compareValues(expiryDate, o.expiryDate, true) && compareValues(currentSWVersion, o.currentSWVersion, true)
861           && compareValues(lotNumber, o.lotNumber, true) && compareValues(serialNumber, o.serialNumber, true)
862           && compareValues(carrierAIDC, o.carrierAIDC, true) && compareValues(carrierHRF, o.carrierHRF, true)
863          ;
864      }
865
866      public boolean isEmpty() {
867        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(count, location, subject
868          , manufactureDate, expiryDate, currentSWVersion, lotNumber, serialNumber, carrierAIDC
869          , carrierHRF);
870      }
871
872  @Override
873  public ResourceType getResourceType() {
874    return ResourceType.ItemInstance;
875   }
876
877 /**
878   * Search parameter: <b>subject</b>
879   * <p>
880   * Description: <b>The identifier of the patient who has devices assigned to</b><br>
881   * Type: <b>reference</b><br>
882   * Path: <b>ItemInstance.subject</b><br>
883   * </p>
884   */
885  @SearchParamDefinition(name="subject", path="ItemInstance.subject", description="The identifier of the patient who has devices assigned to", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
886  public static final String SP_SUBJECT = "subject";
887 /**
888   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
889   * <p>
890   * Description: <b>The identifier of the patient who has devices assigned to</b><br>
891   * Type: <b>reference</b><br>
892   * Path: <b>ItemInstance.subject</b><br>
893   * </p>
894   */
895  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
896
897/**
898   * Constant for fluent queries to be used to add include statements. Specifies
899   * the path value of "<b>ItemInstance:subject</b>".
900   */
901  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("ItemInstance:subject").toLocked();
902
903
904}
905