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.v231.segment;
009    
010    // import ca.uhn.hl7v2.model.v231.group.*;
011    import ca.uhn.hl7v2.model.v231.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 PRA message segment (PRA - practitioner detail segment). 
024     * This segment has the following fields:</p>
025     * <ul>
026         * <li>PRA-1: Primary Key Value - PRA (CE) <b> </b>
027         * <li>PRA-2: Practitioner Group (CE) <b>optional repeating</b>
028         * <li>PRA-3: Practitioner Category (IS) <b>optional repeating</b>
029         * <li>PRA-4: Provider Billing (ID) <b>optional </b>
030         * <li>PRA-5: Specialty (SPD) <b>optional repeating</b>
031         * <li>PRA-6: Practitioner ID Numbers (PLN) <b>optional repeating</b>
032         * <li>PRA-7: Privileges (PIP) <b>optional repeating</b>
033         * <li>PRA-8: Date Entered Practice (DT) <b>optional </b>
034     * </ul>
035     */
036    public class PRA extends AbstractSegment {
037    
038        /** 
039         * Creates a new PRA segment
040         */
041        public PRA(Group parent, ModelClassFactory factory) {
042           super(parent, factory);
043           init(factory);
044        }
045    
046        private void init(ModelClassFactory factory) {
047           try {
048                                      this.add(CE.class, true, 1, 60, new Object[]{ getMessage(), new Integer(0) }, "Primary Key Value - PRA");
049                                      this.add(CE.class, false, 0, 60, new Object[]{ getMessage(), new Integer(358) }, "Practitioner Group");
050                                      this.add(IS.class, false, 0, 3, new Object[]{ getMessage() }, "Practitioner Category");
051                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Provider Billing");
052                                      this.add(SPD.class, false, 0, 100, new Object[]{ getMessage(), new Integer(337) }, "Specialty");
053                                      this.add(PLN.class, false, 0, 100, new Object[]{ getMessage(), new Integer(338) }, "Practitioner ID Numbers");
054                                      this.add(PIP.class, false, 0, 200, new Object[]{ getMessage(), new Integer(0) }, "Privileges");
055                                      this.add(DT.class, false, 1, 8, new Object[]{ getMessage(), new Integer(0) }, "Date Entered Practice");
056           } catch(HL7Exception e) {
057              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating PRA - this is probably a bug in the source code generator.", e);
058           }
059        }
060    
061    
062    
063        /**
064         * Returns
065         * PRA-1: "Primary Key Value - PRA" - creates it if necessary
066         */
067        public CE getPrimaryKeyValuePRA() { 
068            CE ret = null;
069            try {
070                Type t = this.getField(1, 0);
071                ret = (CE)t;
072            } catch (ClassCastException cce) {
073                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
074                throw new RuntimeException(cce);
075            } catch (HL7Exception he) {
076                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
077                throw new RuntimeException(he);
078            }
079            return ret;
080        }
081    
082    
083        /**
084         * Returns
085         * PRA-1: "Primary Key Value - PRA" - creates it if necessary
086         */
087        public CE getPra1_PrimaryKeyValuePRA() { 
088            CE ret = null;
089            try {
090                Type t = this.getField(1, 0);
091                ret = (CE)t;
092            } catch (ClassCastException cce) {
093                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
094                throw new RuntimeException(cce);
095            } catch (HL7Exception he) {
096                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
097                throw new RuntimeException(he);
098            }
099            return ret;
100        }
101    
102    
103        /**
104         * Returns all repetitions of Practitioner Group (PRA-2).
105         */
106        public CE[] getPractitionerGroup() {
107            CE[] ret = null;
108            try {
109                Type[] t = this.getField(2);  
110                ret = new CE[t.length];
111                for (int i = 0; i < ret.length; i++) {
112                    ret[i] = (CE)t[i];
113                }
114            } catch (ClassCastException cce) {
115                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
116                throw new RuntimeException(cce);
117            } catch (HL7Exception he) {
118                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
119                throw new RuntimeException(he);
120            }
121            return ret;
122        }
123    
124    
125        /**
126         * Returns a count of the current number of repetitions of Practitioner Group (PRA-2).
127         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
128         * it will return zero.
129         */
130        public int getPractitionerGroupReps() {
131            CE[] ret = null;
132            try {
133                Type[] t = this.getField(2);
134                return t.length;  
135            } catch (ClassCastException cce) {
136                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
137                throw new RuntimeException(cce);
138            } catch (HL7Exception he) {
139                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
140                throw new RuntimeException(he);
141            }
142        }
143    
144    
145        /**
146         * Returns a specific repetition of
147         * PRA-2: "Practitioner Group" - creates it if necessary
148         *
149         * @param rep The repetition index (0-indexed)
150         */
151        public CE getPractitionerGroup(int rep) { 
152            CE ret = null;
153            try {
154                Type t = this.getField(2, rep);
155                ret = (CE)t;
156            } catch (ClassCastException cce) {
157                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
158                throw new RuntimeException(cce);
159            } catch (HL7Exception he) {
160                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
161                throw new RuntimeException(he);
162            }
163            return ret;
164        }
165    
166        /**
167         * Returns a specific repetition of
168         * PRA-2: "Practitioner Group" - creates it if necessary
169         *
170         * @param rep The repetition index (0-indexed)
171         */
172        public CE getPra2_PractitionerGroup(int rep) { 
173            CE ret = null;
174            try {
175                Type t = this.getField(2, rep);
176                ret = (CE)t;
177            } catch (ClassCastException cce) {
178                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
179                throw new RuntimeException(cce);
180            } catch (HL7Exception he) {
181                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
182                throw new RuntimeException(he);
183            }
184            return ret;
185        }
186    
187    
188        /**
189         * Returns a count of the current number of repetitions of Practitioner Group (PRA-2).
190         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
191         * it will return zero.
192         */
193        public int getPra2_PractitionerGroupReps() {
194            CE[] ret = null;
195            try {
196                Type[] t = this.getField(2);
197                return t.length;  
198            } catch (ClassCastException cce) {
199                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
200                throw new RuntimeException(cce);
201            } catch (HL7Exception he) {
202                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
203                throw new RuntimeException(he);
204            }
205        }
206    
207    
208    
209        /**
210         * Inserts a repetition of
211         * PRA-2: "Practitioner Group" at a specific index
212         *
213         * @param rep The repetition index (0-indexed)
214         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
215         */
216        public CE insertPractitionerGroup(int rep) throws HL7Exception { 
217            return (CE) super.insertRepetition(2, rep);
218        }
219    
220    
221    
222        /**
223         * Inserts a repetition of
224         * PRA-2: "Practitioner Group" at a specific index
225         *
226         * @param rep The repetition index (0-indexed)
227         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
228         */
229        public CE insertPra2_PractitionerGroup(int rep) throws HL7Exception { 
230            return (CE) super.insertRepetition(2, rep);
231        }
232    
233    
234        /**
235         * Removes a repetition of
236         * PRA-2: "Practitioner Group" at a specific index
237         *
238         * @param rep The repetition index (0-indexed)
239         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
240         */
241        public CE removePractitionerGroup(int rep) throws HL7Exception { 
242            return (CE) super.removeRepetition(2, rep);
243        }
244    
245    
246        /**
247         * Removes a repetition of
248         * PRA-2: "Practitioner Group" at a specific index
249         *
250         * @param rep The repetition index (0-indexed)
251         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
252         */
253        public CE removePra2_PractitionerGroup(int rep) throws HL7Exception { 
254            return (CE) super.removeRepetition(2, rep);
255        }
256    
257    
258    
259        /**
260         * Returns all repetitions of Practitioner Category (PRA-3).
261         */
262        public IS[] getPractitionerCategory() {
263            IS[] ret = null;
264            try {
265                Type[] t = this.getField(3);  
266                ret = new IS[t.length];
267                for (int i = 0; i < ret.length; i++) {
268                    ret[i] = (IS)t[i];
269                }
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            return ret;
278        }
279    
280    
281        /**
282         * Returns a count of the current number of repetitions of Practitioner Category (PRA-3).
283         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
284         * it will return zero.
285         */
286        public int getPractitionerCategoryReps() {
287            IS[] ret = null;
288            try {
289                Type[] t = this.getField(3);
290                return t.length;  
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        }
299    
300    
301        /**
302         * Returns a specific repetition of
303         * PRA-3: "Practitioner Category" - creates it if necessary
304         *
305         * @param rep The repetition index (0-indexed)
306         */
307        public IS getPractitionerCategory(int rep) { 
308            IS ret = null;
309            try {
310                Type t = this.getField(3, rep);
311                ret = (IS)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         * Returns a specific repetition of
324         * PRA-3: "Practitioner Category" - creates it if necessary
325         *
326         * @param rep The repetition index (0-indexed)
327         */
328        public IS getPra3_PractitionerCategory(int rep) { 
329            IS ret = null;
330            try {
331                Type t = this.getField(3, rep);
332                ret = (IS)t;
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            return ret;
341        }
342    
343    
344        /**
345         * Returns a count of the current number of repetitions of Practitioner Category (PRA-3).
346         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
347         * it will return zero.
348         */
349        public int getPra3_PractitionerCategoryReps() {
350            IS[] ret = null;
351            try {
352                Type[] t = this.getField(3);
353                return t.length;  
354            } catch (ClassCastException cce) {
355                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
356                throw new RuntimeException(cce);
357            } catch (HL7Exception he) {
358                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
359                throw new RuntimeException(he);
360            }
361        }
362    
363    
364    
365        /**
366         * Inserts a repetition of
367         * PRA-3: "Practitioner Category" at a specific index
368         *
369         * @param rep The repetition index (0-indexed)
370         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
371         */
372        public IS insertPractitionerCategory(int rep) throws HL7Exception { 
373            return (IS) super.insertRepetition(3, rep);
374        }
375    
376    
377    
378        /**
379         * Inserts a repetition of
380         * PRA-3: "Practitioner Category" at a specific index
381         *
382         * @param rep The repetition index (0-indexed)
383         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
384         */
385        public IS insertPra3_PractitionerCategory(int rep) throws HL7Exception { 
386            return (IS) super.insertRepetition(3, rep);
387        }
388    
389    
390        /**
391         * Removes a repetition of
392         * PRA-3: "Practitioner Category" at a specific index
393         *
394         * @param rep The repetition index (0-indexed)
395         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
396         */
397        public IS removePractitionerCategory(int rep) throws HL7Exception { 
398            return (IS) super.removeRepetition(3, rep);
399        }
400    
401    
402        /**
403         * Removes a repetition of
404         * PRA-3: "Practitioner Category" at a specific index
405         *
406         * @param rep The repetition index (0-indexed)
407         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
408         */
409        public IS removePra3_PractitionerCategory(int rep) throws HL7Exception { 
410            return (IS) super.removeRepetition(3, rep);
411        }
412    
413    
414    
415    
416        /**
417         * Returns
418         * PRA-4: "Provider Billing" - creates it if necessary
419         */
420        public ID getProviderBilling() { 
421            ID ret = null;
422            try {
423                Type t = this.getField(4, 0);
424                ret = (ID)t;
425            } catch (ClassCastException cce) {
426                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
427                throw new RuntimeException(cce);
428            } catch (HL7Exception he) {
429                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
430                throw new RuntimeException(he);
431            }
432            return ret;
433        }
434    
435    
436        /**
437         * Returns
438         * PRA-4: "Provider Billing" - creates it if necessary
439         */
440        public ID getPra4_ProviderBilling() { 
441            ID ret = null;
442            try {
443                Type t = this.getField(4, 0);
444                ret = (ID)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 all repetitions of Specialty (PRA-5).
458         */
459        public SPD[] getSpecialty() {
460            SPD[] ret = null;
461            try {
462                Type[] t = this.getField(5);  
463                ret = new SPD[t.length];
464                for (int i = 0; i < ret.length; i++) {
465                    ret[i] = (SPD)t[i];
466                }
467            } catch (ClassCastException cce) {
468                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
469                throw new RuntimeException(cce);
470            } catch (HL7Exception he) {
471                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
472                throw new RuntimeException(he);
473            }
474            return ret;
475        }
476    
477    
478        /**
479         * Returns a count of the current number of repetitions of Specialty (PRA-5).
480         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
481         * it will return zero.
482         */
483        public int getSpecialtyReps() {
484            SPD[] ret = null;
485            try {
486                Type[] t = this.getField(5);
487                return t.length;  
488            } catch (ClassCastException cce) {
489                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
490                throw new RuntimeException(cce);
491            } catch (HL7Exception he) {
492                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
493                throw new RuntimeException(he);
494            }
495        }
496    
497    
498        /**
499         * Returns a specific repetition of
500         * PRA-5: "Specialty" - creates it if necessary
501         *
502         * @param rep The repetition index (0-indexed)
503         */
504        public SPD getSpecialty(int rep) { 
505            SPD ret = null;
506            try {
507                Type t = this.getField(5, rep);
508                ret = (SPD)t;
509            } catch (ClassCastException cce) {
510                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
511                throw new RuntimeException(cce);
512            } catch (HL7Exception he) {
513                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
514                throw new RuntimeException(he);
515            }
516            return ret;
517        }
518    
519        /**
520         * Returns a specific repetition of
521         * PRA-5: "Specialty" - creates it if necessary
522         *
523         * @param rep The repetition index (0-indexed)
524         */
525        public SPD getPra5_Specialty(int rep) { 
526            SPD ret = null;
527            try {
528                Type t = this.getField(5, rep);
529                ret = (SPD)t;
530            } catch (ClassCastException cce) {
531                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
532                throw new RuntimeException(cce);
533            } catch (HL7Exception he) {
534                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
535                throw new RuntimeException(he);
536            }
537            return ret;
538        }
539    
540    
541        /**
542         * Returns a count of the current number of repetitions of Specialty (PRA-5).
543         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
544         * it will return zero.
545         */
546        public int getPra5_SpecialtyReps() {
547            SPD[] ret = null;
548            try {
549                Type[] t = this.getField(5);
550                return t.length;  
551            } catch (ClassCastException cce) {
552                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
553                throw new RuntimeException(cce);
554            } catch (HL7Exception he) {
555                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
556                throw new RuntimeException(he);
557            }
558        }
559    
560    
561    
562        /**
563         * Inserts a repetition of
564         * PRA-5: "Specialty" at a specific index
565         *
566         * @param rep The repetition index (0-indexed)
567         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
568         */
569        public SPD insertSpecialty(int rep) throws HL7Exception { 
570            return (SPD) super.insertRepetition(5, rep);
571        }
572    
573    
574    
575        /**
576         * Inserts a repetition of
577         * PRA-5: "Specialty" at a specific index
578         *
579         * @param rep The repetition index (0-indexed)
580         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
581         */
582        public SPD insertPra5_Specialty(int rep) throws HL7Exception { 
583            return (SPD) super.insertRepetition(5, rep);
584        }
585    
586    
587        /**
588         * Removes a repetition of
589         * PRA-5: "Specialty" at a specific index
590         *
591         * @param rep The repetition index (0-indexed)
592         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
593         */
594        public SPD removeSpecialty(int rep) throws HL7Exception { 
595            return (SPD) super.removeRepetition(5, rep);
596        }
597    
598    
599        /**
600         * Removes a repetition of
601         * PRA-5: "Specialty" at a specific index
602         *
603         * @param rep The repetition index (0-indexed)
604         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
605         */
606        public SPD removePra5_Specialty(int rep) throws HL7Exception { 
607            return (SPD) super.removeRepetition(5, rep);
608        }
609    
610    
611    
612        /**
613         * Returns all repetitions of Practitioner ID Numbers (PRA-6).
614         */
615        public PLN[] getPractitionerIDNumbers() {
616            PLN[] ret = null;
617            try {
618                Type[] t = this.getField(6);  
619                ret = new PLN[t.length];
620                for (int i = 0; i < ret.length; i++) {
621                    ret[i] = (PLN)t[i];
622                }
623            } catch (ClassCastException cce) {
624                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
625                throw new RuntimeException(cce);
626            } catch (HL7Exception he) {
627                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
628                throw new RuntimeException(he);
629            }
630            return ret;
631        }
632    
633    
634        /**
635         * Returns a count of the current number of repetitions of Practitioner ID Numbers (PRA-6).
636         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
637         * it will return zero.
638         */
639        public int getPractitionerIDNumbersReps() {
640            PLN[] ret = null;
641            try {
642                Type[] t = this.getField(6);
643                return t.length;  
644            } catch (ClassCastException cce) {
645                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
646                throw new RuntimeException(cce);
647            } catch (HL7Exception he) {
648                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
649                throw new RuntimeException(he);
650            }
651        }
652    
653    
654        /**
655         * Returns a specific repetition of
656         * PRA-6: "Practitioner ID Numbers" - creates it if necessary
657         *
658         * @param rep The repetition index (0-indexed)
659         */
660        public PLN getPractitionerIDNumbers(int rep) { 
661            PLN ret = null;
662            try {
663                Type t = this.getField(6, rep);
664                ret = (PLN)t;
665            } catch (ClassCastException cce) {
666                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
667                throw new RuntimeException(cce);
668            } catch (HL7Exception he) {
669                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
670                throw new RuntimeException(he);
671            }
672            return ret;
673        }
674    
675        /**
676         * Returns a specific repetition of
677         * PRA-6: "Practitioner ID Numbers" - creates it if necessary
678         *
679         * @param rep The repetition index (0-indexed)
680         */
681        public PLN getPra6_PractitionerIDNumbers(int rep) { 
682            PLN ret = null;
683            try {
684                Type t = this.getField(6, rep);
685                ret = (PLN)t;
686            } catch (ClassCastException cce) {
687                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
688                throw new RuntimeException(cce);
689            } catch (HL7Exception he) {
690                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
691                throw new RuntimeException(he);
692            }
693            return ret;
694        }
695    
696    
697        /**
698         * Returns a count of the current number of repetitions of Practitioner ID Numbers (PRA-6).
699         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
700         * it will return zero.
701         */
702        public int getPra6_PractitionerIDNumbersReps() {
703            PLN[] ret = null;
704            try {
705                Type[] t = this.getField(6);
706                return t.length;  
707            } catch (ClassCastException cce) {
708                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
709                throw new RuntimeException(cce);
710            } catch (HL7Exception he) {
711                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
712                throw new RuntimeException(he);
713            }
714        }
715    
716    
717    
718        /**
719         * Inserts a repetition of
720         * PRA-6: "Practitioner ID Numbers" at a specific index
721         *
722         * @param rep The repetition index (0-indexed)
723         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
724         */
725        public PLN insertPractitionerIDNumbers(int rep) throws HL7Exception { 
726            return (PLN) super.insertRepetition(6, rep);
727        }
728    
729    
730    
731        /**
732         * Inserts a repetition of
733         * PRA-6: "Practitioner ID Numbers" at a specific index
734         *
735         * @param rep The repetition index (0-indexed)
736         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
737         */
738        public PLN insertPra6_PractitionerIDNumbers(int rep) throws HL7Exception { 
739            return (PLN) super.insertRepetition(6, rep);
740        }
741    
742    
743        /**
744         * Removes a repetition of
745         * PRA-6: "Practitioner ID Numbers" at a specific index
746         *
747         * @param rep The repetition index (0-indexed)
748         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
749         */
750        public PLN removePractitionerIDNumbers(int rep) throws HL7Exception { 
751            return (PLN) super.removeRepetition(6, rep);
752        }
753    
754    
755        /**
756         * Removes a repetition of
757         * PRA-6: "Practitioner ID Numbers" at a specific index
758         *
759         * @param rep The repetition index (0-indexed)
760         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
761         */
762        public PLN removePra6_PractitionerIDNumbers(int rep) throws HL7Exception { 
763            return (PLN) super.removeRepetition(6, rep);
764        }
765    
766    
767    
768        /**
769         * Returns all repetitions of Privileges (PRA-7).
770         */
771        public PIP[] getPrivileges() {
772            PIP[] ret = null;
773            try {
774                Type[] t = this.getField(7);  
775                ret = new PIP[t.length];
776                for (int i = 0; i < ret.length; i++) {
777                    ret[i] = (PIP)t[i];
778                }
779            } catch (ClassCastException cce) {
780                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
781                throw new RuntimeException(cce);
782            } catch (HL7Exception he) {
783                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
784                throw new RuntimeException(he);
785            }
786            return ret;
787        }
788    
789    
790        /**
791         * Returns a count of the current number of repetitions of Privileges (PRA-7).
792         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
793         * it will return zero.
794         */
795        public int getPrivilegesReps() {
796            PIP[] ret = null;
797            try {
798                Type[] t = this.getField(7);
799                return t.length;  
800            } catch (ClassCastException cce) {
801                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
802                throw new RuntimeException(cce);
803            } catch (HL7Exception he) {
804                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
805                throw new RuntimeException(he);
806            }
807        }
808    
809    
810        /**
811         * Returns a specific repetition of
812         * PRA-7: "Privileges" - creates it if necessary
813         *
814         * @param rep The repetition index (0-indexed)
815         */
816        public PIP getPrivileges(int rep) { 
817            PIP ret = null;
818            try {
819                Type t = this.getField(7, rep);
820                ret = (PIP)t;
821            } catch (ClassCastException cce) {
822                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
823                throw new RuntimeException(cce);
824            } catch (HL7Exception he) {
825                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
826                throw new RuntimeException(he);
827            }
828            return ret;
829        }
830    
831        /**
832         * Returns a specific repetition of
833         * PRA-7: "Privileges" - creates it if necessary
834         *
835         * @param rep The repetition index (0-indexed)
836         */
837        public PIP getPra7_Privileges(int rep) { 
838            PIP ret = null;
839            try {
840                Type t = this.getField(7, rep);
841                ret = (PIP)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         * Returns a count of the current number of repetitions of Privileges (PRA-7).
855         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
856         * it will return zero.
857         */
858        public int getPra7_PrivilegesReps() {
859            PIP[] ret = null;
860            try {
861                Type[] t = this.getField(7);
862                return t.length;  
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        }
871    
872    
873    
874        /**
875         * Inserts a repetition of
876         * PRA-7: "Privileges" at a specific index
877         *
878         * @param rep The repetition index (0-indexed)
879         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
880         */
881        public PIP insertPrivileges(int rep) throws HL7Exception { 
882            return (PIP) super.insertRepetition(7, rep);
883        }
884    
885    
886    
887        /**
888         * Inserts a repetition of
889         * PRA-7: "Privileges" at a specific index
890         *
891         * @param rep The repetition index (0-indexed)
892         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
893         */
894        public PIP insertPra7_Privileges(int rep) throws HL7Exception { 
895            return (PIP) super.insertRepetition(7, rep);
896        }
897    
898    
899        /**
900         * Removes a repetition of
901         * PRA-7: "Privileges" at a specific index
902         *
903         * @param rep The repetition index (0-indexed)
904         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
905         */
906        public PIP removePrivileges(int rep) throws HL7Exception { 
907            return (PIP) super.removeRepetition(7, rep);
908        }
909    
910    
911        /**
912         * Removes a repetition of
913         * PRA-7: "Privileges" at a specific index
914         *
915         * @param rep The repetition index (0-indexed)
916         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
917         */
918        public PIP removePra7_Privileges(int rep) throws HL7Exception { 
919            return (PIP) super.removeRepetition(7, rep);
920        }
921    
922    
923    
924    
925        /**
926         * Returns
927         * PRA-8: "Date Entered Practice" - creates it if necessary
928         */
929        public DT getDateEnteredPractice() { 
930            DT ret = null;
931            try {
932                Type t = this.getField(8, 0);
933                ret = (DT)t;
934            } catch (ClassCastException cce) {
935                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
936                throw new RuntimeException(cce);
937            } catch (HL7Exception he) {
938                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
939                throw new RuntimeException(he);
940            }
941            return ret;
942        }
943    
944    
945        /**
946         * Returns
947         * PRA-8: "Date Entered Practice" - creates it if necessary
948         */
949        public DT getPra8_DateEnteredPractice() { 
950            DT ret = null;
951            try {
952                Type t = this.getField(8, 0);
953                ret = (DT)t;
954            } catch (ClassCastException cce) {
955                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
956                throw new RuntimeException(cce);
957            } catch (HL7Exception he) {
958                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
959                throw new RuntimeException(he);
960            }
961            return ret;
962        }
963    
964    
965    
966    
967    
968        /** {@inheritDoc} */   
969        protected Type createNewTypeWithoutReflection(int field) {
970           switch (field) {
971              case 0: return new CE(getMessage());
972              case 1: return new CE(getMessage());
973              case 2: return new IS(getMessage(), new Integer( 186 ));
974              case 3: return new ID(getMessage(), new Integer( 187 ));
975              case 4: return new SPD(getMessage());
976              case 5: return new PLN(getMessage());
977              case 6: return new PIP(getMessage());
978              case 7: return new DT(getMessage());
979              default: return null;
980           }
981       }
982    
983    
984    }
985