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 BPX message segment (Blood product dispense status). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>BPX-1: Set ID - BPX (SI) <b> </b>
052     * <li>BPX-2: BP Dispense Status (CWE) <b> </b>
053     * <li>BPX-3: BP Status (ID) <b> </b>
054     * <li>BPX-4: BP Date/Time of Status (TS) <b> </b>
055     * <li>BPX-5: BC Donation ID (EI) <b>optional </b>
056     * <li>BPX-6: BC Component (CNE) <b>optional </b>
057     * <li>BPX-7: BC Donation Type / Intended Use (CNE) <b>optional </b>
058     * <li>BPX-8: CP Commercial Product (CWE) <b>optional </b>
059     * <li>BPX-9: CP Manufacturer (XON) <b>optional </b>
060     * <li>BPX-10: CP Lot Number (EI) <b>optional </b>
061     * <li>BPX-11: BP Blood Group (CNE) <b>optional </b>
062     * <li>BPX-12: BC Special Testing (CNE) <b>optional repeating</b>
063     * <li>BPX-13: BP Expiration Date/Time (TS) <b>optional </b>
064     * <li>BPX-14: BP Quantity (NM) <b> </b>
065     * <li>BPX-15: BP Amount (NM) <b>optional </b>
066     * <li>BPX-16: BP Units (CE) <b>optional </b>
067     * <li>BPX-17: BP Unique ID (EI) <b>optional </b>
068     * <li>BPX-18: BP Actual Dispensed To Location (PL) <b>optional </b>
069     * <li>BPX-19: BP Actual Dispensed To Address (XAD) <b>optional </b>
070     * <li>BPX-20: BP Dispensed to Receiver (XCN) <b>optional </b>
071     * <li>BPX-21: BP Dispensing Individual (XCN) <b>optional </b>
072 * </ul>
073 */
074@SuppressWarnings("unused")
075public class BPX extends AbstractSegment {
076
077    /** 
078     * Creates a new BPX segment
079     */
080    public BPX(Group parent, ModelClassFactory factory) {
081       super(parent, factory);
082       init(factory);
083    }
084
085    private void init(ModelClassFactory factory) {
086       try {
087                                  this.add(SI.class, true, 1, 4, new Object[]{ getMessage() }, "Set ID - BPX");
088                                  this.add(CWE.class, true, 1, 250, new Object[]{ getMessage() }, "BP Dispense Status");
089                                              this.add(ID.class, true, 1, 1, new Object[]{ getMessage(), new Integer(511) }, "BP Status");
090                                  this.add(TS.class, true, 1, 26, new Object[]{ getMessage() }, "BP Date/Time of Status");
091                                  this.add(EI.class, false, 1, 22, new Object[]{ getMessage() }, "BC Donation ID");
092                                  this.add(CNE.class, false, 1, 250, new Object[]{ getMessage() }, "BC Component");
093                                  this.add(CNE.class, false, 1, 250, new Object[]{ getMessage() }, "BC Donation Type / Intended Use");
094                                  this.add(CWE.class, false, 1, 250, new Object[]{ getMessage() }, "CP Commercial Product");
095                                  this.add(XON.class, false, 1, 250, new Object[]{ getMessage() }, "CP Manufacturer");
096                                  this.add(EI.class, false, 1, 22, new Object[]{ getMessage() }, "CP Lot Number");
097                                  this.add(CNE.class, false, 1, 250, new Object[]{ getMessage() }, "BP Blood Group");
098                                  this.add(CNE.class, false, 0, 250, new Object[]{ getMessage() }, "BC Special Testing");
099                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "BP Expiration Date/Time");
100                                  this.add(NM.class, true, 1, 5, new Object[]{ getMessage() }, "BP Quantity");
101                                  this.add(NM.class, false, 1, 5, new Object[]{ getMessage() }, "BP Amount");
102                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "BP Units");
103                                  this.add(EI.class, false, 1, 22, new Object[]{ getMessage() }, "BP Unique ID");
104                                  this.add(PL.class, false, 1, 80, new Object[]{ getMessage() }, "BP Actual Dispensed To Location");
105                                  this.add(XAD.class, false, 1, 250, new Object[]{ getMessage() }, "BP Actual Dispensed To Address");
106                                  this.add(XCN.class, false, 1, 250, new Object[]{ getMessage() }, "BP Dispensed to Receiver");
107                                  this.add(XCN.class, false, 1, 250, new Object[]{ getMessage() }, "BP Dispensing Individual");
108       } catch(HL7Exception e) {
109          log.error("Unexpected error creating BPX - this is probably a bug in the source code generator.", e);
110       }
111    }
112
113
114
115    /**
116     * Returns
117     * BPX-1: "Set ID - BPX" - creates it if necessary
118     */
119    public SI getSetIDBPX() { 
120                SI retVal = this.getTypedField(1, 0);
121                return retVal;
122    }
123    
124    /**
125     * Returns
126     * BPX-1: "Set ID - BPX" - creates it if necessary
127     */
128    public SI getBpx1_SetIDBPX() { 
129                SI retVal = this.getTypedField(1, 0);
130                return retVal;
131    }
132
133
134
135    /**
136     * Returns
137     * BPX-2: "BP Dispense Status" - creates it if necessary
138     */
139    public CWE getBPDispenseStatus() { 
140                CWE retVal = this.getTypedField(2, 0);
141                return retVal;
142    }
143    
144    /**
145     * Returns
146     * BPX-2: "BP Dispense Status" - creates it if necessary
147     */
148    public CWE getBpx2_BPDispenseStatus() { 
149                CWE retVal = this.getTypedField(2, 0);
150                return retVal;
151    }
152
153
154
155    /**
156     * Returns
157     * BPX-3: "BP Status" - creates it if necessary
158     */
159    public ID getBPStatus() { 
160                ID retVal = this.getTypedField(3, 0);
161                return retVal;
162    }
163    
164    /**
165     * Returns
166     * BPX-3: "BP Status" - creates it if necessary
167     */
168    public ID getBpx3_BPStatus() { 
169                ID retVal = this.getTypedField(3, 0);
170                return retVal;
171    }
172
173
174
175    /**
176     * Returns
177     * BPX-4: "BP Date/Time of Status" - creates it if necessary
178     */
179    public TS getBPDateTimeOfStatus() { 
180                TS retVal = this.getTypedField(4, 0);
181                return retVal;
182    }
183    
184    /**
185     * Returns
186     * BPX-4: "BP Date/Time of Status" - creates it if necessary
187     */
188    public TS getBpx4_BPDateTimeOfStatus() { 
189                TS retVal = this.getTypedField(4, 0);
190                return retVal;
191    }
192
193
194
195    /**
196     * Returns
197     * BPX-5: "BC Donation ID" - creates it if necessary
198     */
199    public EI getBCDonationID() { 
200                EI retVal = this.getTypedField(5, 0);
201                return retVal;
202    }
203    
204    /**
205     * Returns
206     * BPX-5: "BC Donation ID" - creates it if necessary
207     */
208    public EI getBpx5_BCDonationID() { 
209                EI retVal = this.getTypedField(5, 0);
210                return retVal;
211    }
212
213
214
215    /**
216     * Returns
217     * BPX-6: "BC Component" - creates it if necessary
218     */
219    public CNE getBCComponent() { 
220                CNE retVal = this.getTypedField(6, 0);
221                return retVal;
222    }
223    
224    /**
225     * Returns
226     * BPX-6: "BC Component" - creates it if necessary
227     */
228    public CNE getBpx6_BCComponent() { 
229                CNE retVal = this.getTypedField(6, 0);
230                return retVal;
231    }
232
233
234
235    /**
236     * Returns
237     * BPX-7: "BC Donation Type / Intended Use" - creates it if necessary
238     */
239    public CNE getBCDonationTypeIntendedUse() { 
240                CNE retVal = this.getTypedField(7, 0);
241                return retVal;
242    }
243    
244    /**
245     * Returns
246     * BPX-7: "BC Donation Type / Intended Use" - creates it if necessary
247     */
248    public CNE getBpx7_BCDonationTypeIntendedUse() { 
249                CNE retVal = this.getTypedField(7, 0);
250                return retVal;
251    }
252
253
254
255    /**
256     * Returns
257     * BPX-8: "CP Commercial Product" - creates it if necessary
258     */
259    public CWE getCPCommercialProduct() { 
260                CWE retVal = this.getTypedField(8, 0);
261                return retVal;
262    }
263    
264    /**
265     * Returns
266     * BPX-8: "CP Commercial Product" - creates it if necessary
267     */
268    public CWE getBpx8_CPCommercialProduct() { 
269                CWE retVal = this.getTypedField(8, 0);
270                return retVal;
271    }
272
273
274
275    /**
276     * Returns
277     * BPX-9: "CP Manufacturer" - creates it if necessary
278     */
279    public XON getCPManufacturer() { 
280                XON retVal = this.getTypedField(9, 0);
281                return retVal;
282    }
283    
284    /**
285     * Returns
286     * BPX-9: "CP Manufacturer" - creates it if necessary
287     */
288    public XON getBpx9_CPManufacturer() { 
289                XON retVal = this.getTypedField(9, 0);
290                return retVal;
291    }
292
293
294
295    /**
296     * Returns
297     * BPX-10: "CP Lot Number" - creates it if necessary
298     */
299    public EI getCPLotNumber() { 
300                EI retVal = this.getTypedField(10, 0);
301                return retVal;
302    }
303    
304    /**
305     * Returns
306     * BPX-10: "CP Lot Number" - creates it if necessary
307     */
308    public EI getBpx10_CPLotNumber() { 
309                EI retVal = this.getTypedField(10, 0);
310                return retVal;
311    }
312
313
314
315    /**
316     * Returns
317     * BPX-11: "BP Blood Group" - creates it if necessary
318     */
319    public CNE getBPBloodGroup() { 
320                CNE retVal = this.getTypedField(11, 0);
321                return retVal;
322    }
323    
324    /**
325     * Returns
326     * BPX-11: "BP Blood Group" - creates it if necessary
327     */
328    public CNE getBpx11_BPBloodGroup() { 
329                CNE retVal = this.getTypedField(11, 0);
330                return retVal;
331    }
332
333
334    /**
335     * Returns all repetitions of BC Special Testing (BPX-12).
336     */
337    public CNE[] getBCSpecialTesting() {
338        CNE[] retVal = this.getTypedField(12, new CNE[0]);
339        return retVal;
340    }
341
342
343    /**
344     * Returns all repetitions of BC Special Testing (BPX-12).
345     */
346    public CNE[] getBpx12_BCSpecialTesting() {
347        CNE[] retVal = this.getTypedField(12, new CNE[0]);
348        return retVal;
349    }
350
351
352    /**
353     * Returns a count of the current number of repetitions of BC Special Testing (BPX-12).
354     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
355     * it will return zero.
356     */
357    public int getBCSpecialTestingReps() {
358        return this.getReps(12);
359    }
360
361
362    /**
363     * Returns a specific repetition of
364     * BPX-12: "BC Special Testing" - creates it if necessary
365     *
366     * @param rep The repetition index (0-indexed)
367     */
368    public CNE getBCSpecialTesting(int rep) { 
369                CNE retVal = this.getTypedField(12, rep);
370                return retVal;
371    }
372
373    /**
374     * Returns a specific repetition of
375     * BPX-12: "BC Special Testing" - creates it if necessary
376     *
377     * @param rep The repetition index (0-indexed)
378     */
379    public CNE getBpx12_BCSpecialTesting(int rep) { 
380                CNE retVal = this.getTypedField(12, rep);
381                return retVal;
382    }
383
384    /**
385     * Returns a count of the current number of repetitions of BC Special Testing (BPX-12).
386     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
387     * it will return zero.
388     */
389    public int getBpx12_BCSpecialTestingReps() {
390        return this.getReps(12);
391    }
392
393
394    /**
395     * Inserts a repetition of
396     * BPX-12: "BC Special Testing" at a specific index
397     *
398     * @param rep The repetition index (0-indexed)
399     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
400     */
401    public CNE insertBCSpecialTesting(int rep) throws HL7Exception { 
402        return (CNE) super.insertRepetition(12, rep);
403    }
404
405
406    /**
407     * Inserts a repetition of
408     * BPX-12: "BC Special Testing" at a specific index
409     *
410     * @param rep The repetition index (0-indexed)
411     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
412     */
413    public CNE insertBpx12_BCSpecialTesting(int rep) throws HL7Exception { 
414        return (CNE) super.insertRepetition(12, rep);
415    }
416
417
418    /**
419     * Removes a repetition of
420     * BPX-12: "BC Special Testing" at a specific index
421     *
422     * @param rep The repetition index (0-indexed)
423     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
424     */
425    public CNE removeBCSpecialTesting(int rep) throws HL7Exception { 
426        return (CNE) super.removeRepetition(12, rep);
427    }
428
429
430    /**
431     * Removes a repetition of
432     * BPX-12: "BC Special Testing" at a specific index
433     *
434     * @param rep The repetition index (0-indexed)
435     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
436     */
437    public CNE removeBpx12_BCSpecialTesting(int rep) throws HL7Exception { 
438        return (CNE) super.removeRepetition(12, rep);
439    }
440
441
442
443
444    /**
445     * Returns
446     * BPX-13: "BP Expiration Date/Time" - creates it if necessary
447     */
448    public TS getBPExpirationDateTime() { 
449                TS retVal = this.getTypedField(13, 0);
450                return retVal;
451    }
452    
453    /**
454     * Returns
455     * BPX-13: "BP Expiration Date/Time" - creates it if necessary
456     */
457    public TS getBpx13_BPExpirationDateTime() { 
458                TS retVal = this.getTypedField(13, 0);
459                return retVal;
460    }
461
462
463
464    /**
465     * Returns
466     * BPX-14: "BP Quantity" - creates it if necessary
467     */
468    public NM getBPQuantity() { 
469                NM retVal = this.getTypedField(14, 0);
470                return retVal;
471    }
472    
473    /**
474     * Returns
475     * BPX-14: "BP Quantity" - creates it if necessary
476     */
477    public NM getBpx14_BPQuantity() { 
478                NM retVal = this.getTypedField(14, 0);
479                return retVal;
480    }
481
482
483
484    /**
485     * Returns
486     * BPX-15: "BP Amount" - creates it if necessary
487     */
488    public NM getBPAmount() { 
489                NM retVal = this.getTypedField(15, 0);
490                return retVal;
491    }
492    
493    /**
494     * Returns
495     * BPX-15: "BP Amount" - creates it if necessary
496     */
497    public NM getBpx15_BPAmount() { 
498                NM retVal = this.getTypedField(15, 0);
499                return retVal;
500    }
501
502
503
504    /**
505     * Returns
506     * BPX-16: "BP Units" - creates it if necessary
507     */
508    public CE getBPUnits() { 
509                CE retVal = this.getTypedField(16, 0);
510                return retVal;
511    }
512    
513    /**
514     * Returns
515     * BPX-16: "BP Units" - creates it if necessary
516     */
517    public CE getBpx16_BPUnits() { 
518                CE retVal = this.getTypedField(16, 0);
519                return retVal;
520    }
521
522
523
524    /**
525     * Returns
526     * BPX-17: "BP Unique ID" - creates it if necessary
527     */
528    public EI getBPUniqueID() { 
529                EI retVal = this.getTypedField(17, 0);
530                return retVal;
531    }
532    
533    /**
534     * Returns
535     * BPX-17: "BP Unique ID" - creates it if necessary
536     */
537    public EI getBpx17_BPUniqueID() { 
538                EI retVal = this.getTypedField(17, 0);
539                return retVal;
540    }
541
542
543
544    /**
545     * Returns
546     * BPX-18: "BP Actual Dispensed To Location" - creates it if necessary
547     */
548    public PL getBPActualDispensedToLocation() { 
549                PL retVal = this.getTypedField(18, 0);
550                return retVal;
551    }
552    
553    /**
554     * Returns
555     * BPX-18: "BP Actual Dispensed To Location" - creates it if necessary
556     */
557    public PL getBpx18_BPActualDispensedToLocation() { 
558                PL retVal = this.getTypedField(18, 0);
559                return retVal;
560    }
561
562
563
564    /**
565     * Returns
566     * BPX-19: "BP Actual Dispensed To Address" - creates it if necessary
567     */
568    public XAD getBPActualDispensedToAddress() { 
569                XAD retVal = this.getTypedField(19, 0);
570                return retVal;
571    }
572    
573    /**
574     * Returns
575     * BPX-19: "BP Actual Dispensed To Address" - creates it if necessary
576     */
577    public XAD getBpx19_BPActualDispensedToAddress() { 
578                XAD retVal = this.getTypedField(19, 0);
579                return retVal;
580    }
581
582
583
584    /**
585     * Returns
586     * BPX-20: "BP Dispensed to Receiver" - creates it if necessary
587     */
588    public XCN getBPDispensedToReceiver() { 
589                XCN retVal = this.getTypedField(20, 0);
590                return retVal;
591    }
592    
593    /**
594     * Returns
595     * BPX-20: "BP Dispensed to Receiver" - creates it if necessary
596     */
597    public XCN getBpx20_BPDispensedToReceiver() { 
598                XCN retVal = this.getTypedField(20, 0);
599                return retVal;
600    }
601
602
603
604    /**
605     * Returns
606     * BPX-21: "BP Dispensing Individual" - creates it if necessary
607     */
608    public XCN getBPDispensingIndividual() { 
609                XCN retVal = this.getTypedField(21, 0);
610                return retVal;
611    }
612    
613    /**
614     * Returns
615     * BPX-21: "BP Dispensing Individual" - creates it if necessary
616     */
617    public XCN getBpx21_BPDispensingIndividual() { 
618                XCN retVal = this.getTypedField(21, 0);
619                return retVal;
620    }
621
622
623
624
625
626    /** {@inheritDoc} */   
627    protected Type createNewTypeWithoutReflection(int field) {
628       switch (field) {
629          case 0: return new SI(getMessage());
630          case 1: return new CWE(getMessage());
631          case 2: return new ID(getMessage(), new Integer( 511 ));
632          case 3: return new TS(getMessage());
633          case 4: return new EI(getMessage());
634          case 5: return new CNE(getMessage());
635          case 6: return new CNE(getMessage());
636          case 7: return new CWE(getMessage());
637          case 8: return new XON(getMessage());
638          case 9: return new EI(getMessage());
639          case 10: return new CNE(getMessage());
640          case 11: return new CNE(getMessage());
641          case 12: return new TS(getMessage());
642          case 13: return new NM(getMessage());
643          case 14: return new NM(getMessage());
644          case 15: return new CE(getMessage());
645          case 16: return new EI(getMessage());
646          case 17: return new PL(getMessage());
647          case 18: return new XAD(getMessage());
648          case 19: return new XCN(getMessage());
649          case 20: return new XCN(getMessage());
650          default: return null;
651       }
652   }
653
654
655}
656