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