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    
008    package ca.uhn.hl7v2.model.v24.segment;
009    
010    // import ca.uhn.hl7v2.model.v24.group.*;
011    import ca.uhn.hl7v2.model.v24.datatype.*;
012    import ca.uhn.log.HapiLogFactory;
013    import ca.uhn.hl7v2.HL7Exception;
014    import ca.uhn.hl7v2.parser.ModelClassFactory;
015    import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
016    import ca.uhn.hl7v2.model.AbstractMessage;
017    import ca.uhn.hl7v2.model.Group;
018    import ca.uhn.hl7v2.model.Type;
019    import ca.uhn.hl7v2.model.AbstractSegment;
020    import ca.uhn.hl7v2.model.Varies;
021    
022    /**
023     *<p>Represents an HL7 RXA message segment (Pharmacy/Treatment Administration). 
024     * This segment has the following fields:</p>
025     * <ul>
026         * <li>RXA-1: Give Sub-ID Counter (NM) <b> </b>
027         * <li>RXA-2: Administration Sub-ID Counter (NM) <b> </b>
028         * <li>RXA-3: Date/Time Start of Administration (TS) <b> </b>
029         * <li>RXA-4: Date/Time End of Administration (TS) <b> </b>
030         * <li>RXA-5: Administered Code (CE) <b> </b>
031         * <li>RXA-6: Administered Amount (NM) <b> </b>
032         * <li>RXA-7: Administered Units (CE) <b>optional </b>
033         * <li>RXA-8: Administered Dosage Form (CE) <b>optional </b>
034         * <li>RXA-9: Administration Notes (CE) <b>optional repeating</b>
035         * <li>RXA-10: Administering Provider (XCN) <b>optional repeating</b>
036         * <li>RXA-11: Administered-at Location (LA2) <b>optional </b>
037         * <li>RXA-12: Administered Per (Time Unit) (ST) <b>optional </b>
038         * <li>RXA-13: Administered Strength (NM) <b>optional </b>
039         * <li>RXA-14: Administered Strength Units (CE) <b>optional </b>
040         * <li>RXA-15: Substance Lot Number (ST) <b>optional repeating</b>
041         * <li>RXA-16: Substance Expiration Date (TS) <b>optional repeating</b>
042         * <li>RXA-17: Substance Manufacturer Name (CE) <b>optional repeating</b>
043         * <li>RXA-18: Substance/Treatment Refusal Reason (CE) <b>optional repeating</b>
044         * <li>RXA-19: Indication (CE) <b>optional repeating</b>
045         * <li>RXA-20: Completion Status (ID) <b>optional </b>
046         * <li>RXA-21: Action Code-RXA (ID) <b>optional </b>
047         * <li>RXA-22: System Entry Date/Time (TS) <b>optional </b>
048     * </ul>
049     */
050    public class RXA extends AbstractSegment {
051    
052        /** 
053         * Creates a new RXA segment
054         */
055        public RXA(Group parent, ModelClassFactory factory) {
056           super(parent, factory);
057           init(factory);
058        }
059    
060        private void init(ModelClassFactory factory) {
061           try {
062                                      this.add(NM.class, true, 1, 4, new Object[]{ getMessage(), new Integer(0) }, "Give Sub-ID Counter");
063                                      this.add(NM.class, true, 1, 4, new Object[]{ getMessage(), new Integer(0) }, "Administration Sub-ID Counter");
064                                      this.add(TS.class, true, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Date/Time Start of Administration");
065                                      this.add(TS.class, true, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Date/Time End of Administration");
066                                      this.add(CE.class, true, 1, 250, new Object[]{ getMessage(), new Integer(292) }, "Administered Code");
067                                      this.add(NM.class, true, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "Administered Amount");
068                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Administered Units");
069                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Administered Dosage Form");
070                                      this.add(CE.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Administration Notes");
071                                      this.add(XCN.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Administering Provider");
072                                      this.add(LA2.class, false, 1, 200, new Object[]{ getMessage(), new Integer(0) }, "Administered-at Location");
073                                      this.add(ST.class, false, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "Administered Per (Time Unit)");
074                                      this.add(NM.class, false, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "Administered Strength");
075                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Administered Strength Units");
076                                      this.add(ST.class, false, 0, 20, new Object[]{ getMessage(), new Integer(0) }, "Substance Lot Number");
077                                      this.add(TS.class, false, 0, 26, new Object[]{ getMessage(), new Integer(0) }, "Substance Expiration Date");
078                                      this.add(CE.class, false, 0, 250, new Object[]{ getMessage(), new Integer(227) }, "Substance Manufacturer Name");
079                                      this.add(CE.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Substance/Treatment Refusal Reason");
080                                      this.add(CE.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Indication");
081                                      this.add(ID.class, false, 1, 2, new Object[]{ getMessage() }, "Completion Status");
082                                      this.add(ID.class, false, 1, 2, new Object[]{ getMessage() }, "Action Code-RXA");
083                                      this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "System Entry Date/Time");
084           } catch(HL7Exception e) {
085              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating RXA - this is probably a bug in the source code generator.", e);
086           }
087        }
088    
089    
090    
091        /**
092         * Returns
093         * RXA-1: "Give Sub-ID Counter" - creates it if necessary
094         */
095        public NM getGiveSubIDCounter() { 
096            NM ret = null;
097            try {
098                Type t = this.getField(1, 0);
099                ret = (NM)t;
100            } catch (ClassCastException cce) {
101                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
102                throw new RuntimeException(cce);
103            } catch (HL7Exception he) {
104                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
105                throw new RuntimeException(he);
106            }
107            return ret;
108        }
109    
110    
111        /**
112         * Returns
113         * RXA-1: "Give Sub-ID Counter" - creates it if necessary
114         */
115        public NM getRxa1_GiveSubIDCounter() { 
116            NM ret = null;
117            try {
118                Type t = this.getField(1, 0);
119                ret = (NM)t;
120            } catch (ClassCastException cce) {
121                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
122                throw new RuntimeException(cce);
123            } catch (HL7Exception he) {
124                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
125                throw new RuntimeException(he);
126            }
127            return ret;
128        }
129    
130    
131    
132        /**
133         * Returns
134         * RXA-2: "Administration Sub-ID Counter" - creates it if necessary
135         */
136        public NM getAdministrationSubIDCounter() { 
137            NM ret = null;
138            try {
139                Type t = this.getField(2, 0);
140                ret = (NM)t;
141            } catch (ClassCastException cce) {
142                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
143                throw new RuntimeException(cce);
144            } catch (HL7Exception he) {
145                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
146                throw new RuntimeException(he);
147            }
148            return ret;
149        }
150    
151    
152        /**
153         * Returns
154         * RXA-2: "Administration Sub-ID Counter" - creates it if necessary
155         */
156        public NM getRxa2_AdministrationSubIDCounter() { 
157            NM ret = null;
158            try {
159                Type t = this.getField(2, 0);
160                ret = (NM)t;
161            } catch (ClassCastException cce) {
162                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
163                throw new RuntimeException(cce);
164            } catch (HL7Exception he) {
165                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
166                throw new RuntimeException(he);
167            }
168            return ret;
169        }
170    
171    
172    
173        /**
174         * Returns
175         * RXA-3: "Date/Time Start of Administration" - creates it if necessary
176         */
177        public TS getDateTimeStartOfAdministration() { 
178            TS ret = null;
179            try {
180                Type t = this.getField(3, 0);
181                ret = (TS)t;
182            } catch (ClassCastException cce) {
183                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
184                throw new RuntimeException(cce);
185            } catch (HL7Exception he) {
186                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
187                throw new RuntimeException(he);
188            }
189            return ret;
190        }
191    
192    
193        /**
194         * Returns
195         * RXA-3: "Date/Time Start of Administration" - creates it if necessary
196         */
197        public TS getRxa3_DateTimeStartOfAdministration() { 
198            TS ret = null;
199            try {
200                Type t = this.getField(3, 0);
201                ret = (TS)t;
202            } catch (ClassCastException cce) {
203                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
204                throw new RuntimeException(cce);
205            } catch (HL7Exception he) {
206                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
207                throw new RuntimeException(he);
208            }
209            return ret;
210        }
211    
212    
213    
214        /**
215         * Returns
216         * RXA-4: "Date/Time End of Administration" - creates it if necessary
217         */
218        public TS getDateTimeEndOfAdministration() { 
219            TS ret = null;
220            try {
221                Type t = this.getField(4, 0);
222                ret = (TS)t;
223            } catch (ClassCastException cce) {
224                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
225                throw new RuntimeException(cce);
226            } catch (HL7Exception he) {
227                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
228                throw new RuntimeException(he);
229            }
230            return ret;
231        }
232    
233    
234        /**
235         * Returns
236         * RXA-4: "Date/Time End of Administration" - creates it if necessary
237         */
238        public TS getRxa4_DateTimeEndOfAdministration() { 
239            TS ret = null;
240            try {
241                Type t = this.getField(4, 0);
242                ret = (TS)t;
243            } catch (ClassCastException cce) {
244                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
245                throw new RuntimeException(cce);
246            } catch (HL7Exception he) {
247                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
248                throw new RuntimeException(he);
249            }
250            return ret;
251        }
252    
253    
254    
255        /**
256         * Returns
257         * RXA-5: "Administered Code" - creates it if necessary
258         */
259        public CE getAdministeredCode() { 
260            CE ret = null;
261            try {
262                Type t = this.getField(5, 0);
263                ret = (CE)t;
264            } catch (ClassCastException cce) {
265                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
266                throw new RuntimeException(cce);
267            } catch (HL7Exception he) {
268                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
269                throw new RuntimeException(he);
270            }
271            return ret;
272        }
273    
274    
275        /**
276         * Returns
277         * RXA-5: "Administered Code" - creates it if necessary
278         */
279        public CE getRxa5_AdministeredCode() { 
280            CE ret = null;
281            try {
282                Type t = this.getField(5, 0);
283                ret = (CE)t;
284            } catch (ClassCastException cce) {
285                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
286                throw new RuntimeException(cce);
287            } catch (HL7Exception he) {
288                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
289                throw new RuntimeException(he);
290            }
291            return ret;
292        }
293    
294    
295    
296        /**
297         * Returns
298         * RXA-6: "Administered Amount" - creates it if necessary
299         */
300        public NM getAdministeredAmount() { 
301            NM ret = null;
302            try {
303                Type t = this.getField(6, 0);
304                ret = (NM)t;
305            } catch (ClassCastException cce) {
306                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
307                throw new RuntimeException(cce);
308            } catch (HL7Exception he) {
309                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
310                throw new RuntimeException(he);
311            }
312            return ret;
313        }
314    
315    
316        /**
317         * Returns
318         * RXA-6: "Administered Amount" - creates it if necessary
319         */
320        public NM getRxa6_AdministeredAmount() { 
321            NM ret = null;
322            try {
323                Type t = this.getField(6, 0);
324                ret = (NM)t;
325            } catch (ClassCastException cce) {
326                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
327                throw new RuntimeException(cce);
328            } catch (HL7Exception he) {
329                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
330                throw new RuntimeException(he);
331            }
332            return ret;
333        }
334    
335    
336    
337        /**
338         * Returns
339         * RXA-7: "Administered Units" - creates it if necessary
340         */
341        public CE getAdministeredUnits() { 
342            CE ret = null;
343            try {
344                Type t = this.getField(7, 0);
345                ret = (CE)t;
346            } catch (ClassCastException cce) {
347                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
348                throw new RuntimeException(cce);
349            } catch (HL7Exception he) {
350                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
351                throw new RuntimeException(he);
352            }
353            return ret;
354        }
355    
356    
357        /**
358         * Returns
359         * RXA-7: "Administered Units" - creates it if necessary
360         */
361        public CE getRxa7_AdministeredUnits() { 
362            CE ret = null;
363            try {
364                Type t = this.getField(7, 0);
365                ret = (CE)t;
366            } catch (ClassCastException cce) {
367                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
368                throw new RuntimeException(cce);
369            } catch (HL7Exception he) {
370                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
371                throw new RuntimeException(he);
372            }
373            return ret;
374        }
375    
376    
377    
378        /**
379         * Returns
380         * RXA-8: "Administered Dosage Form" - creates it if necessary
381         */
382        public CE getAdministeredDosageForm() { 
383            CE ret = null;
384            try {
385                Type t = this.getField(8, 0);
386                ret = (CE)t;
387            } catch (ClassCastException cce) {
388                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
389                throw new RuntimeException(cce);
390            } catch (HL7Exception he) {
391                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
392                throw new RuntimeException(he);
393            }
394            return ret;
395        }
396    
397    
398        /**
399         * Returns
400         * RXA-8: "Administered Dosage Form" - creates it if necessary
401         */
402        public CE getRxa8_AdministeredDosageForm() { 
403            CE ret = null;
404            try {
405                Type t = this.getField(8, 0);
406                ret = (CE)t;
407            } catch (ClassCastException cce) {
408                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
409                throw new RuntimeException(cce);
410            } catch (HL7Exception he) {
411                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
412                throw new RuntimeException(he);
413            }
414            return ret;
415        }
416    
417    
418        /**
419         * Returns all repetitions of Administration Notes (RXA-9).
420         */
421        public CE[] getAdministrationNotes() {
422            CE[] ret = null;
423            try {
424                Type[] t = this.getField(9);  
425                ret = new CE[t.length];
426                for (int i = 0; i < ret.length; i++) {
427                    ret[i] = (CE)t[i];
428                }
429            } catch (ClassCastException cce) {
430                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
431                throw new RuntimeException(cce);
432            } catch (HL7Exception he) {
433                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
434                throw new RuntimeException(he);
435            }
436            return ret;
437        }
438    
439    
440        /**
441         * Returns a count of the current number of repetitions of Administration Notes (RXA-9).
442         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
443         * it will return zero.
444         */
445        public int getAdministrationNotesReps() {
446            CE[] ret = null;
447            try {
448                Type[] t = this.getField(9);
449                return t.length;  
450            } catch (ClassCastException cce) {
451                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
452                throw new RuntimeException(cce);
453            } catch (HL7Exception he) {
454                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
455                throw new RuntimeException(he);
456            }
457        }
458    
459    
460        /**
461         * Returns a specific repetition of
462         * RXA-9: "Administration Notes" - creates it if necessary
463         *
464         * @param rep The repetition index (0-indexed)
465         */
466        public CE getAdministrationNotes(int rep) { 
467            CE ret = null;
468            try {
469                Type t = this.getField(9, rep);
470                ret = (CE)t;
471            } catch (ClassCastException cce) {
472                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
473                throw new RuntimeException(cce);
474            } catch (HL7Exception he) {
475                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
476                throw new RuntimeException(he);
477            }
478            return ret;
479        }
480    
481        /**
482         * Returns a specific repetition of
483         * RXA-9: "Administration Notes" - creates it if necessary
484         *
485         * @param rep The repetition index (0-indexed)
486         */
487        public CE getRxa9_AdministrationNotes(int rep) { 
488            CE ret = null;
489            try {
490                Type t = this.getField(9, rep);
491                ret = (CE)t;
492            } catch (ClassCastException cce) {
493                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
494                throw new RuntimeException(cce);
495            } catch (HL7Exception he) {
496                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
497                throw new RuntimeException(he);
498            }
499            return ret;
500        }
501    
502    
503        /**
504         * Returns a count of the current number of repetitions of Administration Notes (RXA-9).
505         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
506         * it will return zero.
507         */
508        public int getRxa9_AdministrationNotesReps() {
509            CE[] ret = null;
510            try {
511                Type[] t = this.getField(9);
512                return t.length;  
513            } catch (ClassCastException cce) {
514                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
515                throw new RuntimeException(cce);
516            } catch (HL7Exception he) {
517                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
518                throw new RuntimeException(he);
519            }
520        }
521    
522    
523    
524        /**
525         * Inserts a repetition of
526         * RXA-9: "Administration Notes" at a specific index
527         *
528         * @param rep The repetition index (0-indexed)
529         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
530         */
531        public CE insertAdministrationNotes(int rep) throws HL7Exception { 
532            return (CE) super.insertRepetition(9, rep);
533        }
534    
535    
536    
537        /**
538         * Inserts a repetition of
539         * RXA-9: "Administration Notes" at a specific index
540         *
541         * @param rep The repetition index (0-indexed)
542         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
543         */
544        public CE insertRxa9_AdministrationNotes(int rep) throws HL7Exception { 
545            return (CE) super.insertRepetition(9, rep);
546        }
547    
548    
549        /**
550         * Removes a repetition of
551         * RXA-9: "Administration Notes" at a specific index
552         *
553         * @param rep The repetition index (0-indexed)
554         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
555         */
556        public CE removeAdministrationNotes(int rep) throws HL7Exception { 
557            return (CE) super.removeRepetition(9, rep);
558        }
559    
560    
561        /**
562         * Removes a repetition of
563         * RXA-9: "Administration Notes" at a specific index
564         *
565         * @param rep The repetition index (0-indexed)
566         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
567         */
568        public CE removeRxa9_AdministrationNotes(int rep) throws HL7Exception { 
569            return (CE) super.removeRepetition(9, rep);
570        }
571    
572    
573    
574        /**
575         * Returns all repetitions of Administering Provider (RXA-10).
576         */
577        public XCN[] getAdministeringProvider() {
578            XCN[] ret = null;
579            try {
580                Type[] t = this.getField(10);  
581                ret = new XCN[t.length];
582                for (int i = 0; i < ret.length; i++) {
583                    ret[i] = (XCN)t[i];
584                }
585            } catch (ClassCastException cce) {
586                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
587                throw new RuntimeException(cce);
588            } catch (HL7Exception he) {
589                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
590                throw new RuntimeException(he);
591            }
592            return ret;
593        }
594    
595    
596        /**
597         * Returns a count of the current number of repetitions of Administering Provider (RXA-10).
598         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
599         * it will return zero.
600         */
601        public int getAdministeringProviderReps() {
602            XCN[] ret = null;
603            try {
604                Type[] t = this.getField(10);
605                return t.length;  
606            } catch (ClassCastException cce) {
607                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
608                throw new RuntimeException(cce);
609            } catch (HL7Exception he) {
610                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
611                throw new RuntimeException(he);
612            }
613        }
614    
615    
616        /**
617         * Returns a specific repetition of
618         * RXA-10: "Administering Provider" - creates it if necessary
619         *
620         * @param rep The repetition index (0-indexed)
621         */
622        public XCN getAdministeringProvider(int rep) { 
623            XCN ret = null;
624            try {
625                Type t = this.getField(10, rep);
626                ret = (XCN)t;
627            } catch (ClassCastException cce) {
628                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
629                throw new RuntimeException(cce);
630            } catch (HL7Exception he) {
631                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
632                throw new RuntimeException(he);
633            }
634            return ret;
635        }
636    
637        /**
638         * Returns a specific repetition of
639         * RXA-10: "Administering Provider" - creates it if necessary
640         *
641         * @param rep The repetition index (0-indexed)
642         */
643        public XCN getRxa10_AdministeringProvider(int rep) { 
644            XCN ret = null;
645            try {
646                Type t = this.getField(10, rep);
647                ret = (XCN)t;
648            } catch (ClassCastException cce) {
649                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
650                throw new RuntimeException(cce);
651            } catch (HL7Exception he) {
652                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
653                throw new RuntimeException(he);
654            }
655            return ret;
656        }
657    
658    
659        /**
660         * Returns a count of the current number of repetitions of Administering Provider (RXA-10).
661         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
662         * it will return zero.
663         */
664        public int getRxa10_AdministeringProviderReps() {
665            XCN[] ret = null;
666            try {
667                Type[] t = this.getField(10);
668                return t.length;  
669            } catch (ClassCastException cce) {
670                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
671                throw new RuntimeException(cce);
672            } catch (HL7Exception he) {
673                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
674                throw new RuntimeException(he);
675            }
676        }
677    
678    
679    
680        /**
681         * Inserts a repetition of
682         * RXA-10: "Administering Provider" at a specific index
683         *
684         * @param rep The repetition index (0-indexed)
685         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
686         */
687        public XCN insertAdministeringProvider(int rep) throws HL7Exception { 
688            return (XCN) super.insertRepetition(10, rep);
689        }
690    
691    
692    
693        /**
694         * Inserts a repetition of
695         * RXA-10: "Administering Provider" at a specific index
696         *
697         * @param rep The repetition index (0-indexed)
698         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
699         */
700        public XCN insertRxa10_AdministeringProvider(int rep) throws HL7Exception { 
701            return (XCN) super.insertRepetition(10, rep);
702        }
703    
704    
705        /**
706         * Removes a repetition of
707         * RXA-10: "Administering Provider" at a specific index
708         *
709         * @param rep The repetition index (0-indexed)
710         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
711         */
712        public XCN removeAdministeringProvider(int rep) throws HL7Exception { 
713            return (XCN) super.removeRepetition(10, rep);
714        }
715    
716    
717        /**
718         * Removes a repetition of
719         * RXA-10: "Administering Provider" at a specific index
720         *
721         * @param rep The repetition index (0-indexed)
722         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
723         */
724        public XCN removeRxa10_AdministeringProvider(int rep) throws HL7Exception { 
725            return (XCN) super.removeRepetition(10, rep);
726        }
727    
728    
729    
730    
731        /**
732         * Returns
733         * RXA-11: "Administered-at Location" - creates it if necessary
734         */
735        public LA2 getAdministeredAtLocation() { 
736            LA2 ret = null;
737            try {
738                Type t = this.getField(11, 0);
739                ret = (LA2)t;
740            } catch (ClassCastException cce) {
741                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
742                throw new RuntimeException(cce);
743            } catch (HL7Exception he) {
744                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
745                throw new RuntimeException(he);
746            }
747            return ret;
748        }
749    
750    
751        /**
752         * Returns
753         * RXA-11: "Administered-at Location" - creates it if necessary
754         */
755        public LA2 getRxa11_AdministeredAtLocation() { 
756            LA2 ret = null;
757            try {
758                Type t = this.getField(11, 0);
759                ret = (LA2)t;
760            } catch (ClassCastException cce) {
761                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
762                throw new RuntimeException(cce);
763            } catch (HL7Exception he) {
764                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
765                throw new RuntimeException(he);
766            }
767            return ret;
768        }
769    
770    
771    
772        /**
773         * Returns
774         * RXA-12: "Administered Per (Time Unit)" - creates it if necessary
775         */
776        public ST getAdministeredPerTimeUnit() { 
777            ST ret = null;
778            try {
779                Type t = this.getField(12, 0);
780                ret = (ST)t;
781            } catch (ClassCastException cce) {
782                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
783                throw new RuntimeException(cce);
784            } catch (HL7Exception he) {
785                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
786                throw new RuntimeException(he);
787            }
788            return ret;
789        }
790    
791    
792        /**
793         * Returns
794         * RXA-12: "Administered Per (Time Unit)" - creates it if necessary
795         */
796        public ST getRxa12_AdministeredPerTimeUnit() { 
797            ST ret = null;
798            try {
799                Type t = this.getField(12, 0);
800                ret = (ST)t;
801            } catch (ClassCastException cce) {
802                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
803                throw new RuntimeException(cce);
804            } catch (HL7Exception he) {
805                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
806                throw new RuntimeException(he);
807            }
808            return ret;
809        }
810    
811    
812    
813        /**
814         * Returns
815         * RXA-13: "Administered Strength" - creates it if necessary
816         */
817        public NM getAdministeredStrength() { 
818            NM ret = null;
819            try {
820                Type t = this.getField(13, 0);
821                ret = (NM)t;
822            } catch (ClassCastException cce) {
823                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
824                throw new RuntimeException(cce);
825            } catch (HL7Exception he) {
826                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
827                throw new RuntimeException(he);
828            }
829            return ret;
830        }
831    
832    
833        /**
834         * Returns
835         * RXA-13: "Administered Strength" - creates it if necessary
836         */
837        public NM getRxa13_AdministeredStrength() { 
838            NM ret = null;
839            try {
840                Type t = this.getField(13, 0);
841                ret = (NM)t;
842            } catch (ClassCastException cce) {
843                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
844                throw new RuntimeException(cce);
845            } catch (HL7Exception he) {
846                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
847                throw new RuntimeException(he);
848            }
849            return ret;
850        }
851    
852    
853    
854        /**
855         * Returns
856         * RXA-14: "Administered Strength Units" - creates it if necessary
857         */
858        public CE getAdministeredStrengthUnits() { 
859            CE ret = null;
860            try {
861                Type t = this.getField(14, 0);
862                ret = (CE)t;
863            } catch (ClassCastException cce) {
864                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
865                throw new RuntimeException(cce);
866            } catch (HL7Exception he) {
867                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
868                throw new RuntimeException(he);
869            }
870            return ret;
871        }
872    
873    
874        /**
875         * Returns
876         * RXA-14: "Administered Strength Units" - creates it if necessary
877         */
878        public CE getRxa14_AdministeredStrengthUnits() { 
879            CE ret = null;
880            try {
881                Type t = this.getField(14, 0);
882                ret = (CE)t;
883            } catch (ClassCastException cce) {
884                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
885                throw new RuntimeException(cce);
886            } catch (HL7Exception he) {
887                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
888                throw new RuntimeException(he);
889            }
890            return ret;
891        }
892    
893    
894        /**
895         * Returns all repetitions of Substance Lot Number (RXA-15).
896         */
897        public ST[] getSubstanceLotNumber() {
898            ST[] ret = null;
899            try {
900                Type[] t = this.getField(15);  
901                ret = new ST[t.length];
902                for (int i = 0; i < ret.length; i++) {
903                    ret[i] = (ST)t[i];
904                }
905            } catch (ClassCastException cce) {
906                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
907                throw new RuntimeException(cce);
908            } catch (HL7Exception he) {
909                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
910                throw new RuntimeException(he);
911            }
912            return ret;
913        }
914    
915    
916        /**
917         * Returns a count of the current number of repetitions of Substance Lot Number (RXA-15).
918         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
919         * it will return zero.
920         */
921        public int getSubstanceLotNumberReps() {
922            ST[] ret = null;
923            try {
924                Type[] t = this.getField(15);
925                return t.length;  
926            } catch (ClassCastException cce) {
927                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
928                throw new RuntimeException(cce);
929            } catch (HL7Exception he) {
930                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
931                throw new RuntimeException(he);
932            }
933        }
934    
935    
936        /**
937         * Returns a specific repetition of
938         * RXA-15: "Substance Lot Number" - creates it if necessary
939         *
940         * @param rep The repetition index (0-indexed)
941         */
942        public ST getSubstanceLotNumber(int rep) { 
943            ST ret = null;
944            try {
945                Type t = this.getField(15, rep);
946                ret = (ST)t;
947            } catch (ClassCastException cce) {
948                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
949                throw new RuntimeException(cce);
950            } catch (HL7Exception he) {
951                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
952                throw new RuntimeException(he);
953            }
954            return ret;
955        }
956    
957        /**
958         * Returns a specific repetition of
959         * RXA-15: "Substance Lot Number" - creates it if necessary
960         *
961         * @param rep The repetition index (0-indexed)
962         */
963        public ST getRxa15_SubstanceLotNumber(int rep) { 
964            ST ret = null;
965            try {
966                Type t = this.getField(15, rep);
967                ret = (ST)t;
968            } catch (ClassCastException cce) {
969                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
970                throw new RuntimeException(cce);
971            } catch (HL7Exception he) {
972                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
973                throw new RuntimeException(he);
974            }
975            return ret;
976        }
977    
978    
979        /**
980         * Returns a count of the current number of repetitions of Substance Lot Number (RXA-15).
981         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
982         * it will return zero.
983         */
984        public int getRxa15_SubstanceLotNumberReps() {
985            ST[] ret = null;
986            try {
987                Type[] t = this.getField(15);
988                return t.length;  
989            } catch (ClassCastException cce) {
990                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
991                throw new RuntimeException(cce);
992            } catch (HL7Exception he) {
993                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
994                throw new RuntimeException(he);
995            }
996        }
997    
998    
999    
1000        /**
1001         * Inserts a repetition of
1002         * RXA-15: "Substance Lot Number" at a specific index
1003         *
1004         * @param rep The repetition index (0-indexed)
1005         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1006         */
1007        public ST insertSubstanceLotNumber(int rep) throws HL7Exception { 
1008            return (ST) super.insertRepetition(15, rep);
1009        }
1010    
1011    
1012    
1013        /**
1014         * Inserts a repetition of
1015         * RXA-15: "Substance Lot Number" at a specific index
1016         *
1017         * @param rep The repetition index (0-indexed)
1018         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1019         */
1020        public ST insertRxa15_SubstanceLotNumber(int rep) throws HL7Exception { 
1021            return (ST) super.insertRepetition(15, rep);
1022        }
1023    
1024    
1025        /**
1026         * Removes a repetition of
1027         * RXA-15: "Substance Lot Number" at a specific index
1028         *
1029         * @param rep The repetition index (0-indexed)
1030         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1031         */
1032        public ST removeSubstanceLotNumber(int rep) throws HL7Exception { 
1033            return (ST) super.removeRepetition(15, rep);
1034        }
1035    
1036    
1037        /**
1038         * Removes a repetition of
1039         * RXA-15: "Substance Lot Number" at a specific index
1040         *
1041         * @param rep The repetition index (0-indexed)
1042         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1043         */
1044        public ST removeRxa15_SubstanceLotNumber(int rep) throws HL7Exception { 
1045            return (ST) super.removeRepetition(15, rep);
1046        }
1047    
1048    
1049    
1050        /**
1051         * Returns all repetitions of Substance Expiration Date (RXA-16).
1052         */
1053        public TS[] getSubstanceExpirationDate() {
1054            TS[] ret = null;
1055            try {
1056                Type[] t = this.getField(16);  
1057                ret = new TS[t.length];
1058                for (int i = 0; i < ret.length; i++) {
1059                    ret[i] = (TS)t[i];
1060                }
1061            } catch (ClassCastException cce) {
1062                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1063                throw new RuntimeException(cce);
1064            } catch (HL7Exception he) {
1065                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1066                throw new RuntimeException(he);
1067            }
1068            return ret;
1069        }
1070    
1071    
1072        /**
1073         * Returns a count of the current number of repetitions of Substance Expiration Date (RXA-16).
1074         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1075         * it will return zero.
1076         */
1077        public int getSubstanceExpirationDateReps() {
1078            TS[] ret = null;
1079            try {
1080                Type[] t = this.getField(16);
1081                return t.length;  
1082            } catch (ClassCastException cce) {
1083                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1084                throw new RuntimeException(cce);
1085            } catch (HL7Exception he) {
1086                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1087                throw new RuntimeException(he);
1088            }
1089        }
1090    
1091    
1092        /**
1093         * Returns a specific repetition of
1094         * RXA-16: "Substance Expiration Date" - creates it if necessary
1095         *
1096         * @param rep The repetition index (0-indexed)
1097         */
1098        public TS getSubstanceExpirationDate(int rep) { 
1099            TS ret = null;
1100            try {
1101                Type t = this.getField(16, rep);
1102                ret = (TS)t;
1103            } catch (ClassCastException cce) {
1104                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1105                throw new RuntimeException(cce);
1106            } catch (HL7Exception he) {
1107                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1108                throw new RuntimeException(he);
1109            }
1110            return ret;
1111        }
1112    
1113        /**
1114         * Returns a specific repetition of
1115         * RXA-16: "Substance Expiration Date" - creates it if necessary
1116         *
1117         * @param rep The repetition index (0-indexed)
1118         */
1119        public TS getRxa16_SubstanceExpirationDate(int rep) { 
1120            TS ret = null;
1121            try {
1122                Type t = this.getField(16, rep);
1123                ret = (TS)t;
1124            } catch (ClassCastException cce) {
1125                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1126                throw new RuntimeException(cce);
1127            } catch (HL7Exception he) {
1128                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1129                throw new RuntimeException(he);
1130            }
1131            return ret;
1132        }
1133    
1134    
1135        /**
1136         * Returns a count of the current number of repetitions of Substance Expiration Date (RXA-16).
1137         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1138         * it will return zero.
1139         */
1140        public int getRxa16_SubstanceExpirationDateReps() {
1141            TS[] ret = null;
1142            try {
1143                Type[] t = this.getField(16);
1144                return t.length;  
1145            } catch (ClassCastException cce) {
1146                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1147                throw new RuntimeException(cce);
1148            } catch (HL7Exception he) {
1149                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1150                throw new RuntimeException(he);
1151            }
1152        }
1153    
1154    
1155    
1156        /**
1157         * Inserts a repetition of
1158         * RXA-16: "Substance Expiration Date" at a specific index
1159         *
1160         * @param rep The repetition index (0-indexed)
1161         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1162         */
1163        public TS insertSubstanceExpirationDate(int rep) throws HL7Exception { 
1164            return (TS) super.insertRepetition(16, rep);
1165        }
1166    
1167    
1168    
1169        /**
1170         * Inserts a repetition of
1171         * RXA-16: "Substance Expiration Date" at a specific index
1172         *
1173         * @param rep The repetition index (0-indexed)
1174         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1175         */
1176        public TS insertRxa16_SubstanceExpirationDate(int rep) throws HL7Exception { 
1177            return (TS) super.insertRepetition(16, rep);
1178        }
1179    
1180    
1181        /**
1182         * Removes a repetition of
1183         * RXA-16: "Substance Expiration Date" at a specific index
1184         *
1185         * @param rep The repetition index (0-indexed)
1186         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1187         */
1188        public TS removeSubstanceExpirationDate(int rep) throws HL7Exception { 
1189            return (TS) super.removeRepetition(16, rep);
1190        }
1191    
1192    
1193        /**
1194         * Removes a repetition of
1195         * RXA-16: "Substance Expiration Date" at a specific index
1196         *
1197         * @param rep The repetition index (0-indexed)
1198         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1199         */
1200        public TS removeRxa16_SubstanceExpirationDate(int rep) throws HL7Exception { 
1201            return (TS) super.removeRepetition(16, rep);
1202        }
1203    
1204    
1205    
1206        /**
1207         * Returns all repetitions of Substance Manufacturer Name (RXA-17).
1208         */
1209        public CE[] getSubstanceManufacturerName() {
1210            CE[] ret = null;
1211            try {
1212                Type[] t = this.getField(17);  
1213                ret = new CE[t.length];
1214                for (int i = 0; i < ret.length; i++) {
1215                    ret[i] = (CE)t[i];
1216                }
1217            } catch (ClassCastException cce) {
1218                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1219                throw new RuntimeException(cce);
1220            } catch (HL7Exception he) {
1221                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1222                throw new RuntimeException(he);
1223            }
1224            return ret;
1225        }
1226    
1227    
1228        /**
1229         * Returns a count of the current number of repetitions of Substance Manufacturer Name (RXA-17).
1230         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1231         * it will return zero.
1232         */
1233        public int getSubstanceManufacturerNameReps() {
1234            CE[] ret = null;
1235            try {
1236                Type[] t = this.getField(17);
1237                return t.length;  
1238            } catch (ClassCastException cce) {
1239                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1240                throw new RuntimeException(cce);
1241            } catch (HL7Exception he) {
1242                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1243                throw new RuntimeException(he);
1244            }
1245        }
1246    
1247    
1248        /**
1249         * Returns a specific repetition of
1250         * RXA-17: "Substance Manufacturer Name" - creates it if necessary
1251         *
1252         * @param rep The repetition index (0-indexed)
1253         */
1254        public CE getSubstanceManufacturerName(int rep) { 
1255            CE ret = null;
1256            try {
1257                Type t = this.getField(17, rep);
1258                ret = (CE)t;
1259            } catch (ClassCastException cce) {
1260                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1261                throw new RuntimeException(cce);
1262            } catch (HL7Exception he) {
1263                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1264                throw new RuntimeException(he);
1265            }
1266            return ret;
1267        }
1268    
1269        /**
1270         * Returns a specific repetition of
1271         * RXA-17: "Substance Manufacturer Name" - creates it if necessary
1272         *
1273         * @param rep The repetition index (0-indexed)
1274         */
1275        public CE getRxa17_SubstanceManufacturerName(int rep) { 
1276            CE ret = null;
1277            try {
1278                Type t = this.getField(17, rep);
1279                ret = (CE)t;
1280            } catch (ClassCastException cce) {
1281                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1282                throw new RuntimeException(cce);
1283            } catch (HL7Exception he) {
1284                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1285                throw new RuntimeException(he);
1286            }
1287            return ret;
1288        }
1289    
1290    
1291        /**
1292         * Returns a count of the current number of repetitions of Substance Manufacturer Name (RXA-17).
1293         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1294         * it will return zero.
1295         */
1296        public int getRxa17_SubstanceManufacturerNameReps() {
1297            CE[] ret = null;
1298            try {
1299                Type[] t = this.getField(17);
1300                return t.length;  
1301            } catch (ClassCastException cce) {
1302                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1303                throw new RuntimeException(cce);
1304            } catch (HL7Exception he) {
1305                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1306                throw new RuntimeException(he);
1307            }
1308        }
1309    
1310    
1311    
1312        /**
1313         * Inserts a repetition of
1314         * RXA-17: "Substance Manufacturer Name" at a specific index
1315         *
1316         * @param rep The repetition index (0-indexed)
1317         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1318         */
1319        public CE insertSubstanceManufacturerName(int rep) throws HL7Exception { 
1320            return (CE) super.insertRepetition(17, rep);
1321        }
1322    
1323    
1324    
1325        /**
1326         * Inserts a repetition of
1327         * RXA-17: "Substance Manufacturer Name" at a specific index
1328         *
1329         * @param rep The repetition index (0-indexed)
1330         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1331         */
1332        public CE insertRxa17_SubstanceManufacturerName(int rep) throws HL7Exception { 
1333            return (CE) super.insertRepetition(17, rep);
1334        }
1335    
1336    
1337        /**
1338         * Removes a repetition of
1339         * RXA-17: "Substance Manufacturer Name" at a specific index
1340         *
1341         * @param rep The repetition index (0-indexed)
1342         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1343         */
1344        public CE removeSubstanceManufacturerName(int rep) throws HL7Exception { 
1345            return (CE) super.removeRepetition(17, rep);
1346        }
1347    
1348    
1349        /**
1350         * Removes a repetition of
1351         * RXA-17: "Substance Manufacturer Name" at a specific index
1352         *
1353         * @param rep The repetition index (0-indexed)
1354         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1355         */
1356        public CE removeRxa17_SubstanceManufacturerName(int rep) throws HL7Exception { 
1357            return (CE) super.removeRepetition(17, rep);
1358        }
1359    
1360    
1361    
1362        /**
1363         * Returns all repetitions of Substance/Treatment Refusal Reason (RXA-18).
1364         */
1365        public CE[] getSubstanceTreatmentRefusalReason() {
1366            CE[] ret = null;
1367            try {
1368                Type[] t = this.getField(18);  
1369                ret = new CE[t.length];
1370                for (int i = 0; i < ret.length; i++) {
1371                    ret[i] = (CE)t[i];
1372                }
1373            } catch (ClassCastException cce) {
1374                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1375                throw new RuntimeException(cce);
1376            } catch (HL7Exception he) {
1377                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1378                throw new RuntimeException(he);
1379            }
1380            return ret;
1381        }
1382    
1383    
1384        /**
1385         * Returns a count of the current number of repetitions of Substance/Treatment Refusal Reason (RXA-18).
1386         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1387         * it will return zero.
1388         */
1389        public int getSubstanceTreatmentRefusalReasonReps() {
1390            CE[] ret = null;
1391            try {
1392                Type[] t = this.getField(18);
1393                return t.length;  
1394            } catch (ClassCastException cce) {
1395                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1396                throw new RuntimeException(cce);
1397            } catch (HL7Exception he) {
1398                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1399                throw new RuntimeException(he);
1400            }
1401        }
1402    
1403    
1404        /**
1405         * Returns a specific repetition of
1406         * RXA-18: "Substance/Treatment Refusal Reason" - creates it if necessary
1407         *
1408         * @param rep The repetition index (0-indexed)
1409         */
1410        public CE getSubstanceTreatmentRefusalReason(int rep) { 
1411            CE ret = null;
1412            try {
1413                Type t = this.getField(18, rep);
1414                ret = (CE)t;
1415            } catch (ClassCastException cce) {
1416                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1417                throw new RuntimeException(cce);
1418            } catch (HL7Exception he) {
1419                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1420                throw new RuntimeException(he);
1421            }
1422            return ret;
1423        }
1424    
1425        /**
1426         * Returns a specific repetition of
1427         * RXA-18: "Substance/Treatment Refusal Reason" - creates it if necessary
1428         *
1429         * @param rep The repetition index (0-indexed)
1430         */
1431        public CE getRxa18_SubstanceTreatmentRefusalReason(int rep) { 
1432            CE ret = null;
1433            try {
1434                Type t = this.getField(18, rep);
1435                ret = (CE)t;
1436            } catch (ClassCastException cce) {
1437                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1438                throw new RuntimeException(cce);
1439            } catch (HL7Exception he) {
1440                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1441                throw new RuntimeException(he);
1442            }
1443            return ret;
1444        }
1445    
1446    
1447        /**
1448         * Returns a count of the current number of repetitions of Substance/Treatment Refusal Reason (RXA-18).
1449         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1450         * it will return zero.
1451         */
1452        public int getRxa18_SubstanceTreatmentRefusalReasonReps() {
1453            CE[] ret = null;
1454            try {
1455                Type[] t = this.getField(18);
1456                return t.length;  
1457            } catch (ClassCastException cce) {
1458                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1459                throw new RuntimeException(cce);
1460            } catch (HL7Exception he) {
1461                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1462                throw new RuntimeException(he);
1463            }
1464        }
1465    
1466    
1467    
1468        /**
1469         * Inserts a repetition of
1470         * RXA-18: "Substance/Treatment Refusal Reason" at a specific index
1471         *
1472         * @param rep The repetition index (0-indexed)
1473         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1474         */
1475        public CE insertSubstanceTreatmentRefusalReason(int rep) throws HL7Exception { 
1476            return (CE) super.insertRepetition(18, rep);
1477        }
1478    
1479    
1480    
1481        /**
1482         * Inserts a repetition of
1483         * RXA-18: "Substance/Treatment Refusal Reason" at a specific index
1484         *
1485         * @param rep The repetition index (0-indexed)
1486         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1487         */
1488        public CE insertRxa18_SubstanceTreatmentRefusalReason(int rep) throws HL7Exception { 
1489            return (CE) super.insertRepetition(18, rep);
1490        }
1491    
1492    
1493        /**
1494         * Removes a repetition of
1495         * RXA-18: "Substance/Treatment Refusal Reason" at a specific index
1496         *
1497         * @param rep The repetition index (0-indexed)
1498         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1499         */
1500        public CE removeSubstanceTreatmentRefusalReason(int rep) throws HL7Exception { 
1501            return (CE) super.removeRepetition(18, rep);
1502        }
1503    
1504    
1505        /**
1506         * Removes a repetition of
1507         * RXA-18: "Substance/Treatment Refusal Reason" at a specific index
1508         *
1509         * @param rep The repetition index (0-indexed)
1510         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1511         */
1512        public CE removeRxa18_SubstanceTreatmentRefusalReason(int rep) throws HL7Exception { 
1513            return (CE) super.removeRepetition(18, rep);
1514        }
1515    
1516    
1517    
1518        /**
1519         * Returns all repetitions of Indication (RXA-19).
1520         */
1521        public CE[] getIndication() {
1522            CE[] ret = null;
1523            try {
1524                Type[] t = this.getField(19);  
1525                ret = new CE[t.length];
1526                for (int i = 0; i < ret.length; i++) {
1527                    ret[i] = (CE)t[i];
1528                }
1529            } catch (ClassCastException cce) {
1530                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1531                throw new RuntimeException(cce);
1532            } catch (HL7Exception he) {
1533                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1534                throw new RuntimeException(he);
1535            }
1536            return ret;
1537        }
1538    
1539    
1540        /**
1541         * Returns a count of the current number of repetitions of Indication (RXA-19).
1542         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1543         * it will return zero.
1544         */
1545        public int getIndicationReps() {
1546            CE[] ret = null;
1547            try {
1548                Type[] t = this.getField(19);
1549                return t.length;  
1550            } catch (ClassCastException cce) {
1551                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1552                throw new RuntimeException(cce);
1553            } catch (HL7Exception he) {
1554                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1555                throw new RuntimeException(he);
1556            }
1557        }
1558    
1559    
1560        /**
1561         * Returns a specific repetition of
1562         * RXA-19: "Indication" - creates it if necessary
1563         *
1564         * @param rep The repetition index (0-indexed)
1565         */
1566        public CE getIndication(int rep) { 
1567            CE ret = null;
1568            try {
1569                Type t = this.getField(19, rep);
1570                ret = (CE)t;
1571            } catch (ClassCastException cce) {
1572                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1573                throw new RuntimeException(cce);
1574            } catch (HL7Exception he) {
1575                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1576                throw new RuntimeException(he);
1577            }
1578            return ret;
1579        }
1580    
1581        /**
1582         * Returns a specific repetition of
1583         * RXA-19: "Indication" - creates it if necessary
1584         *
1585         * @param rep The repetition index (0-indexed)
1586         */
1587        public CE getRxa19_Indication(int rep) { 
1588            CE ret = null;
1589            try {
1590                Type t = this.getField(19, rep);
1591                ret = (CE)t;
1592            } catch (ClassCastException cce) {
1593                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1594                throw new RuntimeException(cce);
1595            } catch (HL7Exception he) {
1596                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1597                throw new RuntimeException(he);
1598            }
1599            return ret;
1600        }
1601    
1602    
1603        /**
1604         * Returns a count of the current number of repetitions of Indication (RXA-19).
1605         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1606         * it will return zero.
1607         */
1608        public int getRxa19_IndicationReps() {
1609            CE[] ret = null;
1610            try {
1611                Type[] t = this.getField(19);
1612                return t.length;  
1613            } catch (ClassCastException cce) {
1614                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1615                throw new RuntimeException(cce);
1616            } catch (HL7Exception he) {
1617                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1618                throw new RuntimeException(he);
1619            }
1620        }
1621    
1622    
1623    
1624        /**
1625         * Inserts a repetition of
1626         * RXA-19: "Indication" at a specific index
1627         *
1628         * @param rep The repetition index (0-indexed)
1629         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1630         */
1631        public CE insertIndication(int rep) throws HL7Exception { 
1632            return (CE) super.insertRepetition(19, rep);
1633        }
1634    
1635    
1636    
1637        /**
1638         * Inserts a repetition of
1639         * RXA-19: "Indication" at a specific index
1640         *
1641         * @param rep The repetition index (0-indexed)
1642         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1643         */
1644        public CE insertRxa19_Indication(int rep) throws HL7Exception { 
1645            return (CE) super.insertRepetition(19, rep);
1646        }
1647    
1648    
1649        /**
1650         * Removes a repetition of
1651         * RXA-19: "Indication" at a specific index
1652         *
1653         * @param rep The repetition index (0-indexed)
1654         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1655         */
1656        public CE removeIndication(int rep) throws HL7Exception { 
1657            return (CE) super.removeRepetition(19, rep);
1658        }
1659    
1660    
1661        /**
1662         * Removes a repetition of
1663         * RXA-19: "Indication" at a specific index
1664         *
1665         * @param rep The repetition index (0-indexed)
1666         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1667         */
1668        public CE removeRxa19_Indication(int rep) throws HL7Exception { 
1669            return (CE) super.removeRepetition(19, rep);
1670        }
1671    
1672    
1673    
1674    
1675        /**
1676         * Returns
1677         * RXA-20: "Completion Status" - creates it if necessary
1678         */
1679        public ID getCompletionStatus() { 
1680            ID ret = null;
1681            try {
1682                Type t = this.getField(20, 0);
1683                ret = (ID)t;
1684            } catch (ClassCastException cce) {
1685                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1686                throw new RuntimeException(cce);
1687            } catch (HL7Exception he) {
1688                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1689                throw new RuntimeException(he);
1690            }
1691            return ret;
1692        }
1693    
1694    
1695        /**
1696         * Returns
1697         * RXA-20: "Completion Status" - creates it if necessary
1698         */
1699        public ID getRxa20_CompletionStatus() { 
1700            ID ret = null;
1701            try {
1702                Type t = this.getField(20, 0);
1703                ret = (ID)t;
1704            } catch (ClassCastException cce) {
1705                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1706                throw new RuntimeException(cce);
1707            } catch (HL7Exception he) {
1708                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1709                throw new RuntimeException(he);
1710            }
1711            return ret;
1712        }
1713    
1714    
1715    
1716        /**
1717         * Returns
1718         * RXA-21: "Action Code-RXA" - creates it if necessary
1719         */
1720        public ID getActionCodeRXA() { 
1721            ID ret = null;
1722            try {
1723                Type t = this.getField(21, 0);
1724                ret = (ID)t;
1725            } catch (ClassCastException cce) {
1726                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1727                throw new RuntimeException(cce);
1728            } catch (HL7Exception he) {
1729                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1730                throw new RuntimeException(he);
1731            }
1732            return ret;
1733        }
1734    
1735    
1736        /**
1737         * Returns
1738         * RXA-21: "Action Code-RXA" - creates it if necessary
1739         */
1740        public ID getRxa21_ActionCodeRXA() { 
1741            ID ret = null;
1742            try {
1743                Type t = this.getField(21, 0);
1744                ret = (ID)t;
1745            } catch (ClassCastException cce) {
1746                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1747                throw new RuntimeException(cce);
1748            } catch (HL7Exception he) {
1749                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1750                throw new RuntimeException(he);
1751            }
1752            return ret;
1753        }
1754    
1755    
1756    
1757        /**
1758         * Returns
1759         * RXA-22: "System Entry Date/Time" - creates it if necessary
1760         */
1761        public TS getSystemEntryDateTime() { 
1762            TS ret = null;
1763            try {
1764                Type t = this.getField(22, 0);
1765                ret = (TS)t;
1766            } catch (ClassCastException cce) {
1767                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1768                throw new RuntimeException(cce);
1769            } catch (HL7Exception he) {
1770                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1771                throw new RuntimeException(he);
1772            }
1773            return ret;
1774        }
1775    
1776    
1777        /**
1778         * Returns
1779         * RXA-22: "System Entry Date/Time" - creates it if necessary
1780         */
1781        public TS getRxa22_SystemEntryDateTime() { 
1782            TS ret = null;
1783            try {
1784                Type t = this.getField(22, 0);
1785                ret = (TS)t;
1786            } catch (ClassCastException cce) {
1787                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1788                throw new RuntimeException(cce);
1789            } catch (HL7Exception he) {
1790                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1791                throw new RuntimeException(he);
1792            }
1793            return ret;
1794        }
1795    
1796    
1797    
1798    
1799    
1800        /** {@inheritDoc} */   
1801        protected Type createNewTypeWithoutReflection(int field) {
1802           switch (field) {
1803              case 0: return new NM(getMessage());
1804              case 1: return new NM(getMessage());
1805              case 2: return new TS(getMessage());
1806              case 3: return new TS(getMessage());
1807              case 4: return new CE(getMessage());
1808              case 5: return new NM(getMessage());
1809              case 6: return new CE(getMessage());
1810              case 7: return new CE(getMessage());
1811              case 8: return new CE(getMessage());
1812              case 9: return new XCN(getMessage());
1813              case 10: return new LA2(getMessage());
1814              case 11: return new ST(getMessage());
1815              case 12: return new NM(getMessage());
1816              case 13: return new CE(getMessage());
1817              case 14: return new ST(getMessage());
1818              case 15: return new TS(getMessage());
1819              case 16: return new CE(getMessage());
1820              case 17: return new CE(getMessage());
1821              case 18: return new CE(getMessage());
1822              case 19: return new ID(getMessage(), new Integer( 322 ));
1823              case 20: return new ID(getMessage(), new Integer( 323 ));
1824              case 21: return new TS(getMessage());
1825              default: return null;
1826           }
1827       }
1828    
1829    
1830    }
1831