001/*
002 * This class is an auto-generated source file for a HAPI
003 * HL7 v2.x standard structure class.
004 *
005 * For more information, visit: http://hl7api.sourceforge.net/
006 * 
007 * The contents of this file are subject to the Mozilla Public License Version 1.1 
008 * (the "License"); you may not use this file except in compliance with the License. 
009 * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
010 * Software distributed under the License is distributed on an "AS IS" basis, 
011 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
012 * specific language governing rights and limitations under the License. 
013 * 
014 * The Original Code is "[file_name]".  Description: 
015 * "[one_line_description]" 
016 * 
017 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
018 * 2012.  All Rights Reserved. 
019 * 
020 * Contributor(s): ______________________________________. 
021 * 
022 * Alternatively, the contents of this file may be used under the terms of the 
023 * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
024 * applicable instead of those above.  If you wish to allow use of your version of this 
025 * file only under the terms of the GPL and not to allow others to use your version 
026 * of this file under the MPL, indicate your decision by deleting  the provisions above 
027 * and replace  them with the notice and other provisions required by the GPL License.  
028 * If you do not delete the provisions above, a recipient may use your version of 
029 * this file under either the MPL or the GPL. 
030 * 
031 */
032
033
034package ca.uhn.hl7v2.model.v24.segment;
035
036// import ca.uhn.hl7v2.model.v24.group.*;
037import ca.uhn.hl7v2.model.v24.datatype.*;
038import ca.uhn.hl7v2.HL7Exception;
039import ca.uhn.hl7v2.parser.ModelClassFactory;
040import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
041import ca.uhn.hl7v2.model.AbstractMessage;
042import ca.uhn.hl7v2.model.Group;
043import ca.uhn.hl7v2.model.Type;
044import ca.uhn.hl7v2.model.AbstractSegment;
045import ca.uhn.hl7v2.model.Varies;
046
047
048/**
049 *<p>Represents an HL7 INV message segment (Inventory Detail). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>INV-1: Substance Identifier (CE) <b> </b>
053     * <li>INV-2: Substance Status (CE) <b> repeating</b>
054     * <li>INV-3: Substance Type (CE) <b>optional </b>
055     * <li>INV-4: Inventory Container Identifier (CE) <b>optional </b>
056     * <li>INV-5: Container Carrier Identifier (CE) <b>optional </b>
057     * <li>INV-6: Position on Carrier (CE) <b>optional </b>
058     * <li>INV-7: Initial Quantity (NM) <b>optional </b>
059     * <li>INV-8: Current Quantity (NM) <b>optional </b>
060     * <li>INV-9: Available Quantity (NM) <b>optional </b>
061     * <li>INV-10: Consumption Quantity (NM) <b>optional </b>
062     * <li>INV-11: Quantity Units (CE) <b>optional </b>
063     * <li>INV-12: Expiration Date/Time (TS) <b>optional </b>
064     * <li>INV-13: First Used Date/Time (TS) <b>optional </b>
065     * <li>INV-14: On Board Stability Duration (TQ) <b>optional </b>
066     * <li>INV-15: Test/Fluid Identifier(s) (CE) <b>optional repeating</b>
067     * <li>INV-16: Manufacturer Lot Number (ST) <b>optional </b>
068     * <li>INV-17: Manufacturer Identifier (CE) <b>optional </b>
069     * <li>INV-18: Supplier Identifier (CE) <b>optional </b>
070 * </ul>
071 */
072@SuppressWarnings("unused")
073public class INV extends AbstractSegment {
074
075    /** 
076     * Creates a new INV segment
077     */
078    public INV(Group parent, ModelClassFactory factory) {
079       super(parent, factory);
080       init(factory);
081    }
082
083    private void init(ModelClassFactory factory) {
084       try {
085                                  this.add(CE.class, true, 1, 250, new Object[]{ getMessage() }, "Substance Identifier");
086                                  this.add(CE.class, true, 0, 250, new Object[]{ getMessage() }, "Substance Status");
087                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Substance Type");
088                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Inventory Container Identifier");
089                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Container Carrier Identifier");
090                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Position on Carrier");
091                                  this.add(NM.class, false, 1, 20, new Object[]{ getMessage() }, "Initial Quantity");
092                                  this.add(NM.class, false, 1, 20, new Object[]{ getMessage() }, "Current Quantity");
093                                  this.add(NM.class, false, 1, 20, new Object[]{ getMessage() }, "Available Quantity");
094                                  this.add(NM.class, false, 1, 20, new Object[]{ getMessage() }, "Consumption Quantity");
095                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Quantity Units");
096                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Expiration Date/Time");
097                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "First Used Date/Time");
098                                  this.add(TQ.class, false, 1, 200, new Object[]{ getMessage() }, "On Board Stability Duration");
099                                  this.add(CE.class, false, 0, 250, new Object[]{ getMessage() }, "Test/Fluid Identifier(s)");
100                                  this.add(ST.class, false, 1, 200, new Object[]{ getMessage() }, "Manufacturer Lot Number");
101                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Manufacturer Identifier");
102                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Supplier Identifier");
103       } catch(HL7Exception e) {
104          log.error("Unexpected error creating INV - this is probably a bug in the source code generator.", e);
105       }
106    }
107
108
109
110    /**
111     * Returns
112     * INV-1: "Substance Identifier" - creates it if necessary
113     */
114    public CE getSubstanceIdentifier() { 
115                CE retVal = this.getTypedField(1, 0);
116                return retVal;
117    }
118    
119    /**
120     * Returns
121     * INV-1: "Substance Identifier" - creates it if necessary
122     */
123    public CE getInv1_SubstanceIdentifier() { 
124                CE retVal = this.getTypedField(1, 0);
125                return retVal;
126    }
127
128
129    /**
130     * Returns all repetitions of Substance Status (INV-2).
131     */
132    public CE[] getSubstanceStatus() {
133        CE[] retVal = this.getTypedField(2, new CE[0]);
134        return retVal;
135    }
136
137
138    /**
139     * Returns all repetitions of Substance Status (INV-2).
140     */
141    public CE[] getInv2_SubstanceStatus() {
142        CE[] retVal = this.getTypedField(2, new CE[0]);
143        return retVal;
144    }
145
146
147    /**
148     * Returns a count of the current number of repetitions of Substance Status (INV-2).
149     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
150     * it will return zero.
151     */
152    public int getSubstanceStatusReps() {
153        return this.getReps(2);
154    }
155
156
157    /**
158     * Returns a specific repetition of
159     * INV-2: "Substance Status" - creates it if necessary
160     *
161     * @param rep The repetition index (0-indexed)
162     */
163    public CE getSubstanceStatus(int rep) { 
164                CE retVal = this.getTypedField(2, rep);
165                return retVal;
166    }
167
168    /**
169     * Returns a specific repetition of
170     * INV-2: "Substance Status" - creates it if necessary
171     *
172     * @param rep The repetition index (0-indexed)
173     */
174    public CE getInv2_SubstanceStatus(int rep) { 
175                CE retVal = this.getTypedField(2, rep);
176                return retVal;
177    }
178
179    /**
180     * Returns a count of the current number of repetitions of Substance Status (INV-2).
181     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
182     * it will return zero.
183     */
184    public int getInv2_SubstanceStatusReps() {
185        return this.getReps(2);
186    }
187
188
189    /**
190     * Inserts a repetition of
191     * INV-2: "Substance Status" at a specific index
192     *
193     * @param rep The repetition index (0-indexed)
194     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
195     */
196    public CE insertSubstanceStatus(int rep) throws HL7Exception { 
197        return (CE) super.insertRepetition(2, rep);
198    }
199
200
201    /**
202     * Inserts a repetition of
203     * INV-2: "Substance Status" at a specific index
204     *
205     * @param rep The repetition index (0-indexed)
206     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
207     */
208    public CE insertInv2_SubstanceStatus(int rep) throws HL7Exception { 
209        return (CE) super.insertRepetition(2, rep);
210    }
211
212
213    /**
214     * Removes a repetition of
215     * INV-2: "Substance Status" at a specific index
216     *
217     * @param rep The repetition index (0-indexed)
218     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
219     */
220    public CE removeSubstanceStatus(int rep) throws HL7Exception { 
221        return (CE) super.removeRepetition(2, rep);
222    }
223
224
225    /**
226     * Removes a repetition of
227     * INV-2: "Substance Status" at a specific index
228     *
229     * @param rep The repetition index (0-indexed)
230     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
231     */
232    public CE removeInv2_SubstanceStatus(int rep) throws HL7Exception { 
233        return (CE) super.removeRepetition(2, rep);
234    }
235
236
237
238
239    /**
240     * Returns
241     * INV-3: "Substance Type" - creates it if necessary
242     */
243    public CE getSubstanceType() { 
244                CE retVal = this.getTypedField(3, 0);
245                return retVal;
246    }
247    
248    /**
249     * Returns
250     * INV-3: "Substance Type" - creates it if necessary
251     */
252    public CE getInv3_SubstanceType() { 
253                CE retVal = this.getTypedField(3, 0);
254                return retVal;
255    }
256
257
258
259    /**
260     * Returns
261     * INV-4: "Inventory Container Identifier" - creates it if necessary
262     */
263    public CE getInventoryContainerIdentifier() { 
264                CE retVal = this.getTypedField(4, 0);
265                return retVal;
266    }
267    
268    /**
269     * Returns
270     * INV-4: "Inventory Container Identifier" - creates it if necessary
271     */
272    public CE getInv4_InventoryContainerIdentifier() { 
273                CE retVal = this.getTypedField(4, 0);
274                return retVal;
275    }
276
277
278
279    /**
280     * Returns
281     * INV-5: "Container Carrier Identifier" - creates it if necessary
282     */
283    public CE getContainerCarrierIdentifier() { 
284                CE retVal = this.getTypedField(5, 0);
285                return retVal;
286    }
287    
288    /**
289     * Returns
290     * INV-5: "Container Carrier Identifier" - creates it if necessary
291     */
292    public CE getInv5_ContainerCarrierIdentifier() { 
293                CE retVal = this.getTypedField(5, 0);
294                return retVal;
295    }
296
297
298
299    /**
300     * Returns
301     * INV-6: "Position on Carrier" - creates it if necessary
302     */
303    public CE getPositionOnCarrier() { 
304                CE retVal = this.getTypedField(6, 0);
305                return retVal;
306    }
307    
308    /**
309     * Returns
310     * INV-6: "Position on Carrier" - creates it if necessary
311     */
312    public CE getInv6_PositionOnCarrier() { 
313                CE retVal = this.getTypedField(6, 0);
314                return retVal;
315    }
316
317
318
319    /**
320     * Returns
321     * INV-7: "Initial Quantity" - creates it if necessary
322     */
323    public NM getInitialQuantity() { 
324                NM retVal = this.getTypedField(7, 0);
325                return retVal;
326    }
327    
328    /**
329     * Returns
330     * INV-7: "Initial Quantity" - creates it if necessary
331     */
332    public NM getInv7_InitialQuantity() { 
333                NM retVal = this.getTypedField(7, 0);
334                return retVal;
335    }
336
337
338
339    /**
340     * Returns
341     * INV-8: "Current Quantity" - creates it if necessary
342     */
343    public NM getCurrentQuantity() { 
344                NM retVal = this.getTypedField(8, 0);
345                return retVal;
346    }
347    
348    /**
349     * Returns
350     * INV-8: "Current Quantity" - creates it if necessary
351     */
352    public NM getInv8_CurrentQuantity() { 
353                NM retVal = this.getTypedField(8, 0);
354                return retVal;
355    }
356
357
358
359    /**
360     * Returns
361     * INV-9: "Available Quantity" - creates it if necessary
362     */
363    public NM getAvailableQuantity() { 
364                NM retVal = this.getTypedField(9, 0);
365                return retVal;
366    }
367    
368    /**
369     * Returns
370     * INV-9: "Available Quantity" - creates it if necessary
371     */
372    public NM getInv9_AvailableQuantity() { 
373                NM retVal = this.getTypedField(9, 0);
374                return retVal;
375    }
376
377
378
379    /**
380     * Returns
381     * INV-10: "Consumption Quantity" - creates it if necessary
382     */
383    public NM getConsumptionQuantity() { 
384                NM retVal = this.getTypedField(10, 0);
385                return retVal;
386    }
387    
388    /**
389     * Returns
390     * INV-10: "Consumption Quantity" - creates it if necessary
391     */
392    public NM getInv10_ConsumptionQuantity() { 
393                NM retVal = this.getTypedField(10, 0);
394                return retVal;
395    }
396
397
398
399    /**
400     * Returns
401     * INV-11: "Quantity Units" - creates it if necessary
402     */
403    public CE getQuantityUnits() { 
404                CE retVal = this.getTypedField(11, 0);
405                return retVal;
406    }
407    
408    /**
409     * Returns
410     * INV-11: "Quantity Units" - creates it if necessary
411     */
412    public CE getInv11_QuantityUnits() { 
413                CE retVal = this.getTypedField(11, 0);
414                return retVal;
415    }
416
417
418
419    /**
420     * Returns
421     * INV-12: "Expiration Date/Time" - creates it if necessary
422     */
423    public TS getExpirationDateTime() { 
424                TS retVal = this.getTypedField(12, 0);
425                return retVal;
426    }
427    
428    /**
429     * Returns
430     * INV-12: "Expiration Date/Time" - creates it if necessary
431     */
432    public TS getInv12_ExpirationDateTime() { 
433                TS retVal = this.getTypedField(12, 0);
434                return retVal;
435    }
436
437
438
439    /**
440     * Returns
441     * INV-13: "First Used Date/Time" - creates it if necessary
442     */
443    public TS getFirstUsedDateTime() { 
444                TS retVal = this.getTypedField(13, 0);
445                return retVal;
446    }
447    
448    /**
449     * Returns
450     * INV-13: "First Used Date/Time" - creates it if necessary
451     */
452    public TS getInv13_FirstUsedDateTime() { 
453                TS retVal = this.getTypedField(13, 0);
454                return retVal;
455    }
456
457
458
459    /**
460     * Returns
461     * INV-14: "On Board Stability Duration" - creates it if necessary
462     */
463    public TQ getOnBoardStabilityDuration() { 
464                TQ retVal = this.getTypedField(14, 0);
465                return retVal;
466    }
467    
468    /**
469     * Returns
470     * INV-14: "On Board Stability Duration" - creates it if necessary
471     */
472    public TQ getInv14_OnBoardStabilityDuration() { 
473                TQ retVal = this.getTypedField(14, 0);
474                return retVal;
475    }
476
477
478    /**
479     * Returns all repetitions of Test/Fluid Identifier(s) (INV-15).
480     */
481    public CE[] getTestFluidIdentifierS() {
482        CE[] retVal = this.getTypedField(15, new CE[0]);
483        return retVal;
484    }
485
486
487    /**
488     * Returns all repetitions of Test/Fluid Identifier(s) (INV-15).
489     */
490    public CE[] getInv15_TestFluidIdentifierS() {
491        CE[] retVal = this.getTypedField(15, new CE[0]);
492        return retVal;
493    }
494
495
496    /**
497     * Returns a count of the current number of repetitions of Test/Fluid Identifier(s) (INV-15).
498     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
499     * it will return zero.
500     */
501    public int getTestFluidIdentifierSReps() {
502        return this.getReps(15);
503    }
504
505
506    /**
507     * Returns a specific repetition of
508     * INV-15: "Test/Fluid Identifier(s)" - creates it if necessary
509     *
510     * @param rep The repetition index (0-indexed)
511     */
512    public CE getTestFluidIdentifierS(int rep) { 
513                CE retVal = this.getTypedField(15, rep);
514                return retVal;
515    }
516
517    /**
518     * Returns a specific repetition of
519     * INV-15: "Test/Fluid Identifier(s)" - creates it if necessary
520     *
521     * @param rep The repetition index (0-indexed)
522     */
523    public CE getInv15_TestFluidIdentifierS(int rep) { 
524                CE retVal = this.getTypedField(15, rep);
525                return retVal;
526    }
527
528    /**
529     * Returns a count of the current number of repetitions of Test/Fluid Identifier(s) (INV-15).
530     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
531     * it will return zero.
532     */
533    public int getInv15_TestFluidIdentifierSReps() {
534        return this.getReps(15);
535    }
536
537
538    /**
539     * Inserts a repetition of
540     * INV-15: "Test/Fluid Identifier(s)" at a specific index
541     *
542     * @param rep The repetition index (0-indexed)
543     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
544     */
545    public CE insertTestFluidIdentifierS(int rep) throws HL7Exception { 
546        return (CE) super.insertRepetition(15, rep);
547    }
548
549
550    /**
551     * Inserts a repetition of
552     * INV-15: "Test/Fluid Identifier(s)" at a specific index
553     *
554     * @param rep The repetition index (0-indexed)
555     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
556     */
557    public CE insertInv15_TestFluidIdentifierS(int rep) throws HL7Exception { 
558        return (CE) super.insertRepetition(15, rep);
559    }
560
561
562    /**
563     * Removes a repetition of
564     * INV-15: "Test/Fluid Identifier(s)" at a specific index
565     *
566     * @param rep The repetition index (0-indexed)
567     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
568     */
569    public CE removeTestFluidIdentifierS(int rep) throws HL7Exception { 
570        return (CE) super.removeRepetition(15, rep);
571    }
572
573
574    /**
575     * Removes a repetition of
576     * INV-15: "Test/Fluid Identifier(s)" at a specific index
577     *
578     * @param rep The repetition index (0-indexed)
579     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
580     */
581    public CE removeInv15_TestFluidIdentifierS(int rep) throws HL7Exception { 
582        return (CE) super.removeRepetition(15, rep);
583    }
584
585
586
587
588    /**
589     * Returns
590     * INV-16: "Manufacturer Lot Number" - creates it if necessary
591     */
592    public ST getManufacturerLotNumber() { 
593                ST retVal = this.getTypedField(16, 0);
594                return retVal;
595    }
596    
597    /**
598     * Returns
599     * INV-16: "Manufacturer Lot Number" - creates it if necessary
600     */
601    public ST getInv16_ManufacturerLotNumber() { 
602                ST retVal = this.getTypedField(16, 0);
603                return retVal;
604    }
605
606
607
608    /**
609     * Returns
610     * INV-17: "Manufacturer Identifier" - creates it if necessary
611     */
612    public CE getManufacturerIdentifier() { 
613                CE retVal = this.getTypedField(17, 0);
614                return retVal;
615    }
616    
617    /**
618     * Returns
619     * INV-17: "Manufacturer Identifier" - creates it if necessary
620     */
621    public CE getInv17_ManufacturerIdentifier() { 
622                CE retVal = this.getTypedField(17, 0);
623                return retVal;
624    }
625
626
627
628    /**
629     * Returns
630     * INV-18: "Supplier Identifier" - creates it if necessary
631     */
632    public CE getSupplierIdentifier() { 
633                CE retVal = this.getTypedField(18, 0);
634                return retVal;
635    }
636    
637    /**
638     * Returns
639     * INV-18: "Supplier Identifier" - creates it if necessary
640     */
641    public CE getInv18_SupplierIdentifier() { 
642                CE retVal = this.getTypedField(18, 0);
643                return retVal;
644    }
645
646
647
648
649
650    /** {@inheritDoc} */   
651    protected Type createNewTypeWithoutReflection(int field) {
652       switch (field) {
653          case 0: return new CE(getMessage());
654          case 1: return new CE(getMessage());
655          case 2: return new CE(getMessage());
656          case 3: return new CE(getMessage());
657          case 4: return new CE(getMessage());
658          case 5: return new CE(getMessage());
659          case 6: return new NM(getMessage());
660          case 7: return new NM(getMessage());
661          case 8: return new NM(getMessage());
662          case 9: return new NM(getMessage());
663          case 10: return new CE(getMessage());
664          case 11: return new TS(getMessage());
665          case 12: return new TS(getMessage());
666          case 13: return new TQ(getMessage());
667          case 14: return new CE(getMessage());
668          case 15: return new ST(getMessage());
669          case 16: return new CE(getMessage());
670          case 17: return new CE(getMessage());
671          default: return null;
672       }
673   }
674
675
676}
677