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