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