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 BPO message segment (Blood product order). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>BPO-1: Set ID - BPO (SI) <b> </b>
052     * <li>BPO-2: BP Universal Service ID (CWE) <b> </b>
053     * <li>BPO-3: BP  Processing Requirements (CWE) <b>optional repeating</b>
054     * <li>BPO-4: BP Quantity (NM) <b> </b>
055     * <li>BPO-5: BP Amount (NM) <b>optional </b>
056     * <li>BPO-6: BP Units (CE) <b>optional </b>
057     * <li>BPO-7: BP Intended Use Date/Time (TS) <b>optional </b>
058     * <li>BPO-8: BP Intended Dispense From Location (PL) <b>optional </b>
059     * <li>BPO-9: BP Intended Dispense From Address (XAD) <b>optional </b>
060     * <li>BPO-10: BP Requested Dispense Date/Time (TS) <b>optional </b>
061     * <li>BPO-11: BP Requested Dispense To Location (PL) <b>optional </b>
062     * <li>BPO-12: BP Requested Dispense To Address (XAD) <b>optional </b>
063     * <li>BPO-13: BP Indication for Use (CWE) <b>optional repeating</b>
064     * <li>BPO-14: BP Informed Consent Indicator (ID) <b>optional </b>
065 * </ul>
066 */
067@SuppressWarnings("unused")
068public class BPO extends AbstractSegment {
069
070    /** 
071     * Creates a new BPO segment
072     */
073    public BPO(Group parent, ModelClassFactory factory) {
074       super(parent, factory);
075       init(factory);
076    }
077
078    private void init(ModelClassFactory factory) {
079       try {
080                                  this.add(SI.class, true, 1, 4, new Object[]{ getMessage() }, "Set ID - BPO");
081                                  this.add(CWE.class, true, 1, 250, new Object[]{ getMessage() }, "BP Universal Service ID");
082                                  this.add(CWE.class, false, 0, 250, new Object[]{ getMessage() }, "BP  Processing Requirements");
083                                  this.add(NM.class, true, 1, 5, new Object[]{ getMessage() }, "BP Quantity");
084                                  this.add(NM.class, false, 1, 5, new Object[]{ getMessage() }, "BP Amount");
085                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "BP Units");
086                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "BP Intended Use Date/Time");
087                                  this.add(PL.class, false, 1, 80, new Object[]{ getMessage() }, "BP Intended Dispense From Location");
088                                  this.add(XAD.class, false, 1, 250, new Object[]{ getMessage() }, "BP Intended Dispense From Address");
089                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "BP Requested Dispense Date/Time");
090                                  this.add(PL.class, false, 1, 80, new Object[]{ getMessage() }, "BP Requested Dispense To Location");
091                                  this.add(XAD.class, false, 1, 250, new Object[]{ getMessage() }, "BP Requested Dispense To Address");
092                                  this.add(CWE.class, false, 0, 250, new Object[]{ getMessage() }, "BP Indication for Use");
093                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(136) }, "BP Informed Consent Indicator");
094       } catch(HL7Exception e) {
095          log.error("Unexpected error creating BPO - this is probably a bug in the source code generator.", e);
096       }
097    }
098
099
100
101    /**
102     * Returns
103     * BPO-1: "Set ID - BPO" - creates it if necessary
104     */
105    public SI getSetIDBPO() { 
106                SI retVal = this.getTypedField(1, 0);
107                return retVal;
108    }
109    
110    /**
111     * Returns
112     * BPO-1: "Set ID - BPO" - creates it if necessary
113     */
114    public SI getBpo1_SetIDBPO() { 
115                SI retVal = this.getTypedField(1, 0);
116                return retVal;
117    }
118
119
120
121    /**
122     * Returns
123     * BPO-2: "BP Universal Service ID" - creates it if necessary
124     */
125    public CWE getBPUniversalServiceID() { 
126                CWE retVal = this.getTypedField(2, 0);
127                return retVal;
128    }
129    
130    /**
131     * Returns
132     * BPO-2: "BP Universal Service ID" - creates it if necessary
133     */
134    public CWE getBpo2_BPUniversalServiceID() { 
135                CWE retVal = this.getTypedField(2, 0);
136                return retVal;
137    }
138
139
140    /**
141     * Returns all repetitions of BP  Processing Requirements (BPO-3).
142     */
143    public CWE[] getBPProcessingRequirements() {
144        CWE[] retVal = this.getTypedField(3, new CWE[0]);
145        return retVal;
146    }
147
148
149    /**
150     * Returns all repetitions of BP  Processing Requirements (BPO-3).
151     */
152    public CWE[] getBpo3_BPProcessingRequirements() {
153        CWE[] retVal = this.getTypedField(3, new CWE[0]);
154        return retVal;
155    }
156
157
158    /**
159     * Returns a count of the current number of repetitions of BP  Processing Requirements (BPO-3).
160     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
161     * it will return zero.
162     */
163    public int getBPProcessingRequirementsReps() {
164        return this.getReps(3);
165    }
166
167
168    /**
169     * Returns a specific repetition of
170     * BPO-3: "BP  Processing Requirements" - creates it if necessary
171     *
172     * @param rep The repetition index (0-indexed)
173     */
174    public CWE getBPProcessingRequirements(int rep) { 
175                CWE retVal = this.getTypedField(3, rep);
176                return retVal;
177    }
178
179    /**
180     * Returns a specific repetition of
181     * BPO-3: "BP  Processing Requirements" - creates it if necessary
182     *
183     * @param rep The repetition index (0-indexed)
184     */
185    public CWE getBpo3_BPProcessingRequirements(int rep) { 
186                CWE retVal = this.getTypedField(3, rep);
187                return retVal;
188    }
189
190    /**
191     * Returns a count of the current number of repetitions of BP  Processing Requirements (BPO-3).
192     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
193     * it will return zero.
194     */
195    public int getBpo3_BPProcessingRequirementsReps() {
196        return this.getReps(3);
197    }
198
199
200    /**
201     * Inserts a repetition of
202     * BPO-3: "BP  Processing Requirements" at a specific index
203     *
204     * @param rep The repetition index (0-indexed)
205     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
206     */
207    public CWE insertBPProcessingRequirements(int rep) throws HL7Exception { 
208        return (CWE) super.insertRepetition(3, rep);
209    }
210
211
212    /**
213     * Inserts a repetition of
214     * BPO-3: "BP  Processing Requirements" at a specific index
215     *
216     * @param rep The repetition index (0-indexed)
217     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
218     */
219    public CWE insertBpo3_BPProcessingRequirements(int rep) throws HL7Exception { 
220        return (CWE) super.insertRepetition(3, rep);
221    }
222
223
224    /**
225     * Removes a repetition of
226     * BPO-3: "BP  Processing Requirements" at a specific index
227     *
228     * @param rep The repetition index (0-indexed)
229     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
230     */
231    public CWE removeBPProcessingRequirements(int rep) throws HL7Exception { 
232        return (CWE) super.removeRepetition(3, rep);
233    }
234
235
236    /**
237     * Removes a repetition of
238     * BPO-3: "BP  Processing Requirements" at a specific index
239     *
240     * @param rep The repetition index (0-indexed)
241     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
242     */
243    public CWE removeBpo3_BPProcessingRequirements(int rep) throws HL7Exception { 
244        return (CWE) super.removeRepetition(3, rep);
245    }
246
247
248
249
250    /**
251     * Returns
252     * BPO-4: "BP Quantity" - creates it if necessary
253     */
254    public NM getBPQuantity() { 
255                NM retVal = this.getTypedField(4, 0);
256                return retVal;
257    }
258    
259    /**
260     * Returns
261     * BPO-4: "BP Quantity" - creates it if necessary
262     */
263    public NM getBpo4_BPQuantity() { 
264                NM retVal = this.getTypedField(4, 0);
265                return retVal;
266    }
267
268
269
270    /**
271     * Returns
272     * BPO-5: "BP Amount" - creates it if necessary
273     */
274    public NM getBPAmount() { 
275                NM retVal = this.getTypedField(5, 0);
276                return retVal;
277    }
278    
279    /**
280     * Returns
281     * BPO-5: "BP Amount" - creates it if necessary
282     */
283    public NM getBpo5_BPAmount() { 
284                NM retVal = this.getTypedField(5, 0);
285                return retVal;
286    }
287
288
289
290    /**
291     * Returns
292     * BPO-6: "BP Units" - creates it if necessary
293     */
294    public CE getBPUnits() { 
295                CE retVal = this.getTypedField(6, 0);
296                return retVal;
297    }
298    
299    /**
300     * Returns
301     * BPO-6: "BP Units" - creates it if necessary
302     */
303    public CE getBpo6_BPUnits() { 
304                CE retVal = this.getTypedField(6, 0);
305                return retVal;
306    }
307
308
309
310    /**
311     * Returns
312     * BPO-7: "BP Intended Use Date/Time" - creates it if necessary
313     */
314    public TS getBPIntendedUseDateTime() { 
315                TS retVal = this.getTypedField(7, 0);
316                return retVal;
317    }
318    
319    /**
320     * Returns
321     * BPO-7: "BP Intended Use Date/Time" - creates it if necessary
322     */
323    public TS getBpo7_BPIntendedUseDateTime() { 
324                TS retVal = this.getTypedField(7, 0);
325                return retVal;
326    }
327
328
329
330    /**
331     * Returns
332     * BPO-8: "BP Intended Dispense From Location" - creates it if necessary
333     */
334    public PL getBPIntendedDispenseFromLocation() { 
335                PL retVal = this.getTypedField(8, 0);
336                return retVal;
337    }
338    
339    /**
340     * Returns
341     * BPO-8: "BP Intended Dispense From Location" - creates it if necessary
342     */
343    public PL getBpo8_BPIntendedDispenseFromLocation() { 
344                PL retVal = this.getTypedField(8, 0);
345                return retVal;
346    }
347
348
349
350    /**
351     * Returns
352     * BPO-9: "BP Intended Dispense From Address" - creates it if necessary
353     */
354    public XAD getBPIntendedDispenseFromAddress() { 
355                XAD retVal = this.getTypedField(9, 0);
356                return retVal;
357    }
358    
359    /**
360     * Returns
361     * BPO-9: "BP Intended Dispense From Address" - creates it if necessary
362     */
363    public XAD getBpo9_BPIntendedDispenseFromAddress() { 
364                XAD retVal = this.getTypedField(9, 0);
365                return retVal;
366    }
367
368
369
370    /**
371     * Returns
372     * BPO-10: "BP Requested Dispense Date/Time" - creates it if necessary
373     */
374    public TS getBPRequestedDispenseDateTime() { 
375                TS retVal = this.getTypedField(10, 0);
376                return retVal;
377    }
378    
379    /**
380     * Returns
381     * BPO-10: "BP Requested Dispense Date/Time" - creates it if necessary
382     */
383    public TS getBpo10_BPRequestedDispenseDateTime() { 
384                TS retVal = this.getTypedField(10, 0);
385                return retVal;
386    }
387
388
389
390    /**
391     * Returns
392     * BPO-11: "BP Requested Dispense To Location" - creates it if necessary
393     */
394    public PL getBPRequestedDispenseToLocation() { 
395                PL retVal = this.getTypedField(11, 0);
396                return retVal;
397    }
398    
399    /**
400     * Returns
401     * BPO-11: "BP Requested Dispense To Location" - creates it if necessary
402     */
403    public PL getBpo11_BPRequestedDispenseToLocation() { 
404                PL retVal = this.getTypedField(11, 0);
405                return retVal;
406    }
407
408
409
410    /**
411     * Returns
412     * BPO-12: "BP Requested Dispense To Address" - creates it if necessary
413     */
414    public XAD getBPRequestedDispenseToAddress() { 
415                XAD retVal = this.getTypedField(12, 0);
416                return retVal;
417    }
418    
419    /**
420     * Returns
421     * BPO-12: "BP Requested Dispense To Address" - creates it if necessary
422     */
423    public XAD getBpo12_BPRequestedDispenseToAddress() { 
424                XAD retVal = this.getTypedField(12, 0);
425                return retVal;
426    }
427
428
429    /**
430     * Returns all repetitions of BP Indication for Use (BPO-13).
431     */
432    public CWE[] getBPIndicationForUse() {
433        CWE[] retVal = this.getTypedField(13, new CWE[0]);
434        return retVal;
435    }
436
437
438    /**
439     * Returns all repetitions of BP Indication for Use (BPO-13).
440     */
441    public CWE[] getBpo13_BPIndicationForUse() {
442        CWE[] retVal = this.getTypedField(13, new CWE[0]);
443        return retVal;
444    }
445
446
447    /**
448     * Returns a count of the current number of repetitions of BP Indication for Use (BPO-13).
449     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
450     * it will return zero.
451     */
452    public int getBPIndicationForUseReps() {
453        return this.getReps(13);
454    }
455
456
457    /**
458     * Returns a specific repetition of
459     * BPO-13: "BP Indication for Use" - creates it if necessary
460     *
461     * @param rep The repetition index (0-indexed)
462     */
463    public CWE getBPIndicationForUse(int rep) { 
464                CWE retVal = this.getTypedField(13, rep);
465                return retVal;
466    }
467
468    /**
469     * Returns a specific repetition of
470     * BPO-13: "BP Indication for Use" - creates it if necessary
471     *
472     * @param rep The repetition index (0-indexed)
473     */
474    public CWE getBpo13_BPIndicationForUse(int rep) { 
475                CWE retVal = this.getTypedField(13, rep);
476                return retVal;
477    }
478
479    /**
480     * Returns a count of the current number of repetitions of BP Indication for Use (BPO-13).
481     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
482     * it will return zero.
483     */
484    public int getBpo13_BPIndicationForUseReps() {
485        return this.getReps(13);
486    }
487
488
489    /**
490     * Inserts a repetition of
491     * BPO-13: "BP Indication for Use" at a specific index
492     *
493     * @param rep The repetition index (0-indexed)
494     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
495     */
496    public CWE insertBPIndicationForUse(int rep) throws HL7Exception { 
497        return (CWE) super.insertRepetition(13, rep);
498    }
499
500
501    /**
502     * Inserts a repetition of
503     * BPO-13: "BP Indication for Use" at a specific index
504     *
505     * @param rep The repetition index (0-indexed)
506     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
507     */
508    public CWE insertBpo13_BPIndicationForUse(int rep) throws HL7Exception { 
509        return (CWE) super.insertRepetition(13, rep);
510    }
511
512
513    /**
514     * Removes a repetition of
515     * BPO-13: "BP Indication for Use" at a specific index
516     *
517     * @param rep The repetition index (0-indexed)
518     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
519     */
520    public CWE removeBPIndicationForUse(int rep) throws HL7Exception { 
521        return (CWE) super.removeRepetition(13, rep);
522    }
523
524
525    /**
526     * Removes a repetition of
527     * BPO-13: "BP Indication for Use" at a specific index
528     *
529     * @param rep The repetition index (0-indexed)
530     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
531     */
532    public CWE removeBpo13_BPIndicationForUse(int rep) throws HL7Exception { 
533        return (CWE) super.removeRepetition(13, rep);
534    }
535
536
537
538
539    /**
540     * Returns
541     * BPO-14: "BP Informed Consent Indicator" - creates it if necessary
542     */
543    public ID getBPInformedConsentIndicator() { 
544                ID retVal = this.getTypedField(14, 0);
545                return retVal;
546    }
547    
548    /**
549     * Returns
550     * BPO-14: "BP Informed Consent Indicator" - creates it if necessary
551     */
552    public ID getBpo14_BPInformedConsentIndicator() { 
553                ID retVal = this.getTypedField(14, 0);
554                return retVal;
555    }
556
557
558
559
560
561    /** {@inheritDoc} */   
562    protected Type createNewTypeWithoutReflection(int field) {
563       switch (field) {
564          case 0: return new SI(getMessage());
565          case 1: return new CWE(getMessage());
566          case 2: return new CWE(getMessage());
567          case 3: return new NM(getMessage());
568          case 4: return new NM(getMessage());
569          case 5: return new CE(getMessage());
570          case 6: return new TS(getMessage());
571          case 7: return new PL(getMessage());
572          case 8: return new XAD(getMessage());
573          case 9: return new TS(getMessage());
574          case 10: return new PL(getMessage());
575          case 11: return new XAD(getMessage());
576          case 12: return new CWE(getMessage());
577          case 13: return new ID(getMessage(), new Integer( 136 ));
578          default: return null;
579       }
580   }
581
582
583}
584