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 PES message segment (Product Experience Sender). 
024     * This segment has the following fields:</p>
025     * <ul>
026         * <li>PES-1: Sender Organization Name (XON) <b>optional repeating</b>
027         * <li>PES-2: Sender Individual Name (XCN) <b>optional repeating</b>
028         * <li>PES-3: Sender Address (XAD) <b>optional repeating</b>
029         * <li>PES-4: Sender Telephone (XTN) <b>optional repeating</b>
030         * <li>PES-5: Sender Event Identifier (EI) <b>optional </b>
031         * <li>PES-6: Sender Sequence Number (NM) <b>optional </b>
032         * <li>PES-7: Sender Event Description (FT) <b>optional repeating</b>
033         * <li>PES-8: Sender Comment (FT) <b>optional </b>
034         * <li>PES-9: Sender Aware Date/Time (TS) <b>optional </b>
035         * <li>PES-10: Event Report Date (TS) <b> </b>
036         * <li>PES-11: Event Report Timing/Type (ID) <b>optional repeating</b>
037         * <li>PES-12: Event Report Source (ID) <b>optional </b>
038         * <li>PES-13: Event Reported To (ID) <b>optional repeating</b>
039     * </ul>
040     */
041    public class PES extends AbstractSegment {
042    
043        /** 
044         * Creates a new PES segment
045         */
046        public PES(Group parent, ModelClassFactory factory) {
047           super(parent, factory);
048           init(factory);
049        }
050    
051        private void init(ModelClassFactory factory) {
052           try {
053                                      this.add(XON.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Sender Organization Name");
054                                      this.add(XCN.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Sender Individual Name");
055                                      this.add(XAD.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Sender Address");
056                                      this.add(XTN.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Sender Telephone");
057                                      this.add(EI.class, false, 1, 75, new Object[]{ getMessage(), new Integer(0) }, "Sender Event Identifier");
058                                      this.add(NM.class, false, 1, 2, new Object[]{ getMessage(), new Integer(0) }, "Sender Sequence Number");
059                                      this.add(FT.class, false, 0, 600, new Object[]{ getMessage(), new Integer(0) }, "Sender Event Description");
060                                      this.add(FT.class, false, 1, 600, new Object[]{ getMessage(), new Integer(0) }, "Sender Comment");
061                                      this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Sender Aware Date/Time");
062                                      this.add(TS.class, true, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Event Report Date");
063                                      this.add(ID.class, false, 2, 3, new Object[]{ getMessage() }, "Event Report Timing/Type");
064                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Event Report Source");
065                                      this.add(ID.class, false, 0, 1, new Object[]{ getMessage() }, "Event Reported To");
066           } catch(HL7Exception e) {
067              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating PES - this is probably a bug in the source code generator.", e);
068           }
069        }
070    
071    
072        /**
073         * Returns all repetitions of Sender Organization Name (PES-1).
074         */
075        public XON[] getSenderOrganizationName() {
076            XON[] ret = null;
077            try {
078                Type[] t = this.getField(1);  
079                ret = new XON[t.length];
080                for (int i = 0; i < ret.length; i++) {
081                    ret[i] = (XON)t[i];
082                }
083            } catch (ClassCastException cce) {
084                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
085                throw new RuntimeException(cce);
086            } catch (HL7Exception he) {
087                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
088                throw new RuntimeException(he);
089            }
090            return ret;
091        }
092    
093    
094        /**
095         * Returns a count of the current number of repetitions of Sender Organization Name (PES-1).
096         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
097         * it will return zero.
098         */
099        public int getSenderOrganizationNameReps() {
100            XON[] ret = null;
101            try {
102                Type[] t = this.getField(1);
103                return t.length;  
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        }
112    
113    
114        /**
115         * Returns a specific repetition of
116         * PES-1: "Sender Organization Name" - creates it if necessary
117         *
118         * @param rep The repetition index (0-indexed)
119         */
120        public XON getSenderOrganizationName(int rep) { 
121            XON ret = null;
122            try {
123                Type t = this.getField(1, rep);
124                ret = (XON)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         * Returns a specific repetition of
137         * PES-1: "Sender Organization Name" - creates it if necessary
138         *
139         * @param rep The repetition index (0-indexed)
140         */
141        public XON getPes1_SenderOrganizationName(int rep) { 
142            XON ret = null;
143            try {
144                Type t = this.getField(1, rep);
145                ret = (XON)t;
146            } catch (ClassCastException cce) {
147                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
148                throw new RuntimeException(cce);
149            } catch (HL7Exception he) {
150                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
151                throw new RuntimeException(he);
152            }
153            return ret;
154        }
155    
156    
157        /**
158         * Returns a count of the current number of repetitions of Sender Organization Name (PES-1).
159         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
160         * it will return zero.
161         */
162        public int getPes1_SenderOrganizationNameReps() {
163            XON[] ret = null;
164            try {
165                Type[] t = this.getField(1);
166                return t.length;  
167            } catch (ClassCastException cce) {
168                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
169                throw new RuntimeException(cce);
170            } catch (HL7Exception he) {
171                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
172                throw new RuntimeException(he);
173            }
174        }
175    
176    
177    
178        /**
179         * Inserts a repetition of
180         * PES-1: "Sender Organization Name" at a specific index
181         *
182         * @param rep The repetition index (0-indexed)
183         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
184         */
185        public XON insertSenderOrganizationName(int rep) throws HL7Exception { 
186            return (XON) super.insertRepetition(1, rep);
187        }
188    
189    
190    
191        /**
192         * Inserts a repetition of
193         * PES-1: "Sender Organization Name" at a specific index
194         *
195         * @param rep The repetition index (0-indexed)
196         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
197         */
198        public XON insertPes1_SenderOrganizationName(int rep) throws HL7Exception { 
199            return (XON) super.insertRepetition(1, rep);
200        }
201    
202    
203        /**
204         * Removes a repetition of
205         * PES-1: "Sender Organization Name" at a specific index
206         *
207         * @param rep The repetition index (0-indexed)
208         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
209         */
210        public XON removeSenderOrganizationName(int rep) throws HL7Exception { 
211            return (XON) super.removeRepetition(1, rep);
212        }
213    
214    
215        /**
216         * Removes a repetition of
217         * PES-1: "Sender Organization Name" at a specific index
218         *
219         * @param rep The repetition index (0-indexed)
220         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
221         */
222        public XON removePes1_SenderOrganizationName(int rep) throws HL7Exception { 
223            return (XON) super.removeRepetition(1, rep);
224        }
225    
226    
227    
228        /**
229         * Returns all repetitions of Sender Individual Name (PES-2).
230         */
231        public XCN[] getSenderIndividualName() {
232            XCN[] ret = null;
233            try {
234                Type[] t = this.getField(2);  
235                ret = new XCN[t.length];
236                for (int i = 0; i < ret.length; i++) {
237                    ret[i] = (XCN)t[i];
238                }
239            } catch (ClassCastException cce) {
240                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
241                throw new RuntimeException(cce);
242            } catch (HL7Exception he) {
243                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
244                throw new RuntimeException(he);
245            }
246            return ret;
247        }
248    
249    
250        /**
251         * Returns a count of the current number of repetitions of Sender Individual Name (PES-2).
252         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
253         * it will return zero.
254         */
255        public int getSenderIndividualNameReps() {
256            XCN[] ret = null;
257            try {
258                Type[] t = this.getField(2);
259                return t.length;  
260            } catch (ClassCastException cce) {
261                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
262                throw new RuntimeException(cce);
263            } catch (HL7Exception he) {
264                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
265                throw new RuntimeException(he);
266            }
267        }
268    
269    
270        /**
271         * Returns a specific repetition of
272         * PES-2: "Sender Individual Name" - creates it if necessary
273         *
274         * @param rep The repetition index (0-indexed)
275         */
276        public XCN getSenderIndividualName(int rep) { 
277            XCN ret = null;
278            try {
279                Type t = this.getField(2, rep);
280                ret = (XCN)t;
281            } catch (ClassCastException cce) {
282                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
283                throw new RuntimeException(cce);
284            } catch (HL7Exception he) {
285                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
286                throw new RuntimeException(he);
287            }
288            return ret;
289        }
290    
291        /**
292         * Returns a specific repetition of
293         * PES-2: "Sender Individual Name" - creates it if necessary
294         *
295         * @param rep The repetition index (0-indexed)
296         */
297        public XCN getPes2_SenderIndividualName(int rep) { 
298            XCN ret = null;
299            try {
300                Type t = this.getField(2, rep);
301                ret = (XCN)t;
302            } catch (ClassCastException cce) {
303                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
304                throw new RuntimeException(cce);
305            } catch (HL7Exception he) {
306                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
307                throw new RuntimeException(he);
308            }
309            return ret;
310        }
311    
312    
313        /**
314         * Returns a count of the current number of repetitions of Sender Individual Name (PES-2).
315         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
316         * it will return zero.
317         */
318        public int getPes2_SenderIndividualNameReps() {
319            XCN[] ret = null;
320            try {
321                Type[] t = this.getField(2);
322                return t.length;  
323            } catch (ClassCastException cce) {
324                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
325                throw new RuntimeException(cce);
326            } catch (HL7Exception he) {
327                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
328                throw new RuntimeException(he);
329            }
330        }
331    
332    
333    
334        /**
335         * Inserts a repetition of
336         * PES-2: "Sender Individual Name" at a specific index
337         *
338         * @param rep The repetition index (0-indexed)
339         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
340         */
341        public XCN insertSenderIndividualName(int rep) throws HL7Exception { 
342            return (XCN) super.insertRepetition(2, rep);
343        }
344    
345    
346    
347        /**
348         * Inserts a repetition of
349         * PES-2: "Sender Individual Name" at a specific index
350         *
351         * @param rep The repetition index (0-indexed)
352         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
353         */
354        public XCN insertPes2_SenderIndividualName(int rep) throws HL7Exception { 
355            return (XCN) super.insertRepetition(2, rep);
356        }
357    
358    
359        /**
360         * Removes a repetition of
361         * PES-2: "Sender Individual Name" at a specific index
362         *
363         * @param rep The repetition index (0-indexed)
364         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
365         */
366        public XCN removeSenderIndividualName(int rep) throws HL7Exception { 
367            return (XCN) super.removeRepetition(2, rep);
368        }
369    
370    
371        /**
372         * Removes a repetition of
373         * PES-2: "Sender Individual Name" at a specific index
374         *
375         * @param rep The repetition index (0-indexed)
376         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
377         */
378        public XCN removePes2_SenderIndividualName(int rep) throws HL7Exception { 
379            return (XCN) super.removeRepetition(2, rep);
380        }
381    
382    
383    
384        /**
385         * Returns all repetitions of Sender Address (PES-3).
386         */
387        public XAD[] getSenderAddress() {
388            XAD[] ret = null;
389            try {
390                Type[] t = this.getField(3);  
391                ret = new XAD[t.length];
392                for (int i = 0; i < ret.length; i++) {
393                    ret[i] = (XAD)t[i];
394                }
395            } catch (ClassCastException cce) {
396                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
397                throw new RuntimeException(cce);
398            } catch (HL7Exception he) {
399                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
400                throw new RuntimeException(he);
401            }
402            return ret;
403        }
404    
405    
406        /**
407         * Returns a count of the current number of repetitions of Sender Address (PES-3).
408         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
409         * it will return zero.
410         */
411        public int getSenderAddressReps() {
412            XAD[] ret = null;
413            try {
414                Type[] t = this.getField(3);
415                return t.length;  
416            } catch (ClassCastException cce) {
417                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
418                throw new RuntimeException(cce);
419            } catch (HL7Exception he) {
420                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
421                throw new RuntimeException(he);
422            }
423        }
424    
425    
426        /**
427         * Returns a specific repetition of
428         * PES-3: "Sender Address" - creates it if necessary
429         *
430         * @param rep The repetition index (0-indexed)
431         */
432        public XAD getSenderAddress(int rep) { 
433            XAD ret = null;
434            try {
435                Type t = this.getField(3, rep);
436                ret = (XAD)t;
437            } catch (ClassCastException cce) {
438                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
439                throw new RuntimeException(cce);
440            } catch (HL7Exception he) {
441                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
442                throw new RuntimeException(he);
443            }
444            return ret;
445        }
446    
447        /**
448         * Returns a specific repetition of
449         * PES-3: "Sender Address" - creates it if necessary
450         *
451         * @param rep The repetition index (0-indexed)
452         */
453        public XAD getPes3_SenderAddress(int rep) { 
454            XAD ret = null;
455            try {
456                Type t = this.getField(3, rep);
457                ret = (XAD)t;
458            } catch (ClassCastException cce) {
459                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
460                throw new RuntimeException(cce);
461            } catch (HL7Exception he) {
462                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
463                throw new RuntimeException(he);
464            }
465            return ret;
466        }
467    
468    
469        /**
470         * Returns a count of the current number of repetitions of Sender Address (PES-3).
471         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
472         * it will return zero.
473         */
474        public int getPes3_SenderAddressReps() {
475            XAD[] ret = null;
476            try {
477                Type[] t = this.getField(3);
478                return t.length;  
479            } catch (ClassCastException cce) {
480                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
481                throw new RuntimeException(cce);
482            } catch (HL7Exception he) {
483                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
484                throw new RuntimeException(he);
485            }
486        }
487    
488    
489    
490        /**
491         * Inserts a repetition of
492         * PES-3: "Sender Address" at a specific index
493         *
494         * @param rep The repetition index (0-indexed)
495         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
496         */
497        public XAD insertSenderAddress(int rep) throws HL7Exception { 
498            return (XAD) super.insertRepetition(3, rep);
499        }
500    
501    
502    
503        /**
504         * Inserts a repetition of
505         * PES-3: "Sender Address" at a specific index
506         *
507         * @param rep The repetition index (0-indexed)
508         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
509         */
510        public XAD insertPes3_SenderAddress(int rep) throws HL7Exception { 
511            return (XAD) super.insertRepetition(3, rep);
512        }
513    
514    
515        /**
516         * Removes a repetition of
517         * PES-3: "Sender Address" at a specific index
518         *
519         * @param rep The repetition index (0-indexed)
520         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
521         */
522        public XAD removeSenderAddress(int rep) throws HL7Exception { 
523            return (XAD) super.removeRepetition(3, rep);
524        }
525    
526    
527        /**
528         * Removes a repetition of
529         * PES-3: "Sender Address" at a specific index
530         *
531         * @param rep The repetition index (0-indexed)
532         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
533         */
534        public XAD removePes3_SenderAddress(int rep) throws HL7Exception { 
535            return (XAD) super.removeRepetition(3, rep);
536        }
537    
538    
539    
540        /**
541         * Returns all repetitions of Sender Telephone (PES-4).
542         */
543        public XTN[] getSenderTelephone() {
544            XTN[] ret = null;
545            try {
546                Type[] t = this.getField(4);  
547                ret = new XTN[t.length];
548                for (int i = 0; i < ret.length; i++) {
549                    ret[i] = (XTN)t[i];
550                }
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            return ret;
559        }
560    
561    
562        /**
563         * Returns a count of the current number of repetitions of Sender Telephone (PES-4).
564         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
565         * it will return zero.
566         */
567        public int getSenderTelephoneReps() {
568            XTN[] ret = null;
569            try {
570                Type[] t = this.getField(4);
571                return t.length;  
572            } catch (ClassCastException cce) {
573                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
574                throw new RuntimeException(cce);
575            } catch (HL7Exception he) {
576                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
577                throw new RuntimeException(he);
578            }
579        }
580    
581    
582        /**
583         * Returns a specific repetition of
584         * PES-4: "Sender Telephone" - creates it if necessary
585         *
586         * @param rep The repetition index (0-indexed)
587         */
588        public XTN getSenderTelephone(int rep) { 
589            XTN ret = null;
590            try {
591                Type t = this.getField(4, rep);
592                ret = (XTN)t;
593            } catch (ClassCastException cce) {
594                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
595                throw new RuntimeException(cce);
596            } catch (HL7Exception he) {
597                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
598                throw new RuntimeException(he);
599            }
600            return ret;
601        }
602    
603        /**
604         * Returns a specific repetition of
605         * PES-4: "Sender Telephone" - creates it if necessary
606         *
607         * @param rep The repetition index (0-indexed)
608         */
609        public XTN getPes4_SenderTelephone(int rep) { 
610            XTN ret = null;
611            try {
612                Type t = this.getField(4, rep);
613                ret = (XTN)t;
614            } catch (ClassCastException cce) {
615                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
616                throw new RuntimeException(cce);
617            } catch (HL7Exception he) {
618                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
619                throw new RuntimeException(he);
620            }
621            return ret;
622        }
623    
624    
625        /**
626         * Returns a count of the current number of repetitions of Sender Telephone (PES-4).
627         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
628         * it will return zero.
629         */
630        public int getPes4_SenderTelephoneReps() {
631            XTN[] ret = null;
632            try {
633                Type[] t = this.getField(4);
634                return t.length;  
635            } catch (ClassCastException cce) {
636                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
637                throw new RuntimeException(cce);
638            } catch (HL7Exception he) {
639                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
640                throw new RuntimeException(he);
641            }
642        }
643    
644    
645    
646        /**
647         * Inserts a repetition of
648         * PES-4: "Sender Telephone" at a specific index
649         *
650         * @param rep The repetition index (0-indexed)
651         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
652         */
653        public XTN insertSenderTelephone(int rep) throws HL7Exception { 
654            return (XTN) super.insertRepetition(4, rep);
655        }
656    
657    
658    
659        /**
660         * Inserts a repetition of
661         * PES-4: "Sender Telephone" at a specific index
662         *
663         * @param rep The repetition index (0-indexed)
664         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
665         */
666        public XTN insertPes4_SenderTelephone(int rep) throws HL7Exception { 
667            return (XTN) super.insertRepetition(4, rep);
668        }
669    
670    
671        /**
672         * Removes a repetition of
673         * PES-4: "Sender Telephone" at a specific index
674         *
675         * @param rep The repetition index (0-indexed)
676         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
677         */
678        public XTN removeSenderTelephone(int rep) throws HL7Exception { 
679            return (XTN) super.removeRepetition(4, rep);
680        }
681    
682    
683        /**
684         * Removes a repetition of
685         * PES-4: "Sender Telephone" at a specific index
686         *
687         * @param rep The repetition index (0-indexed)
688         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
689         */
690        public XTN removePes4_SenderTelephone(int rep) throws HL7Exception { 
691            return (XTN) super.removeRepetition(4, rep);
692        }
693    
694    
695    
696    
697        /**
698         * Returns
699         * PES-5: "Sender Event Identifier" - creates it if necessary
700         */
701        public EI getSenderEventIdentifier() { 
702            EI ret = null;
703            try {
704                Type t = this.getField(5, 0);
705                ret = (EI)t;
706            } catch (ClassCastException cce) {
707                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
708                throw new RuntimeException(cce);
709            } catch (HL7Exception he) {
710                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
711                throw new RuntimeException(he);
712            }
713            return ret;
714        }
715    
716    
717        /**
718         * Returns
719         * PES-5: "Sender Event Identifier" - creates it if necessary
720         */
721        public EI getPes5_SenderEventIdentifier() { 
722            EI ret = null;
723            try {
724                Type t = this.getField(5, 0);
725                ret = (EI)t;
726            } catch (ClassCastException cce) {
727                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
728                throw new RuntimeException(cce);
729            } catch (HL7Exception he) {
730                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
731                throw new RuntimeException(he);
732            }
733            return ret;
734        }
735    
736    
737    
738        /**
739         * Returns
740         * PES-6: "Sender Sequence Number" - creates it if necessary
741         */
742        public NM getSenderSequenceNumber() { 
743            NM ret = null;
744            try {
745                Type t = this.getField(6, 0);
746                ret = (NM)t;
747            } catch (ClassCastException cce) {
748                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
749                throw new RuntimeException(cce);
750            } catch (HL7Exception he) {
751                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
752                throw new RuntimeException(he);
753            }
754            return ret;
755        }
756    
757    
758        /**
759         * Returns
760         * PES-6: "Sender Sequence Number" - creates it if necessary
761         */
762        public NM getPes6_SenderSequenceNumber() { 
763            NM ret = null;
764            try {
765                Type t = this.getField(6, 0);
766                ret = (NM)t;
767            } catch (ClassCastException cce) {
768                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
769                throw new RuntimeException(cce);
770            } catch (HL7Exception he) {
771                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
772                throw new RuntimeException(he);
773            }
774            return ret;
775        }
776    
777    
778        /**
779         * Returns all repetitions of Sender Event Description (PES-7).
780         */
781        public FT[] getSenderEventDescription() {
782            FT[] ret = null;
783            try {
784                Type[] t = this.getField(7);  
785                ret = new FT[t.length];
786                for (int i = 0; i < ret.length; i++) {
787                    ret[i] = (FT)t[i];
788                }
789            } catch (ClassCastException cce) {
790                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
791                throw new RuntimeException(cce);
792            } catch (HL7Exception he) {
793                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
794                throw new RuntimeException(he);
795            }
796            return ret;
797        }
798    
799    
800        /**
801         * Returns a count of the current number of repetitions of Sender Event Description (PES-7).
802         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
803         * it will return zero.
804         */
805        public int getSenderEventDescriptionReps() {
806            FT[] ret = null;
807            try {
808                Type[] t = this.getField(7);
809                return t.length;  
810            } catch (ClassCastException cce) {
811                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
812                throw new RuntimeException(cce);
813            } catch (HL7Exception he) {
814                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
815                throw new RuntimeException(he);
816            }
817        }
818    
819    
820        /**
821         * Returns a specific repetition of
822         * PES-7: "Sender Event Description" - creates it if necessary
823         *
824         * @param rep The repetition index (0-indexed)
825         */
826        public FT getSenderEventDescription(int rep) { 
827            FT ret = null;
828            try {
829                Type t = this.getField(7, rep);
830                ret = (FT)t;
831            } catch (ClassCastException cce) {
832                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
833                throw new RuntimeException(cce);
834            } catch (HL7Exception he) {
835                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
836                throw new RuntimeException(he);
837            }
838            return ret;
839        }
840    
841        /**
842         * Returns a specific repetition of
843         * PES-7: "Sender Event Description" - creates it if necessary
844         *
845         * @param rep The repetition index (0-indexed)
846         */
847        public FT getPes7_SenderEventDescription(int rep) { 
848            FT ret = null;
849            try {
850                Type t = this.getField(7, rep);
851                ret = (FT)t;
852            } catch (ClassCastException cce) {
853                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
854                throw new RuntimeException(cce);
855            } catch (HL7Exception he) {
856                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
857                throw new RuntimeException(he);
858            }
859            return ret;
860        }
861    
862    
863        /**
864         * Returns a count of the current number of repetitions of Sender Event Description (PES-7).
865         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
866         * it will return zero.
867         */
868        public int getPes7_SenderEventDescriptionReps() {
869            FT[] ret = null;
870            try {
871                Type[] t = this.getField(7);
872                return t.length;  
873            } catch (ClassCastException cce) {
874                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
875                throw new RuntimeException(cce);
876            } catch (HL7Exception he) {
877                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
878                throw new RuntimeException(he);
879            }
880        }
881    
882    
883    
884        /**
885         * Inserts a repetition of
886         * PES-7: "Sender Event Description" at a specific index
887         *
888         * @param rep The repetition index (0-indexed)
889         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
890         */
891        public FT insertSenderEventDescription(int rep) throws HL7Exception { 
892            return (FT) super.insertRepetition(7, rep);
893        }
894    
895    
896    
897        /**
898         * Inserts a repetition of
899         * PES-7: "Sender Event Description" at a specific index
900         *
901         * @param rep The repetition index (0-indexed)
902         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
903         */
904        public FT insertPes7_SenderEventDescription(int rep) throws HL7Exception { 
905            return (FT) super.insertRepetition(7, rep);
906        }
907    
908    
909        /**
910         * Removes a repetition of
911         * PES-7: "Sender Event Description" at a specific index
912         *
913         * @param rep The repetition index (0-indexed)
914         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
915         */
916        public FT removeSenderEventDescription(int rep) throws HL7Exception { 
917            return (FT) super.removeRepetition(7, rep);
918        }
919    
920    
921        /**
922         * Removes a repetition of
923         * PES-7: "Sender Event Description" at a specific index
924         *
925         * @param rep The repetition index (0-indexed)
926         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
927         */
928        public FT removePes7_SenderEventDescription(int rep) throws HL7Exception { 
929            return (FT) super.removeRepetition(7, rep);
930        }
931    
932    
933    
934    
935        /**
936         * Returns
937         * PES-8: "Sender Comment" - creates it if necessary
938         */
939        public FT getSenderComment() { 
940            FT ret = null;
941            try {
942                Type t = this.getField(8, 0);
943                ret = (FT)t;
944            } catch (ClassCastException cce) {
945                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
946                throw new RuntimeException(cce);
947            } catch (HL7Exception he) {
948                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
949                throw new RuntimeException(he);
950            }
951            return ret;
952        }
953    
954    
955        /**
956         * Returns
957         * PES-8: "Sender Comment" - creates it if necessary
958         */
959        public FT getPes8_SenderComment() { 
960            FT ret = null;
961            try {
962                Type t = this.getField(8, 0);
963                ret = (FT)t;
964            } catch (ClassCastException cce) {
965                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
966                throw new RuntimeException(cce);
967            } catch (HL7Exception he) {
968                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
969                throw new RuntimeException(he);
970            }
971            return ret;
972        }
973    
974    
975    
976        /**
977         * Returns
978         * PES-9: "Sender Aware Date/Time" - creates it if necessary
979         */
980        public TS getSenderAwareDateTime() { 
981            TS ret = null;
982            try {
983                Type t = this.getField(9, 0);
984                ret = (TS)t;
985            } catch (ClassCastException cce) {
986                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
987                throw new RuntimeException(cce);
988            } catch (HL7Exception he) {
989                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
990                throw new RuntimeException(he);
991            }
992            return ret;
993        }
994    
995    
996        /**
997         * Returns
998         * PES-9: "Sender Aware Date/Time" - creates it if necessary
999         */
1000        public TS getPes9_SenderAwareDateTime() { 
1001            TS ret = null;
1002            try {
1003                Type t = this.getField(9, 0);
1004                ret = (TS)t;
1005            } catch (ClassCastException cce) {
1006                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1007                throw new RuntimeException(cce);
1008            } catch (HL7Exception he) {
1009                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1010                throw new RuntimeException(he);
1011            }
1012            return ret;
1013        }
1014    
1015    
1016    
1017        /**
1018         * Returns
1019         * PES-10: "Event Report Date" - creates it if necessary
1020         */
1021        public TS getEventReportDate() { 
1022            TS ret = null;
1023            try {
1024                Type t = this.getField(10, 0);
1025                ret = (TS)t;
1026            } catch (ClassCastException cce) {
1027                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1028                throw new RuntimeException(cce);
1029            } catch (HL7Exception he) {
1030                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1031                throw new RuntimeException(he);
1032            }
1033            return ret;
1034        }
1035    
1036    
1037        /**
1038         * Returns
1039         * PES-10: "Event Report Date" - creates it if necessary
1040         */
1041        public TS getPes10_EventReportDate() { 
1042            TS ret = null;
1043            try {
1044                Type t = this.getField(10, 0);
1045                ret = (TS)t;
1046            } catch (ClassCastException cce) {
1047                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1048                throw new RuntimeException(cce);
1049            } catch (HL7Exception he) {
1050                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1051                throw new RuntimeException(he);
1052            }
1053            return ret;
1054        }
1055    
1056    
1057        /**
1058         * Returns all repetitions of Event Report Timing/Type (PES-11).
1059         */
1060        public ID[] getEventReportTimingType() {
1061            ID[] ret = null;
1062            try {
1063                Type[] t = this.getField(11);  
1064                ret = new ID[t.length];
1065                for (int i = 0; i < ret.length; i++) {
1066                    ret[i] = (ID)t[i];
1067                }
1068            } catch (ClassCastException cce) {
1069                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1070                throw new RuntimeException(cce);
1071            } catch (HL7Exception he) {
1072                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1073                throw new RuntimeException(he);
1074            }
1075            return ret;
1076        }
1077    
1078    
1079        /**
1080         * Returns a count of the current number of repetitions of Event Report Timing/Type (PES-11).
1081         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1082         * it will return zero.
1083         */
1084        public int getEventReportTimingTypeReps() {
1085            ID[] ret = null;
1086            try {
1087                Type[] t = this.getField(11);
1088                return t.length;  
1089            } catch (ClassCastException cce) {
1090                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1091                throw new RuntimeException(cce);
1092            } catch (HL7Exception he) {
1093                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1094                throw new RuntimeException(he);
1095            }
1096        }
1097    
1098    
1099        /**
1100         * Returns a specific repetition of
1101         * PES-11: "Event Report Timing/Type" - creates it if necessary
1102         *
1103         * @param rep The repetition index (0-indexed)
1104         */
1105        public ID getEventReportTimingType(int rep) { 
1106            ID ret = null;
1107            try {
1108                Type t = this.getField(11, rep);
1109                ret = (ID)t;
1110            } catch (ClassCastException cce) {
1111                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1112                throw new RuntimeException(cce);
1113            } catch (HL7Exception he) {
1114                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1115                throw new RuntimeException(he);
1116            }
1117            return ret;
1118        }
1119    
1120        /**
1121         * Returns a specific repetition of
1122         * PES-11: "Event Report Timing/Type" - creates it if necessary
1123         *
1124         * @param rep The repetition index (0-indexed)
1125         */
1126        public ID getPes11_EventReportTimingType(int rep) { 
1127            ID ret = null;
1128            try {
1129                Type t = this.getField(11, rep);
1130                ret = (ID)t;
1131            } catch (ClassCastException cce) {
1132                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1133                throw new RuntimeException(cce);
1134            } catch (HL7Exception he) {
1135                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1136                throw new RuntimeException(he);
1137            }
1138            return ret;
1139        }
1140    
1141    
1142        /**
1143         * Returns a count of the current number of repetitions of Event Report Timing/Type (PES-11).
1144         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1145         * it will return zero.
1146         */
1147        public int getPes11_EventReportTimingTypeReps() {
1148            ID[] ret = null;
1149            try {
1150                Type[] t = this.getField(11);
1151                return t.length;  
1152            } catch (ClassCastException cce) {
1153                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1154                throw new RuntimeException(cce);
1155            } catch (HL7Exception he) {
1156                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1157                throw new RuntimeException(he);
1158            }
1159        }
1160    
1161    
1162    
1163        /**
1164         * Inserts a repetition of
1165         * PES-11: "Event Report Timing/Type" at a specific index
1166         *
1167         * @param rep The repetition index (0-indexed)
1168         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1169         */
1170        public ID insertEventReportTimingType(int rep) throws HL7Exception { 
1171            return (ID) super.insertRepetition(11, rep);
1172        }
1173    
1174    
1175    
1176        /**
1177         * Inserts a repetition of
1178         * PES-11: "Event Report Timing/Type" at a specific index
1179         *
1180         * @param rep The repetition index (0-indexed)
1181         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1182         */
1183        public ID insertPes11_EventReportTimingType(int rep) throws HL7Exception { 
1184            return (ID) super.insertRepetition(11, rep);
1185        }
1186    
1187    
1188        /**
1189         * Removes a repetition of
1190         * PES-11: "Event Report Timing/Type" at a specific index
1191         *
1192         * @param rep The repetition index (0-indexed)
1193         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1194         */
1195        public ID removeEventReportTimingType(int rep) throws HL7Exception { 
1196            return (ID) super.removeRepetition(11, rep);
1197        }
1198    
1199    
1200        /**
1201         * Removes a repetition of
1202         * PES-11: "Event Report Timing/Type" at a specific index
1203         *
1204         * @param rep The repetition index (0-indexed)
1205         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1206         */
1207        public ID removePes11_EventReportTimingType(int rep) throws HL7Exception { 
1208            return (ID) super.removeRepetition(11, rep);
1209        }
1210    
1211    
1212    
1213    
1214        /**
1215         * Returns
1216         * PES-12: "Event Report Source" - creates it if necessary
1217         */
1218        public ID getEventReportSource() { 
1219            ID ret = null;
1220            try {
1221                Type t = this.getField(12, 0);
1222                ret = (ID)t;
1223            } catch (ClassCastException cce) {
1224                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1225                throw new RuntimeException(cce);
1226            } catch (HL7Exception he) {
1227                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1228                throw new RuntimeException(he);
1229            }
1230            return ret;
1231        }
1232    
1233    
1234        /**
1235         * Returns
1236         * PES-12: "Event Report Source" - creates it if necessary
1237         */
1238        public ID getPes12_EventReportSource() { 
1239            ID ret = null;
1240            try {
1241                Type t = this.getField(12, 0);
1242                ret = (ID)t;
1243            } catch (ClassCastException cce) {
1244                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1245                throw new RuntimeException(cce);
1246            } catch (HL7Exception he) {
1247                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1248                throw new RuntimeException(he);
1249            }
1250            return ret;
1251        }
1252    
1253    
1254        /**
1255         * Returns all repetitions of Event Reported To (PES-13).
1256         */
1257        public ID[] getEventReportedTo() {
1258            ID[] ret = null;
1259            try {
1260                Type[] t = this.getField(13);  
1261                ret = new ID[t.length];
1262                for (int i = 0; i < ret.length; i++) {
1263                    ret[i] = (ID)t[i];
1264                }
1265            } catch (ClassCastException cce) {
1266                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1267                throw new RuntimeException(cce);
1268            } catch (HL7Exception he) {
1269                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1270                throw new RuntimeException(he);
1271            }
1272            return ret;
1273        }
1274    
1275    
1276        /**
1277         * Returns a count of the current number of repetitions of Event Reported To (PES-13).
1278         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1279         * it will return zero.
1280         */
1281        public int getEventReportedToReps() {
1282            ID[] ret = null;
1283            try {
1284                Type[] t = this.getField(13);
1285                return t.length;  
1286            } catch (ClassCastException cce) {
1287                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1288                throw new RuntimeException(cce);
1289            } catch (HL7Exception he) {
1290                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1291                throw new RuntimeException(he);
1292            }
1293        }
1294    
1295    
1296        /**
1297         * Returns a specific repetition of
1298         * PES-13: "Event Reported To" - creates it if necessary
1299         *
1300         * @param rep The repetition index (0-indexed)
1301         */
1302        public ID getEventReportedTo(int rep) { 
1303            ID ret = null;
1304            try {
1305                Type t = this.getField(13, rep);
1306                ret = (ID)t;
1307            } catch (ClassCastException cce) {
1308                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1309                throw new RuntimeException(cce);
1310            } catch (HL7Exception he) {
1311                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1312                throw new RuntimeException(he);
1313            }
1314            return ret;
1315        }
1316    
1317        /**
1318         * Returns a specific repetition of
1319         * PES-13: "Event Reported To" - creates it if necessary
1320         *
1321         * @param rep The repetition index (0-indexed)
1322         */
1323        public ID getPes13_EventReportedTo(int rep) { 
1324            ID ret = null;
1325            try {
1326                Type t = this.getField(13, rep);
1327                ret = (ID)t;
1328            } catch (ClassCastException cce) {
1329                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1330                throw new RuntimeException(cce);
1331            } catch (HL7Exception he) {
1332                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1333                throw new RuntimeException(he);
1334            }
1335            return ret;
1336        }
1337    
1338    
1339        /**
1340         * Returns a count of the current number of repetitions of Event Reported To (PES-13).
1341         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1342         * it will return zero.
1343         */
1344        public int getPes13_EventReportedToReps() {
1345            ID[] ret = null;
1346            try {
1347                Type[] t = this.getField(13);
1348                return t.length;  
1349            } catch (ClassCastException cce) {
1350                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1351                throw new RuntimeException(cce);
1352            } catch (HL7Exception he) {
1353                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1354                throw new RuntimeException(he);
1355            }
1356        }
1357    
1358    
1359    
1360        /**
1361         * Inserts a repetition of
1362         * PES-13: "Event Reported To" at a specific index
1363         *
1364         * @param rep The repetition index (0-indexed)
1365         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1366         */
1367        public ID insertEventReportedTo(int rep) throws HL7Exception { 
1368            return (ID) super.insertRepetition(13, rep);
1369        }
1370    
1371    
1372    
1373        /**
1374         * Inserts a repetition of
1375         * PES-13: "Event Reported To" at a specific index
1376         *
1377         * @param rep The repetition index (0-indexed)
1378         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1379         */
1380        public ID insertPes13_EventReportedTo(int rep) throws HL7Exception { 
1381            return (ID) super.insertRepetition(13, rep);
1382        }
1383    
1384    
1385        /**
1386         * Removes a repetition of
1387         * PES-13: "Event Reported To" at a specific index
1388         *
1389         * @param rep The repetition index (0-indexed)
1390         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1391         */
1392        public ID removeEventReportedTo(int rep) throws HL7Exception { 
1393            return (ID) super.removeRepetition(13, rep);
1394        }
1395    
1396    
1397        /**
1398         * Removes a repetition of
1399         * PES-13: "Event Reported To" at a specific index
1400         *
1401         * @param rep The repetition index (0-indexed)
1402         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1403         */
1404        public ID removePes13_EventReportedTo(int rep) throws HL7Exception { 
1405            return (ID) super.removeRepetition(13, rep);
1406        }
1407    
1408    
1409    
1410    
1411    
1412    
1413        /** {@inheritDoc} */   
1414        protected Type createNewTypeWithoutReflection(int field) {
1415           switch (field) {
1416              case 0: return new XON(getMessage());
1417              case 1: return new XCN(getMessage());
1418              case 2: return new XAD(getMessage());
1419              case 3: return new XTN(getMessage());
1420              case 4: return new EI(getMessage());
1421              case 5: return new NM(getMessage());
1422              case 6: return new FT(getMessage());
1423              case 7: return new FT(getMessage());
1424              case 8: return new TS(getMessage());
1425              case 9: return new TS(getMessage());
1426              case 10: return new ID(getMessage(), new Integer( 234 ));
1427              case 11: return new ID(getMessage(), new Integer( 235 ));
1428              case 12: return new ID(getMessage(), new Integer( 236 ));
1429              default: return null;
1430           }
1431       }
1432    
1433    
1434    }
1435