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 PRD message segment (Provider Data). 
024     * This segment has the following fields:</p>
025     * <ul>
026         * <li>PRD-1: Provider Role (CE) <b> repeating</b>
027         * <li>PRD-2: Provider Name (XPN) <b>optional repeating</b>
028         * <li>PRD-3: Provider Address (XAD) <b>optional repeating</b>
029         * <li>PRD-4: Provider Location (PL) <b>optional </b>
030         * <li>PRD-5: Provider Communication Information (XTN) <b>optional repeating</b>
031         * <li>PRD-6: Preferred Method of Contact (CE) <b>optional </b>
032         * <li>PRD-7: Provider Identifiers (PI) <b>optional repeating</b>
033         * <li>PRD-8: Effective Start Date of Provider Role (TS) <b>optional </b>
034         * <li>PRD-9: Effective End Date of Provider Role (TS) <b>optional </b>
035     * </ul>
036     */
037    public class PRD extends AbstractSegment {
038    
039        /** 
040         * Creates a new PRD segment
041         */
042        public PRD(Group parent, ModelClassFactory factory) {
043           super(parent, factory);
044           init(factory);
045        }
046    
047        private void init(ModelClassFactory factory) {
048           try {
049                                      this.add(CE.class, true, 0, 250, new Object[]{ getMessage(), new Integer(286) }, "Provider Role");
050                                      this.add(XPN.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Provider Name");
051                                      this.add(XAD.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Provider Address");
052                                      this.add(PL.class, false, 1, 60, new Object[]{ getMessage(), new Integer(0) }, "Provider Location");
053                                      this.add(XTN.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Provider Communication Information");
054                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(185) }, "Preferred Method of Contact");
055                                      this.add(PI.class, false, 0, 100, new Object[]{ getMessage(), new Integer(0) }, "Provider Identifiers");
056                                      this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Effective Start Date of Provider Role");
057                                      this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Effective End Date of Provider Role");
058           } catch(HL7Exception e) {
059              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating PRD - this is probably a bug in the source code generator.", e);
060           }
061        }
062    
063    
064        /**
065         * Returns all repetitions of Provider Role (PRD-1).
066         */
067        public CE[] getProviderRole() {
068            CE[] ret = null;
069            try {
070                Type[] t = this.getField(1);  
071                ret = new CE[t.length];
072                for (int i = 0; i < ret.length; i++) {
073                    ret[i] = (CE)t[i];
074                }
075            } catch (ClassCastException cce) {
076                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
077                throw new RuntimeException(cce);
078            } catch (HL7Exception he) {
079                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
080                throw new RuntimeException(he);
081            }
082            return ret;
083        }
084    
085    
086        /**
087         * Returns a count of the current number of repetitions of Provider Role (PRD-1).
088         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
089         * it will return zero.
090         */
091        public int getProviderRoleReps() {
092            CE[] ret = null;
093            try {
094                Type[] t = this.getField(1);
095                return t.length;  
096            } catch (ClassCastException cce) {
097                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
098                throw new RuntimeException(cce);
099            } catch (HL7Exception he) {
100                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
101                throw new RuntimeException(he);
102            }
103        }
104    
105    
106        /**
107         * Returns a specific repetition of
108         * PRD-1: "Provider Role" - creates it if necessary
109         *
110         * @param rep The repetition index (0-indexed)
111         */
112        public CE getProviderRole(int rep) { 
113            CE ret = null;
114            try {
115                Type t = this.getField(1, rep);
116                ret = (CE)t;
117            } catch (ClassCastException cce) {
118                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
119                throw new RuntimeException(cce);
120            } catch (HL7Exception he) {
121                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
122                throw new RuntimeException(he);
123            }
124            return ret;
125        }
126    
127        /**
128         * Returns a specific repetition of
129         * PRD-1: "Provider Role" - creates it if necessary
130         *
131         * @param rep The repetition index (0-indexed)
132         */
133        public CE getPrd1_ProviderRole(int rep) { 
134            CE ret = null;
135            try {
136                Type t = this.getField(1, rep);
137                ret = (CE)t;
138            } catch (ClassCastException cce) {
139                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
140                throw new RuntimeException(cce);
141            } catch (HL7Exception he) {
142                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
143                throw new RuntimeException(he);
144            }
145            return ret;
146        }
147    
148    
149        /**
150         * Returns a count of the current number of repetitions of Provider Role (PRD-1).
151         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
152         * it will return zero.
153         */
154        public int getPrd1_ProviderRoleReps() {
155            CE[] ret = null;
156            try {
157                Type[] t = this.getField(1);
158                return t.length;  
159            } catch (ClassCastException cce) {
160                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
161                throw new RuntimeException(cce);
162            } catch (HL7Exception he) {
163                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
164                throw new RuntimeException(he);
165            }
166        }
167    
168    
169    
170        /**
171         * Inserts a repetition of
172         * PRD-1: "Provider Role" at a specific index
173         *
174         * @param rep The repetition index (0-indexed)
175         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
176         */
177        public CE insertProviderRole(int rep) throws HL7Exception { 
178            return (CE) super.insertRepetition(1, rep);
179        }
180    
181    
182    
183        /**
184         * Inserts a repetition of
185         * PRD-1: "Provider Role" at a specific index
186         *
187         * @param rep The repetition index (0-indexed)
188         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
189         */
190        public CE insertPrd1_ProviderRole(int rep) throws HL7Exception { 
191            return (CE) super.insertRepetition(1, rep);
192        }
193    
194    
195        /**
196         * Removes a repetition of
197         * PRD-1: "Provider Role" at a specific index
198         *
199         * @param rep The repetition index (0-indexed)
200         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
201         */
202        public CE removeProviderRole(int rep) throws HL7Exception { 
203            return (CE) super.removeRepetition(1, rep);
204        }
205    
206    
207        /**
208         * Removes a repetition of
209         * PRD-1: "Provider Role" at a specific index
210         *
211         * @param rep The repetition index (0-indexed)
212         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
213         */
214        public CE removePrd1_ProviderRole(int rep) throws HL7Exception { 
215            return (CE) super.removeRepetition(1, rep);
216        }
217    
218    
219    
220        /**
221         * Returns all repetitions of Provider Name (PRD-2).
222         */
223        public XPN[] getProviderName() {
224            XPN[] ret = null;
225            try {
226                Type[] t = this.getField(2);  
227                ret = new XPN[t.length];
228                for (int i = 0; i < ret.length; i++) {
229                    ret[i] = (XPN)t[i];
230                }
231            } catch (ClassCastException cce) {
232                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
233                throw new RuntimeException(cce);
234            } catch (HL7Exception he) {
235                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
236                throw new RuntimeException(he);
237            }
238            return ret;
239        }
240    
241    
242        /**
243         * Returns a count of the current number of repetitions of Provider Name (PRD-2).
244         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
245         * it will return zero.
246         */
247        public int getProviderNameReps() {
248            XPN[] ret = null;
249            try {
250                Type[] t = this.getField(2);
251                return t.length;  
252            } catch (ClassCastException cce) {
253                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
254                throw new RuntimeException(cce);
255            } catch (HL7Exception he) {
256                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
257                throw new RuntimeException(he);
258            }
259        }
260    
261    
262        /**
263         * Returns a specific repetition of
264         * PRD-2: "Provider Name" - creates it if necessary
265         *
266         * @param rep The repetition index (0-indexed)
267         */
268        public XPN getProviderName(int rep) { 
269            XPN ret = null;
270            try {
271                Type t = this.getField(2, rep);
272                ret = (XPN)t;
273            } catch (ClassCastException cce) {
274                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
275                throw new RuntimeException(cce);
276            } catch (HL7Exception he) {
277                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
278                throw new RuntimeException(he);
279            }
280            return ret;
281        }
282    
283        /**
284         * Returns a specific repetition of
285         * PRD-2: "Provider Name" - creates it if necessary
286         *
287         * @param rep The repetition index (0-indexed)
288         */
289        public XPN getPrd2_ProviderName(int rep) { 
290            XPN ret = null;
291            try {
292                Type t = this.getField(2, rep);
293                ret = (XPN)t;
294            } catch (ClassCastException cce) {
295                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
296                throw new RuntimeException(cce);
297            } catch (HL7Exception he) {
298                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
299                throw new RuntimeException(he);
300            }
301            return ret;
302        }
303    
304    
305        /**
306         * Returns a count of the current number of repetitions of Provider Name (PRD-2).
307         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
308         * it will return zero.
309         */
310        public int getPrd2_ProviderNameReps() {
311            XPN[] ret = null;
312            try {
313                Type[] t = this.getField(2);
314                return t.length;  
315            } catch (ClassCastException cce) {
316                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
317                throw new RuntimeException(cce);
318            } catch (HL7Exception he) {
319                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
320                throw new RuntimeException(he);
321            }
322        }
323    
324    
325    
326        /**
327         * Inserts a repetition of
328         * PRD-2: "Provider Name" at a specific index
329         *
330         * @param rep The repetition index (0-indexed)
331         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
332         */
333        public XPN insertProviderName(int rep) throws HL7Exception { 
334            return (XPN) super.insertRepetition(2, rep);
335        }
336    
337    
338    
339        /**
340         * Inserts a repetition of
341         * PRD-2: "Provider Name" at a specific index
342         *
343         * @param rep The repetition index (0-indexed)
344         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
345         */
346        public XPN insertPrd2_ProviderName(int rep) throws HL7Exception { 
347            return (XPN) super.insertRepetition(2, rep);
348        }
349    
350    
351        /**
352         * Removes a repetition of
353         * PRD-2: "Provider Name" at a specific index
354         *
355         * @param rep The repetition index (0-indexed)
356         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
357         */
358        public XPN removeProviderName(int rep) throws HL7Exception { 
359            return (XPN) super.removeRepetition(2, rep);
360        }
361    
362    
363        /**
364         * Removes a repetition of
365         * PRD-2: "Provider Name" at a specific index
366         *
367         * @param rep The repetition index (0-indexed)
368         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
369         */
370        public XPN removePrd2_ProviderName(int rep) throws HL7Exception { 
371            return (XPN) super.removeRepetition(2, rep);
372        }
373    
374    
375    
376        /**
377         * Returns all repetitions of Provider Address (PRD-3).
378         */
379        public XAD[] getProviderAddress() {
380            XAD[] ret = null;
381            try {
382                Type[] t = this.getField(3);  
383                ret = new XAD[t.length];
384                for (int i = 0; i < ret.length; i++) {
385                    ret[i] = (XAD)t[i];
386                }
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 a count of the current number of repetitions of Provider Address (PRD-3).
400         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
401         * it will return zero.
402         */
403        public int getProviderAddressReps() {
404            XAD[] ret = null;
405            try {
406                Type[] t = this.getField(3);
407                return t.length;  
408            } catch (ClassCastException cce) {
409                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
410                throw new RuntimeException(cce);
411            } catch (HL7Exception he) {
412                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
413                throw new RuntimeException(he);
414            }
415        }
416    
417    
418        /**
419         * Returns a specific repetition of
420         * PRD-3: "Provider Address" - creates it if necessary
421         *
422         * @param rep The repetition index (0-indexed)
423         */
424        public XAD getProviderAddress(int rep) { 
425            XAD ret = null;
426            try {
427                Type t = this.getField(3, rep);
428                ret = (XAD)t;
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         * Returns a specific repetition of
441         * PRD-3: "Provider Address" - creates it if necessary
442         *
443         * @param rep The repetition index (0-indexed)
444         */
445        public XAD getPrd3_ProviderAddress(int rep) { 
446            XAD ret = null;
447            try {
448                Type t = this.getField(3, rep);
449                ret = (XAD)t;
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            return ret;
458        }
459    
460    
461        /**
462         * Returns a count of the current number of repetitions of Provider Address (PRD-3).
463         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
464         * it will return zero.
465         */
466        public int getPrd3_ProviderAddressReps() {
467            XAD[] ret = null;
468            try {
469                Type[] t = this.getField(3);
470                return t.length;  
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        }
479    
480    
481    
482        /**
483         * Inserts a repetition of
484         * PRD-3: "Provider Address" at a specific index
485         *
486         * @param rep The repetition index (0-indexed)
487         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
488         */
489        public XAD insertProviderAddress(int rep) throws HL7Exception { 
490            return (XAD) super.insertRepetition(3, rep);
491        }
492    
493    
494    
495        /**
496         * Inserts a repetition of
497         * PRD-3: "Provider Address" at a specific index
498         *
499         * @param rep The repetition index (0-indexed)
500         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
501         */
502        public XAD insertPrd3_ProviderAddress(int rep) throws HL7Exception { 
503            return (XAD) super.insertRepetition(3, rep);
504        }
505    
506    
507        /**
508         * Removes a repetition of
509         * PRD-3: "Provider Address" at a specific index
510         *
511         * @param rep The repetition index (0-indexed)
512         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
513         */
514        public XAD removeProviderAddress(int rep) throws HL7Exception { 
515            return (XAD) super.removeRepetition(3, rep);
516        }
517    
518    
519        /**
520         * Removes a repetition of
521         * PRD-3: "Provider Address" at a specific index
522         *
523         * @param rep The repetition index (0-indexed)
524         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
525         */
526        public XAD removePrd3_ProviderAddress(int rep) throws HL7Exception { 
527            return (XAD) super.removeRepetition(3, rep);
528        }
529    
530    
531    
532    
533        /**
534         * Returns
535         * PRD-4: "Provider Location" - creates it if necessary
536         */
537        public PL getProviderLocation() { 
538            PL ret = null;
539            try {
540                Type t = this.getField(4, 0);
541                ret = (PL)t;
542            } catch (ClassCastException cce) {
543                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
544                throw new RuntimeException(cce);
545            } catch (HL7Exception he) {
546                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
547                throw new RuntimeException(he);
548            }
549            return ret;
550        }
551    
552    
553        /**
554         * Returns
555         * PRD-4: "Provider Location" - creates it if necessary
556         */
557        public PL getPrd4_ProviderLocation() { 
558            PL ret = null;
559            try {
560                Type t = this.getField(4, 0);
561                ret = (PL)t;
562            } catch (ClassCastException cce) {
563                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
564                throw new RuntimeException(cce);
565            } catch (HL7Exception he) {
566                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
567                throw new RuntimeException(he);
568            }
569            return ret;
570        }
571    
572    
573        /**
574         * Returns all repetitions of Provider Communication Information (PRD-5).
575         */
576        public XTN[] getProviderCommunicationInformation() {
577            XTN[] ret = null;
578            try {
579                Type[] t = this.getField(5);  
580                ret = new XTN[t.length];
581                for (int i = 0; i < ret.length; i++) {
582                    ret[i] = (XTN)t[i];
583                }
584            } catch (ClassCastException cce) {
585                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
586                throw new RuntimeException(cce);
587            } catch (HL7Exception he) {
588                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
589                throw new RuntimeException(he);
590            }
591            return ret;
592        }
593    
594    
595        /**
596         * Returns a count of the current number of repetitions of Provider Communication Information (PRD-5).
597         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
598         * it will return zero.
599         */
600        public int getProviderCommunicationInformationReps() {
601            XTN[] ret = null;
602            try {
603                Type[] t = this.getField(5);
604                return t.length;  
605            } catch (ClassCastException cce) {
606                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
607                throw new RuntimeException(cce);
608            } catch (HL7Exception he) {
609                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
610                throw new RuntimeException(he);
611            }
612        }
613    
614    
615        /**
616         * Returns a specific repetition of
617         * PRD-5: "Provider Communication Information" - creates it if necessary
618         *
619         * @param rep The repetition index (0-indexed)
620         */
621        public XTN getProviderCommunicationInformation(int rep) { 
622            XTN ret = null;
623            try {
624                Type t = this.getField(5, rep);
625                ret = (XTN)t;
626            } catch (ClassCastException cce) {
627                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
628                throw new RuntimeException(cce);
629            } catch (HL7Exception he) {
630                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
631                throw new RuntimeException(he);
632            }
633            return ret;
634        }
635    
636        /**
637         * Returns a specific repetition of
638         * PRD-5: "Provider Communication Information" - creates it if necessary
639         *
640         * @param rep The repetition index (0-indexed)
641         */
642        public XTN getPrd5_ProviderCommunicationInformation(int rep) { 
643            XTN ret = null;
644            try {
645                Type t = this.getField(5, rep);
646                ret = (XTN)t;
647            } catch (ClassCastException cce) {
648                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
649                throw new RuntimeException(cce);
650            } catch (HL7Exception he) {
651                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
652                throw new RuntimeException(he);
653            }
654            return ret;
655        }
656    
657    
658        /**
659         * Returns a count of the current number of repetitions of Provider Communication Information (PRD-5).
660         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
661         * it will return zero.
662         */
663        public int getPrd5_ProviderCommunicationInformationReps() {
664            XTN[] ret = null;
665            try {
666                Type[] t = this.getField(5);
667                return t.length;  
668            } catch (ClassCastException cce) {
669                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
670                throw new RuntimeException(cce);
671            } catch (HL7Exception he) {
672                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
673                throw new RuntimeException(he);
674            }
675        }
676    
677    
678    
679        /**
680         * Inserts a repetition of
681         * PRD-5: "Provider Communication Information" at a specific index
682         *
683         * @param rep The repetition index (0-indexed)
684         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
685         */
686        public XTN insertProviderCommunicationInformation(int rep) throws HL7Exception { 
687            return (XTN) super.insertRepetition(5, rep);
688        }
689    
690    
691    
692        /**
693         * Inserts a repetition of
694         * PRD-5: "Provider Communication Information" at a specific index
695         *
696         * @param rep The repetition index (0-indexed)
697         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
698         */
699        public XTN insertPrd5_ProviderCommunicationInformation(int rep) throws HL7Exception { 
700            return (XTN) super.insertRepetition(5, rep);
701        }
702    
703    
704        /**
705         * Removes a repetition of
706         * PRD-5: "Provider Communication Information" at a specific index
707         *
708         * @param rep The repetition index (0-indexed)
709         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
710         */
711        public XTN removeProviderCommunicationInformation(int rep) throws HL7Exception { 
712            return (XTN) super.removeRepetition(5, rep);
713        }
714    
715    
716        /**
717         * Removes a repetition of
718         * PRD-5: "Provider Communication Information" at a specific index
719         *
720         * @param rep The repetition index (0-indexed)
721         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
722         */
723        public XTN removePrd5_ProviderCommunicationInformation(int rep) throws HL7Exception { 
724            return (XTN) super.removeRepetition(5, rep);
725        }
726    
727    
728    
729    
730        /**
731         * Returns
732         * PRD-6: "Preferred Method of Contact" - creates it if necessary
733         */
734        public CE getPreferredMethodOfContact() { 
735            CE ret = null;
736            try {
737                Type t = this.getField(6, 0);
738                ret = (CE)t;
739            } catch (ClassCastException cce) {
740                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
741                throw new RuntimeException(cce);
742            } catch (HL7Exception he) {
743                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
744                throw new RuntimeException(he);
745            }
746            return ret;
747        }
748    
749    
750        /**
751         * Returns
752         * PRD-6: "Preferred Method of Contact" - creates it if necessary
753         */
754        public CE getPrd6_PreferredMethodOfContact() { 
755            CE ret = null;
756            try {
757                Type t = this.getField(6, 0);
758                ret = (CE)t;
759            } catch (ClassCastException cce) {
760                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
761                throw new RuntimeException(cce);
762            } catch (HL7Exception he) {
763                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
764                throw new RuntimeException(he);
765            }
766            return ret;
767        }
768    
769    
770        /**
771         * Returns all repetitions of Provider Identifiers (PRD-7).
772         */
773        public PI[] getProviderIdentifiers() {
774            PI[] ret = null;
775            try {
776                Type[] t = this.getField(7);  
777                ret = new PI[t.length];
778                for (int i = 0; i < ret.length; i++) {
779                    ret[i] = (PI)t[i];
780                }
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 a count of the current number of repetitions of Provider Identifiers (PRD-7).
794         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
795         * it will return zero.
796         */
797        public int getProviderIdentifiersReps() {
798            PI[] ret = null;
799            try {
800                Type[] t = this.getField(7);
801                return t.length;  
802            } catch (ClassCastException cce) {
803                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
804                throw new RuntimeException(cce);
805            } catch (HL7Exception he) {
806                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
807                throw new RuntimeException(he);
808            }
809        }
810    
811    
812        /**
813         * Returns a specific repetition of
814         * PRD-7: "Provider Identifiers" - creates it if necessary
815         *
816         * @param rep The repetition index (0-indexed)
817         */
818        public PI getProviderIdentifiers(int rep) { 
819            PI ret = null;
820            try {
821                Type t = this.getField(7, rep);
822                ret = (PI)t;
823            } catch (ClassCastException cce) {
824                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
825                throw new RuntimeException(cce);
826            } catch (HL7Exception he) {
827                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
828                throw new RuntimeException(he);
829            }
830            return ret;
831        }
832    
833        /**
834         * Returns a specific repetition of
835         * PRD-7: "Provider Identifiers" - creates it if necessary
836         *
837         * @param rep The repetition index (0-indexed)
838         */
839        public PI getPrd7_ProviderIdentifiers(int rep) { 
840            PI ret = null;
841            try {
842                Type t = this.getField(7, rep);
843                ret = (PI)t;
844            } catch (ClassCastException cce) {
845                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
846                throw new RuntimeException(cce);
847            } catch (HL7Exception he) {
848                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
849                throw new RuntimeException(he);
850            }
851            return ret;
852        }
853    
854    
855        /**
856         * Returns a count of the current number of repetitions of Provider Identifiers (PRD-7).
857         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
858         * it will return zero.
859         */
860        public int getPrd7_ProviderIdentifiersReps() {
861            PI[] ret = null;
862            try {
863                Type[] t = this.getField(7);
864                return t.length;  
865            } catch (ClassCastException cce) {
866                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
867                throw new RuntimeException(cce);
868            } catch (HL7Exception he) {
869                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
870                throw new RuntimeException(he);
871            }
872        }
873    
874    
875    
876        /**
877         * Inserts a repetition of
878         * PRD-7: "Provider Identifiers" at a specific index
879         *
880         * @param rep The repetition index (0-indexed)
881         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
882         */
883        public PI insertProviderIdentifiers(int rep) throws HL7Exception { 
884            return (PI) super.insertRepetition(7, rep);
885        }
886    
887    
888    
889        /**
890         * Inserts a repetition of
891         * PRD-7: "Provider Identifiers" at a specific index
892         *
893         * @param rep The repetition index (0-indexed)
894         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
895         */
896        public PI insertPrd7_ProviderIdentifiers(int rep) throws HL7Exception { 
897            return (PI) super.insertRepetition(7, rep);
898        }
899    
900    
901        /**
902         * Removes a repetition of
903         * PRD-7: "Provider Identifiers" at a specific index
904         *
905         * @param rep The repetition index (0-indexed)
906         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
907         */
908        public PI removeProviderIdentifiers(int rep) throws HL7Exception { 
909            return (PI) super.removeRepetition(7, rep);
910        }
911    
912    
913        /**
914         * Removes a repetition of
915         * PRD-7: "Provider Identifiers" at a specific index
916         *
917         * @param rep The repetition index (0-indexed)
918         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
919         */
920        public PI removePrd7_ProviderIdentifiers(int rep) throws HL7Exception { 
921            return (PI) super.removeRepetition(7, rep);
922        }
923    
924    
925    
926    
927        /**
928         * Returns
929         * PRD-8: "Effective Start Date of Provider Role" - creates it if necessary
930         */
931        public TS getEffectiveStartDateOfProviderRole() { 
932            TS ret = null;
933            try {
934                Type t = this.getField(8, 0);
935                ret = (TS)t;
936            } catch (ClassCastException cce) {
937                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
938                throw new RuntimeException(cce);
939            } catch (HL7Exception he) {
940                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
941                throw new RuntimeException(he);
942            }
943            return ret;
944        }
945    
946    
947        /**
948         * Returns
949         * PRD-8: "Effective Start Date of Provider Role" - creates it if necessary
950         */
951        public TS getPrd8_EffectiveStartDateOfProviderRole() { 
952            TS ret = null;
953            try {
954                Type t = this.getField(8, 0);
955                ret = (TS)t;
956            } catch (ClassCastException cce) {
957                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
958                throw new RuntimeException(cce);
959            } catch (HL7Exception he) {
960                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
961                throw new RuntimeException(he);
962            }
963            return ret;
964        }
965    
966    
967    
968        /**
969         * Returns
970         * PRD-9: "Effective End Date of Provider Role" - creates it if necessary
971         */
972        public TS getEffectiveEndDateOfProviderRole() { 
973            TS ret = null;
974            try {
975                Type t = this.getField(9, 0);
976                ret = (TS)t;
977            } catch (ClassCastException cce) {
978                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
979                throw new RuntimeException(cce);
980            } catch (HL7Exception he) {
981                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
982                throw new RuntimeException(he);
983            }
984            return ret;
985        }
986    
987    
988        /**
989         * Returns
990         * PRD-9: "Effective End Date of Provider Role" - creates it if necessary
991         */
992        public TS getPrd9_EffectiveEndDateOfProviderRole() { 
993            TS ret = null;
994            try {
995                Type t = this.getField(9, 0);
996                ret = (TS)t;
997            } catch (ClassCastException cce) {
998                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
999                throw new RuntimeException(cce);
1000            } catch (HL7Exception he) {
1001                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1002                throw new RuntimeException(he);
1003            }
1004            return ret;
1005        }
1006    
1007    
1008    
1009    
1010    
1011        /** {@inheritDoc} */   
1012        protected Type createNewTypeWithoutReflection(int field) {
1013           switch (field) {
1014              case 0: return new CE(getMessage());
1015              case 1: return new XPN(getMessage());
1016              case 2: return new XAD(getMessage());
1017              case 3: return new PL(getMessage());
1018              case 4: return new XTN(getMessage());
1019              case 5: return new CE(getMessage());
1020              case 6: return new PI(getMessage());
1021              case 7: return new TS(getMessage());
1022              case 8: return new TS(getMessage());
1023              default: return null;
1024           }
1025       }
1026    
1027    
1028    }
1029