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 AIG message segment (Appointment Information - General Resource). 
024     * This segment has the following fields:</p>
025     * <ul>
026         * <li>AIG-1: Set ID - AIG (SI) <b> </b>
027         * <li>AIG-2: Segment Action Code (ID) <b>optional </b>
028         * <li>AIG-3: Resource ID (CE) <b>optional </b>
029         * <li>AIG-4: Resource Type (CE) <b> </b>
030         * <li>AIG-5: Resource Group (CE) <b>optional repeating</b>
031         * <li>AIG-6: Resource Quantity (NM) <b>optional </b>
032         * <li>AIG-7: Resource Quantity Units (CE) <b>optional </b>
033         * <li>AIG-8: Start Date/Time (TS) <b>optional </b>
034         * <li>AIG-9: Start Date/Time Offset (NM) <b>optional </b>
035         * <li>AIG-10: Start Date/Time Offset Units (CE) <b>optional </b>
036         * <li>AIG-11: Duration (NM) <b>optional </b>
037         * <li>AIG-12: Duration Units (CE) <b>optional </b>
038         * <li>AIG-13: Allow Substitution Code (IS) <b>optional </b>
039         * <li>AIG-14: Filler Status Code (CE) <b>optional </b>
040     * </ul>
041     */
042    public class AIG extends AbstractSegment {
043    
044        /** 
045         * Creates a new AIG segment
046         */
047        public AIG(Group parent, ModelClassFactory factory) {
048           super(parent, factory);
049           init(factory);
050        }
051    
052        private void init(ModelClassFactory factory) {
053           try {
054                                      this.add(SI.class, true, 1, 4, new Object[]{ getMessage(), new Integer(0) }, "Set ID - AIG");
055                                      this.add(ID.class, false, 1, 3, new Object[]{ getMessage() }, "Segment Action Code");
056                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Resource ID");
057                                      this.add(CE.class, true, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Resource Type");
058                                      this.add(CE.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Resource Group");
059                                      this.add(NM.class, false, 1, 5, new Object[]{ getMessage(), new Integer(0) }, "Resource Quantity");
060                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Resource Quantity Units");
061                                      this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Start Date/Time");
062                                      this.add(NM.class, false, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "Start Date/Time Offset");
063                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Start Date/Time Offset Units");
064                                      this.add(NM.class, false, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "Duration");
065                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Duration Units");
066                                      this.add(IS.class, false, 1, 10, new Object[]{ getMessage() }, "Allow Substitution Code");
067                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(278) }, "Filler Status Code");
068           } catch(HL7Exception e) {
069              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating AIG - this is probably a bug in the source code generator.", e);
070           }
071        }
072    
073    
074    
075        /**
076         * Returns
077         * AIG-1: "Set ID - AIG" - creates it if necessary
078         */
079        public SI getSetIDAIG() { 
080            SI ret = null;
081            try {
082                Type t = this.getField(1, 0);
083                ret = (SI)t;
084            } catch (ClassCastException cce) {
085                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
086                throw new RuntimeException(cce);
087            } catch (HL7Exception he) {
088                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
089                throw new RuntimeException(he);
090            }
091            return ret;
092        }
093    
094    
095        /**
096         * Returns
097         * AIG-1: "Set ID - AIG" - creates it if necessary
098         */
099        public SI getAig1_SetIDAIG() { 
100            SI ret = null;
101            try {
102                Type t = this.getField(1, 0);
103                ret = (SI)t;
104            } catch (ClassCastException cce) {
105                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
106                throw new RuntimeException(cce);
107            } catch (HL7Exception he) {
108                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
109                throw new RuntimeException(he);
110            }
111            return ret;
112        }
113    
114    
115    
116        /**
117         * Returns
118         * AIG-2: "Segment Action Code" - creates it if necessary
119         */
120        public ID getSegmentActionCode() { 
121            ID ret = null;
122            try {
123                Type t = this.getField(2, 0);
124                ret = (ID)t;
125            } catch (ClassCastException cce) {
126                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
127                throw new RuntimeException(cce);
128            } catch (HL7Exception he) {
129                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
130                throw new RuntimeException(he);
131            }
132            return ret;
133        }
134    
135    
136        /**
137         * Returns
138         * AIG-2: "Segment Action Code" - creates it if necessary
139         */
140        public ID getAig2_SegmentActionCode() { 
141            ID ret = null;
142            try {
143                Type t = this.getField(2, 0);
144                ret = (ID)t;
145            } catch (ClassCastException cce) {
146                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
147                throw new RuntimeException(cce);
148            } catch (HL7Exception he) {
149                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
150                throw new RuntimeException(he);
151            }
152            return ret;
153        }
154    
155    
156    
157        /**
158         * Returns
159         * AIG-3: "Resource ID" - creates it if necessary
160         */
161        public CE getResourceID() { 
162            CE ret = null;
163            try {
164                Type t = this.getField(3, 0);
165                ret = (CE)t;
166            } catch (ClassCastException cce) {
167                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
168                throw new RuntimeException(cce);
169            } catch (HL7Exception he) {
170                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
171                throw new RuntimeException(he);
172            }
173            return ret;
174        }
175    
176    
177        /**
178         * Returns
179         * AIG-3: "Resource ID" - creates it if necessary
180         */
181        public CE getAig3_ResourceID() { 
182            CE ret = null;
183            try {
184                Type t = this.getField(3, 0);
185                ret = (CE)t;
186            } catch (ClassCastException cce) {
187                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
188                throw new RuntimeException(cce);
189            } catch (HL7Exception he) {
190                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
191                throw new RuntimeException(he);
192            }
193            return ret;
194        }
195    
196    
197    
198        /**
199         * Returns
200         * AIG-4: "Resource Type" - creates it if necessary
201         */
202        public CE getResourceType() { 
203            CE ret = null;
204            try {
205                Type t = this.getField(4, 0);
206                ret = (CE)t;
207            } catch (ClassCastException cce) {
208                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
209                throw new RuntimeException(cce);
210            } catch (HL7Exception he) {
211                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
212                throw new RuntimeException(he);
213            }
214            return ret;
215        }
216    
217    
218        /**
219         * Returns
220         * AIG-4: "Resource Type" - creates it if necessary
221         */
222        public CE getAig4_ResourceType() { 
223            CE ret = null;
224            try {
225                Type t = this.getField(4, 0);
226                ret = (CE)t;
227            } catch (ClassCastException cce) {
228                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
229                throw new RuntimeException(cce);
230            } catch (HL7Exception he) {
231                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
232                throw new RuntimeException(he);
233            }
234            return ret;
235        }
236    
237    
238        /**
239         * Returns all repetitions of Resource Group (AIG-5).
240         */
241        public CE[] getResourceGroup() {
242            CE[] ret = null;
243            try {
244                Type[] t = this.getField(5);  
245                ret = new CE[t.length];
246                for (int i = 0; i < ret.length; i++) {
247                    ret[i] = (CE)t[i];
248                }
249            } catch (ClassCastException cce) {
250                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
251                throw new RuntimeException(cce);
252            } catch (HL7Exception he) {
253                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
254                throw new RuntimeException(he);
255            }
256            return ret;
257        }
258    
259    
260        /**
261         * Returns a count of the current number of repetitions of Resource Group (AIG-5).
262         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
263         * it will return zero.
264         */
265        public int getResourceGroupReps() {
266            CE[] ret = null;
267            try {
268                Type[] t = this.getField(5);
269                return t.length;  
270            } catch (ClassCastException cce) {
271                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
272                throw new RuntimeException(cce);
273            } catch (HL7Exception he) {
274                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
275                throw new RuntimeException(he);
276            }
277        }
278    
279    
280        /**
281         * Returns a specific repetition of
282         * AIG-5: "Resource Group" - creates it if necessary
283         *
284         * @param rep The repetition index (0-indexed)
285         */
286        public CE getResourceGroup(int rep) { 
287            CE ret = null;
288            try {
289                Type t = this.getField(5, rep);
290                ret = (CE)t;
291            } catch (ClassCastException cce) {
292                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
293                throw new RuntimeException(cce);
294            } catch (HL7Exception he) {
295                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
296                throw new RuntimeException(he);
297            }
298            return ret;
299        }
300    
301        /**
302         * Returns a specific repetition of
303         * AIG-5: "Resource Group" - creates it if necessary
304         *
305         * @param rep The repetition index (0-indexed)
306         */
307        public CE getAig5_ResourceGroup(int rep) { 
308            CE ret = null;
309            try {
310                Type t = this.getField(5, rep);
311                ret = (CE)t;
312            } catch (ClassCastException cce) {
313                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
314                throw new RuntimeException(cce);
315            } catch (HL7Exception he) {
316                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
317                throw new RuntimeException(he);
318            }
319            return ret;
320        }
321    
322    
323        /**
324         * Returns a count of the current number of repetitions of Resource Group (AIG-5).
325         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
326         * it will return zero.
327         */
328        public int getAig5_ResourceGroupReps() {
329            CE[] ret = null;
330            try {
331                Type[] t = this.getField(5);
332                return t.length;  
333            } catch (ClassCastException cce) {
334                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
335                throw new RuntimeException(cce);
336            } catch (HL7Exception he) {
337                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
338                throw new RuntimeException(he);
339            }
340        }
341    
342    
343    
344        /**
345         * Inserts a repetition of
346         * AIG-5: "Resource Group" at a specific index
347         *
348         * @param rep The repetition index (0-indexed)
349         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
350         */
351        public CE insertResourceGroup(int rep) throws HL7Exception { 
352            return (CE) super.insertRepetition(5, rep);
353        }
354    
355    
356    
357        /**
358         * Inserts a repetition of
359         * AIG-5: "Resource Group" at a specific index
360         *
361         * @param rep The repetition index (0-indexed)
362         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
363         */
364        public CE insertAig5_ResourceGroup(int rep) throws HL7Exception { 
365            return (CE) super.insertRepetition(5, rep);
366        }
367    
368    
369        /**
370         * Removes a repetition of
371         * AIG-5: "Resource Group" at a specific index
372         *
373         * @param rep The repetition index (0-indexed)
374         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
375         */
376        public CE removeResourceGroup(int rep) throws HL7Exception { 
377            return (CE) super.removeRepetition(5, rep);
378        }
379    
380    
381        /**
382         * Removes a repetition of
383         * AIG-5: "Resource Group" at a specific index
384         *
385         * @param rep The repetition index (0-indexed)
386         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
387         */
388        public CE removeAig5_ResourceGroup(int rep) throws HL7Exception { 
389            return (CE) super.removeRepetition(5, rep);
390        }
391    
392    
393    
394    
395        /**
396         * Returns
397         * AIG-6: "Resource Quantity" - creates it if necessary
398         */
399        public NM getResourceQuantity() { 
400            NM ret = null;
401            try {
402                Type t = this.getField(6, 0);
403                ret = (NM)t;
404            } catch (ClassCastException cce) {
405                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
406                throw new RuntimeException(cce);
407            } catch (HL7Exception he) {
408                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
409                throw new RuntimeException(he);
410            }
411            return ret;
412        }
413    
414    
415        /**
416         * Returns
417         * AIG-6: "Resource Quantity" - creates it if necessary
418         */
419        public NM getAig6_ResourceQuantity() { 
420            NM ret = null;
421            try {
422                Type t = this.getField(6, 0);
423                ret = (NM)t;
424            } catch (ClassCastException cce) {
425                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
426                throw new RuntimeException(cce);
427            } catch (HL7Exception he) {
428                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
429                throw new RuntimeException(he);
430            }
431            return ret;
432        }
433    
434    
435    
436        /**
437         * Returns
438         * AIG-7: "Resource Quantity Units" - creates it if necessary
439         */
440        public CE getResourceQuantityUnits() { 
441            CE ret = null;
442            try {
443                Type t = this.getField(7, 0);
444                ret = (CE)t;
445            } catch (ClassCastException cce) {
446                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
447                throw new RuntimeException(cce);
448            } catch (HL7Exception he) {
449                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
450                throw new RuntimeException(he);
451            }
452            return ret;
453        }
454    
455    
456        /**
457         * Returns
458         * AIG-7: "Resource Quantity Units" - creates it if necessary
459         */
460        public CE getAig7_ResourceQuantityUnits() { 
461            CE ret = null;
462            try {
463                Type t = this.getField(7, 0);
464                ret = (CE)t;
465            } catch (ClassCastException cce) {
466                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
467                throw new RuntimeException(cce);
468            } catch (HL7Exception he) {
469                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
470                throw new RuntimeException(he);
471            }
472            return ret;
473        }
474    
475    
476    
477        /**
478         * Returns
479         * AIG-8: "Start Date/Time" - creates it if necessary
480         */
481        public TS getStartDateTime() { 
482            TS ret = null;
483            try {
484                Type t = this.getField(8, 0);
485                ret = (TS)t;
486            } catch (ClassCastException cce) {
487                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
488                throw new RuntimeException(cce);
489            } catch (HL7Exception he) {
490                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
491                throw new RuntimeException(he);
492            }
493            return ret;
494        }
495    
496    
497        /**
498         * Returns
499         * AIG-8: "Start Date/Time" - creates it if necessary
500         */
501        public TS getAig8_StartDateTime() { 
502            TS ret = null;
503            try {
504                Type t = this.getField(8, 0);
505                ret = (TS)t;
506            } catch (ClassCastException cce) {
507                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
508                throw new RuntimeException(cce);
509            } catch (HL7Exception he) {
510                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
511                throw new RuntimeException(he);
512            }
513            return ret;
514        }
515    
516    
517    
518        /**
519         * Returns
520         * AIG-9: "Start Date/Time Offset" - creates it if necessary
521         */
522        public NM getStartDateTimeOffset() { 
523            NM ret = null;
524            try {
525                Type t = this.getField(9, 0);
526                ret = (NM)t;
527            } catch (ClassCastException cce) {
528                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
529                throw new RuntimeException(cce);
530            } catch (HL7Exception he) {
531                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
532                throw new RuntimeException(he);
533            }
534            return ret;
535        }
536    
537    
538        /**
539         * Returns
540         * AIG-9: "Start Date/Time Offset" - creates it if necessary
541         */
542        public NM getAig9_StartDateTimeOffset() { 
543            NM ret = null;
544            try {
545                Type t = this.getField(9, 0);
546                ret = (NM)t;
547            } catch (ClassCastException cce) {
548                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
549                throw new RuntimeException(cce);
550            } catch (HL7Exception he) {
551                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
552                throw new RuntimeException(he);
553            }
554            return ret;
555        }
556    
557    
558    
559        /**
560         * Returns
561         * AIG-10: "Start Date/Time Offset Units" - creates it if necessary
562         */
563        public CE getStartDateTimeOffsetUnits() { 
564            CE ret = null;
565            try {
566                Type t = this.getField(10, 0);
567                ret = (CE)t;
568            } catch (ClassCastException cce) {
569                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
570                throw new RuntimeException(cce);
571            } catch (HL7Exception he) {
572                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
573                throw new RuntimeException(he);
574            }
575            return ret;
576        }
577    
578    
579        /**
580         * Returns
581         * AIG-10: "Start Date/Time Offset Units" - creates it if necessary
582         */
583        public CE getAig10_StartDateTimeOffsetUnits() { 
584            CE ret = null;
585            try {
586                Type t = this.getField(10, 0);
587                ret = (CE)t;
588            } catch (ClassCastException cce) {
589                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
590                throw new RuntimeException(cce);
591            } catch (HL7Exception he) {
592                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
593                throw new RuntimeException(he);
594            }
595            return ret;
596        }
597    
598    
599    
600        /**
601         * Returns
602         * AIG-11: "Duration" - creates it if necessary
603         */
604        public NM getDuration() { 
605            NM ret = null;
606            try {
607                Type t = this.getField(11, 0);
608                ret = (NM)t;
609            } catch (ClassCastException cce) {
610                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
611                throw new RuntimeException(cce);
612            } catch (HL7Exception he) {
613                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
614                throw new RuntimeException(he);
615            }
616            return ret;
617        }
618    
619    
620        /**
621         * Returns
622         * AIG-11: "Duration" - creates it if necessary
623         */
624        public NM getAig11_Duration() { 
625            NM ret = null;
626            try {
627                Type t = this.getField(11, 0);
628                ret = (NM)t;
629            } catch (ClassCastException cce) {
630                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
631                throw new RuntimeException(cce);
632            } catch (HL7Exception he) {
633                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
634                throw new RuntimeException(he);
635            }
636            return ret;
637        }
638    
639    
640    
641        /**
642         * Returns
643         * AIG-12: "Duration Units" - creates it if necessary
644         */
645        public CE getDurationUnits() { 
646            CE ret = null;
647            try {
648                Type t = this.getField(12, 0);
649                ret = (CE)t;
650            } catch (ClassCastException cce) {
651                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
652                throw new RuntimeException(cce);
653            } catch (HL7Exception he) {
654                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
655                throw new RuntimeException(he);
656            }
657            return ret;
658        }
659    
660    
661        /**
662         * Returns
663         * AIG-12: "Duration Units" - creates it if necessary
664         */
665        public CE getAig12_DurationUnits() { 
666            CE ret = null;
667            try {
668                Type t = this.getField(12, 0);
669                ret = (CE)t;
670            } catch (ClassCastException cce) {
671                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
672                throw new RuntimeException(cce);
673            } catch (HL7Exception he) {
674                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
675                throw new RuntimeException(he);
676            }
677            return ret;
678        }
679    
680    
681    
682        /**
683         * Returns
684         * AIG-13: "Allow Substitution Code" - creates it if necessary
685         */
686        public IS getAllowSubstitutionCode() { 
687            IS ret = null;
688            try {
689                Type t = this.getField(13, 0);
690                ret = (IS)t;
691            } catch (ClassCastException cce) {
692                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
693                throw new RuntimeException(cce);
694            } catch (HL7Exception he) {
695                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
696                throw new RuntimeException(he);
697            }
698            return ret;
699        }
700    
701    
702        /**
703         * Returns
704         * AIG-13: "Allow Substitution Code" - creates it if necessary
705         */
706        public IS getAig13_AllowSubstitutionCode() { 
707            IS ret = null;
708            try {
709                Type t = this.getField(13, 0);
710                ret = (IS)t;
711            } catch (ClassCastException cce) {
712                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
713                throw new RuntimeException(cce);
714            } catch (HL7Exception he) {
715                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
716                throw new RuntimeException(he);
717            }
718            return ret;
719        }
720    
721    
722    
723        /**
724         * Returns
725         * AIG-14: "Filler Status Code" - creates it if necessary
726         */
727        public CE getFillerStatusCode() { 
728            CE ret = null;
729            try {
730                Type t = this.getField(14, 0);
731                ret = (CE)t;
732            } catch (ClassCastException cce) {
733                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
734                throw new RuntimeException(cce);
735            } catch (HL7Exception he) {
736                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
737                throw new RuntimeException(he);
738            }
739            return ret;
740        }
741    
742    
743        /**
744         * Returns
745         * AIG-14: "Filler Status Code" - creates it if necessary
746         */
747        public CE getAig14_FillerStatusCode() { 
748            CE ret = null;
749            try {
750                Type t = this.getField(14, 0);
751                ret = (CE)t;
752            } catch (ClassCastException cce) {
753                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
754                throw new RuntimeException(cce);
755            } catch (HL7Exception he) {
756                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
757                throw new RuntimeException(he);
758            }
759            return ret;
760        }
761    
762    
763    
764    
765    
766        /** {@inheritDoc} */   
767        protected Type createNewTypeWithoutReflection(int field) {
768           switch (field) {
769              case 0: return new SI(getMessage());
770              case 1: return new ID(getMessage(), new Integer( 206 ));
771              case 2: return new CE(getMessage());
772              case 3: return new CE(getMessage());
773              case 4: return new CE(getMessage());
774              case 5: return new NM(getMessage());
775              case 6: return new CE(getMessage());
776              case 7: return new TS(getMessage());
777              case 8: return new NM(getMessage());
778              case 9: return new CE(getMessage());
779              case 10: return new NM(getMessage());
780              case 11: return new CE(getMessage());
781              case 12: return new IS(getMessage(), new Integer( 279 ));
782              case 13: return new CE(getMessage());
783              default: return null;
784           }
785       }
786    
787    
788    }
789