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.message;
009    
010    import ca.uhn.hl7v2.model.v24.group.*;
011    import ca.uhn.hl7v2.model.v24.segment.*;
012    
013    import ca.uhn.log.HapiLogFactory;
014    import ca.uhn.hl7v2.HL7Exception;
015    import ca.uhn.hl7v2.parser.ModelClassFactory;
016    import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
017    import ca.uhn.hl7v2.model.AbstractMessage;
018    
019    /**
020     * <p>Represents a RRI_I12 message structure (see chapter 11). This structure contains the 
021     * following elements: </p>
022     * <ul>
023                     * <li>1: MSH (Message Header) <b> </b></li>
024                     * <li>2: MSA (Message Acknowledgment) <b>optional </b></li>
025                     * <li>3: RF1 (Referral Information) <b>optional </b></li>
026                     * <li>4: RRI_I12_AUTHORIZATION_CONTACT (a Group object) <b>optional </b></li>
027                     * <li>5: RRI_I12_PROVIDER_CONTACT (a Group object) <b> repeating</b></li>
028                     * <li>6: PID (Patient identification) <b> </b></li>
029                     * <li>7: ACC (Accident) <b>optional </b></li>
030                     * <li>8: DG1 (Diagnosis) <b>optional repeating</b></li>
031                     * <li>9: DRG (Diagnosis Related Group) <b>optional repeating</b></li>
032                     * <li>10: AL1 (Patient allergy information) <b>optional repeating</b></li>
033                     * <li>11: RRI_I12_PROCEDURE (a Group object) <b>optional repeating</b></li>
034                     * <li>12: RRI_I12_OBSERVATION (a Group object) <b>optional repeating</b></li>
035                     * <li>13: RRI_I12_PATIENT_VISIT (a Group object) <b>optional </b></li>
036                     * <li>14: NTE (Notes and Comments) <b>optional repeating</b></li>
037     * </ul>
038     */
039    public class RRI_I12 extends AbstractMessage  {
040    
041        /**
042         * Creates a new RRI_I12 message with DefaultModelClassFactory. 
043         */ 
044        public RRI_I12() { 
045           this(new DefaultModelClassFactory());
046        }
047    
048        /** 
049         * Creates a new RRI_I12 message with custom ModelClassFactory.
050         */
051        public RRI_I12(ModelClassFactory factory) {
052           super(factory);
053           init(factory);
054        }
055    
056        private void init(ModelClassFactory factory) {
057           try {
058                              this.add(MSH.class, true, false);
059                              this.add(MSA.class, false, false);
060                              this.add(RF1.class, false, false);
061                              this.add(RRI_I12_AUTHORIZATION_CONTACT.class, false, false);
062                              this.add(RRI_I12_PROVIDER_CONTACT.class, true, true);
063                              this.add(PID.class, true, false);
064                              this.add(ACC.class, false, false);
065                              this.add(DG1.class, false, true);
066                              this.add(DRG.class, false, true);
067                              this.add(AL1.class, false, true);
068                              this.add(RRI_I12_PROCEDURE.class, false, true);
069                              this.add(RRI_I12_OBSERVATION.class, false, true);
070                              this.add(RRI_I12_PATIENT_VISIT.class, false, false);
071                              this.add(NTE.class, false, true);
072           } catch(HL7Exception e) {
073              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating RRI_I12 - this is probably a bug in the source code generator.", e);
074           }
075        }
076    
077        /** 
078         * Returns "2.4"
079         */
080        public String getVersion() {
081           return "2.4";
082        }
083    
084    
085    
086        /**
087         * Returns
088         * MSH (Message Header) - creates it if necessary
089         */
090        public MSH getMSH() { 
091           MSH ret = null;
092           try {
093              ret = (MSH)this.get("MSH");
094           } catch(HL7Exception e) {
095              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
096              throw new RuntimeException(e);
097           }
098           return ret;
099        }
100    
101    
102    
103    
104        /**
105         * Returns
106         * MSA (Message Acknowledgment) - creates it if necessary
107         */
108        public MSA getMSA() { 
109           MSA ret = null;
110           try {
111              ret = (MSA)this.get("MSA");
112           } catch(HL7Exception e) {
113              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
114              throw new RuntimeException(e);
115           }
116           return ret;
117        }
118    
119    
120    
121    
122        /**
123         * Returns
124         * RF1 (Referral Information) - creates it if necessary
125         */
126        public RF1 getRF1() { 
127           RF1 ret = null;
128           try {
129              ret = (RF1)this.get("RF1");
130           } catch(HL7Exception e) {
131              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
132              throw new RuntimeException(e);
133           }
134           return ret;
135        }
136    
137    
138    
139    
140        /**
141         * Returns
142         * AUTHORIZATION_CONTACT (a Group object) - creates it if necessary
143         */
144        public RRI_I12_AUTHORIZATION_CONTACT getAUTHORIZATION_CONTACT() { 
145           RRI_I12_AUTHORIZATION_CONTACT ret = null;
146           try {
147              ret = (RRI_I12_AUTHORIZATION_CONTACT)this.get("AUTHORIZATION_CONTACT");
148           } catch(HL7Exception e) {
149              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
150              throw new RuntimeException(e);
151           }
152           return ret;
153        }
154    
155    
156    
157    
158        /**
159         * Returns
160         * the first repetition of 
161         * PROVIDER_CONTACT (a Group object) - creates it if necessary
162         */
163        public RRI_I12_PROVIDER_CONTACT getPROVIDER_CONTACT() { 
164           RRI_I12_PROVIDER_CONTACT ret = null;
165           try {
166              ret = (RRI_I12_PROVIDER_CONTACT)this.get("PROVIDER_CONTACT");
167           } catch(HL7Exception e) {
168              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
169              throw new RuntimeException(e);
170           }
171           return ret;
172        }
173    
174    
175        /**
176         * Returns a specific repetition of
177         * PROVIDER_CONTACT (a Group object) - creates it if necessary
178         *
179         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
180         * @throws HL7Exception if the repetition requested is more than one 
181         *     greater than the number of existing repetitions.
182         */
183        public RRI_I12_PROVIDER_CONTACT getPROVIDER_CONTACT(int rep) { 
184           RRI_I12_PROVIDER_CONTACT ret = null;
185           try {
186              ret = (RRI_I12_PROVIDER_CONTACT)this.get("PROVIDER_CONTACT", rep);
187           } catch(HL7Exception e) {
188              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
189              throw new RuntimeException(e);
190           }
191           return ret;
192        }
193    
194        /** 
195         * Returns the number of existing repetitions of PROVIDER_CONTACT 
196         */ 
197        public int getPROVIDER_CONTACTReps() { 
198            int reps = -1; 
199            try { 
200                reps = this.getAll("PROVIDER_CONTACT").length; 
201            } catch (HL7Exception e) { 
202                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
203                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
204                throw new RuntimeException(message);
205            } 
206            return reps; 
207        } 
208    
209        /**
210         * Inserts a specific repetition of PROVIDER_CONTACT (a Group object)
211         * @see AbstractGroup\#insertRepetition(Structure, int) 
212         */
213        public void insertPROVIDER_CONTACT(RRI_I12_PROVIDER_CONTACT structure, int rep) throws HL7Exception { 
214           super.insertRepetition( "PROVIDER_CONTACT", structure, rep);
215        }
216    
217    
218        /**
219         * Inserts a specific repetition of PROVIDER_CONTACT (a Group object)
220         * @see AbstractGroup\#insertRepetition(Structure, int) 
221         */
222        public RRI_I12_PROVIDER_CONTACT insertPROVIDER_CONTACT(int rep) throws HL7Exception { 
223           return (RRI_I12_PROVIDER_CONTACT)super.insertRepetition("PROVIDER_CONTACT", rep);
224        }
225    
226    
227        /**
228         * Removes a specific repetition of PROVIDER_CONTACT (a Group object)
229         * @see AbstractGroup\#removeRepetition(String, int) 
230         */
231        public RRI_I12_PROVIDER_CONTACT removePROVIDER_CONTACT(int rep) throws HL7Exception { 
232           return (RRI_I12_PROVIDER_CONTACT)super.removeRepetition("PROVIDER_CONTACT", rep);
233        }
234    
235    
236    
237        /**
238         * Returns
239         * PID (Patient identification) - creates it if necessary
240         */
241        public PID getPID() { 
242           PID ret = null;
243           try {
244              ret = (PID)this.get("PID");
245           } catch(HL7Exception e) {
246              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
247              throw new RuntimeException(e);
248           }
249           return ret;
250        }
251    
252    
253    
254    
255        /**
256         * Returns
257         * ACC (Accident) - creates it if necessary
258         */
259        public ACC getACC() { 
260           ACC ret = null;
261           try {
262              ret = (ACC)this.get("ACC");
263           } catch(HL7Exception e) {
264              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
265              throw new RuntimeException(e);
266           }
267           return ret;
268        }
269    
270    
271    
272    
273        /**
274         * Returns
275         * the first repetition of 
276         * DG1 (Diagnosis) - creates it if necessary
277         */
278        public DG1 getDG1() { 
279           DG1 ret = null;
280           try {
281              ret = (DG1)this.get("DG1");
282           } catch(HL7Exception e) {
283              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
284              throw new RuntimeException(e);
285           }
286           return ret;
287        }
288    
289    
290        /**
291         * Returns a specific repetition of
292         * DG1 (Diagnosis) - creates it if necessary
293         *
294         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
295         * @throws HL7Exception if the repetition requested is more than one 
296         *     greater than the number of existing repetitions.
297         */
298        public DG1 getDG1(int rep) { 
299           DG1 ret = null;
300           try {
301              ret = (DG1)this.get("DG1", rep);
302           } catch(HL7Exception e) {
303              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
304              throw new RuntimeException(e);
305           }
306           return ret;
307        }
308    
309        /** 
310         * Returns the number of existing repetitions of DG1 
311         */ 
312        public int getDG1Reps() { 
313            int reps = -1; 
314            try { 
315                reps = this.getAll("DG1").length; 
316            } catch (HL7Exception e) { 
317                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
318                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
319                throw new RuntimeException(message);
320            } 
321            return reps; 
322        } 
323    
324        /**
325         * Inserts a specific repetition of DG1 (Diagnosis)
326         * @see AbstractGroup\#insertRepetition(Structure, int) 
327         */
328        public void insertDG1(DG1 structure, int rep) throws HL7Exception { 
329           super.insertRepetition( "DG1", structure, rep);
330        }
331    
332    
333        /**
334         * Inserts a specific repetition of DG1 (Diagnosis)
335         * @see AbstractGroup\#insertRepetition(Structure, int) 
336         */
337        public DG1 insertDG1(int rep) throws HL7Exception { 
338           return (DG1)super.insertRepetition("DG1", rep);
339        }
340    
341    
342        /**
343         * Removes a specific repetition of DG1 (Diagnosis)
344         * @see AbstractGroup\#removeRepetition(String, int) 
345         */
346        public DG1 removeDG1(int rep) throws HL7Exception { 
347           return (DG1)super.removeRepetition("DG1", rep);
348        }
349    
350    
351    
352        /**
353         * Returns
354         * the first repetition of 
355         * DRG (Diagnosis Related Group) - creates it if necessary
356         */
357        public DRG getDRG() { 
358           DRG ret = null;
359           try {
360              ret = (DRG)this.get("DRG");
361           } catch(HL7Exception e) {
362              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
363              throw new RuntimeException(e);
364           }
365           return ret;
366        }
367    
368    
369        /**
370         * Returns a specific repetition of
371         * DRG (Diagnosis Related Group) - creates it if necessary
372         *
373         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
374         * @throws HL7Exception if the repetition requested is more than one 
375         *     greater than the number of existing repetitions.
376         */
377        public DRG getDRG(int rep) { 
378           DRG ret = null;
379           try {
380              ret = (DRG)this.get("DRG", rep);
381           } catch(HL7Exception e) {
382              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
383              throw new RuntimeException(e);
384           }
385           return ret;
386        }
387    
388        /** 
389         * Returns the number of existing repetitions of DRG 
390         */ 
391        public int getDRGReps() { 
392            int reps = -1; 
393            try { 
394                reps = this.getAll("DRG").length; 
395            } catch (HL7Exception e) { 
396                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
397                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
398                throw new RuntimeException(message);
399            } 
400            return reps; 
401        } 
402    
403        /**
404         * Inserts a specific repetition of DRG (Diagnosis Related Group)
405         * @see AbstractGroup\#insertRepetition(Structure, int) 
406         */
407        public void insertDRG(DRG structure, int rep) throws HL7Exception { 
408           super.insertRepetition( "DRG", structure, rep);
409        }
410    
411    
412        /**
413         * Inserts a specific repetition of DRG (Diagnosis Related Group)
414         * @see AbstractGroup\#insertRepetition(Structure, int) 
415         */
416        public DRG insertDRG(int rep) throws HL7Exception { 
417           return (DRG)super.insertRepetition("DRG", rep);
418        }
419    
420    
421        /**
422         * Removes a specific repetition of DRG (Diagnosis Related Group)
423         * @see AbstractGroup\#removeRepetition(String, int) 
424         */
425        public DRG removeDRG(int rep) throws HL7Exception { 
426           return (DRG)super.removeRepetition("DRG", rep);
427        }
428    
429    
430    
431        /**
432         * Returns
433         * the first repetition of 
434         * AL1 (Patient allergy information) - creates it if necessary
435         */
436        public AL1 getAL1() { 
437           AL1 ret = null;
438           try {
439              ret = (AL1)this.get("AL1");
440           } catch(HL7Exception e) {
441              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
442              throw new RuntimeException(e);
443           }
444           return ret;
445        }
446    
447    
448        /**
449         * Returns a specific repetition of
450         * AL1 (Patient allergy information) - creates it if necessary
451         *
452         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
453         * @throws HL7Exception if the repetition requested is more than one 
454         *     greater than the number of existing repetitions.
455         */
456        public AL1 getAL1(int rep) { 
457           AL1 ret = null;
458           try {
459              ret = (AL1)this.get("AL1", rep);
460           } catch(HL7Exception e) {
461              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
462              throw new RuntimeException(e);
463           }
464           return ret;
465        }
466    
467        /** 
468         * Returns the number of existing repetitions of AL1 
469         */ 
470        public int getAL1Reps() { 
471            int reps = -1; 
472            try { 
473                reps = this.getAll("AL1").length; 
474            } catch (HL7Exception e) { 
475                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
476                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
477                throw new RuntimeException(message);
478            } 
479            return reps; 
480        } 
481    
482        /**
483         * Inserts a specific repetition of AL1 (Patient allergy information)
484         * @see AbstractGroup\#insertRepetition(Structure, int) 
485         */
486        public void insertAL1(AL1 structure, int rep) throws HL7Exception { 
487           super.insertRepetition( "AL1", structure, rep);
488        }
489    
490    
491        /**
492         * Inserts a specific repetition of AL1 (Patient allergy information)
493         * @see AbstractGroup\#insertRepetition(Structure, int) 
494         */
495        public AL1 insertAL1(int rep) throws HL7Exception { 
496           return (AL1)super.insertRepetition("AL1", rep);
497        }
498    
499    
500        /**
501         * Removes a specific repetition of AL1 (Patient allergy information)
502         * @see AbstractGroup\#removeRepetition(String, int) 
503         */
504        public AL1 removeAL1(int rep) throws HL7Exception { 
505           return (AL1)super.removeRepetition("AL1", rep);
506        }
507    
508    
509    
510        /**
511         * Returns
512         * the first repetition of 
513         * PROCEDURE (a Group object) - creates it if necessary
514         */
515        public RRI_I12_PROCEDURE getPROCEDURE() { 
516           RRI_I12_PROCEDURE ret = null;
517           try {
518              ret = (RRI_I12_PROCEDURE)this.get("PROCEDURE");
519           } catch(HL7Exception e) {
520              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
521              throw new RuntimeException(e);
522           }
523           return ret;
524        }
525    
526    
527        /**
528         * Returns a specific repetition of
529         * PROCEDURE (a Group object) - creates it if necessary
530         *
531         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
532         * @throws HL7Exception if the repetition requested is more than one 
533         *     greater than the number of existing repetitions.
534         */
535        public RRI_I12_PROCEDURE getPROCEDURE(int rep) { 
536           RRI_I12_PROCEDURE ret = null;
537           try {
538              ret = (RRI_I12_PROCEDURE)this.get("PROCEDURE", rep);
539           } catch(HL7Exception e) {
540              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
541              throw new RuntimeException(e);
542           }
543           return ret;
544        }
545    
546        /** 
547         * Returns the number of existing repetitions of PROCEDURE 
548         */ 
549        public int getPROCEDUREReps() { 
550            int reps = -1; 
551            try { 
552                reps = this.getAll("PROCEDURE").length; 
553            } catch (HL7Exception e) { 
554                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
555                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
556                throw new RuntimeException(message);
557            } 
558            return reps; 
559        } 
560    
561        /**
562         * Inserts a specific repetition of PROCEDURE (a Group object)
563         * @see AbstractGroup\#insertRepetition(Structure, int) 
564         */
565        public void insertPROCEDURE(RRI_I12_PROCEDURE structure, int rep) throws HL7Exception { 
566           super.insertRepetition( "PROCEDURE", structure, rep);
567        }
568    
569    
570        /**
571         * Inserts a specific repetition of PROCEDURE (a Group object)
572         * @see AbstractGroup\#insertRepetition(Structure, int) 
573         */
574        public RRI_I12_PROCEDURE insertPROCEDURE(int rep) throws HL7Exception { 
575           return (RRI_I12_PROCEDURE)super.insertRepetition("PROCEDURE", rep);
576        }
577    
578    
579        /**
580         * Removes a specific repetition of PROCEDURE (a Group object)
581         * @see AbstractGroup\#removeRepetition(String, int) 
582         */
583        public RRI_I12_PROCEDURE removePROCEDURE(int rep) throws HL7Exception { 
584           return (RRI_I12_PROCEDURE)super.removeRepetition("PROCEDURE", rep);
585        }
586    
587    
588    
589        /**
590         * Returns
591         * the first repetition of 
592         * OBSERVATION (a Group object) - creates it if necessary
593         */
594        public RRI_I12_OBSERVATION getOBSERVATION() { 
595           RRI_I12_OBSERVATION ret = null;
596           try {
597              ret = (RRI_I12_OBSERVATION)this.get("OBSERVATION");
598           } catch(HL7Exception e) {
599              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
600              throw new RuntimeException(e);
601           }
602           return ret;
603        }
604    
605    
606        /**
607         * Returns a specific repetition of
608         * OBSERVATION (a Group object) - creates it if necessary
609         *
610         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
611         * @throws HL7Exception if the repetition requested is more than one 
612         *     greater than the number of existing repetitions.
613         */
614        public RRI_I12_OBSERVATION getOBSERVATION(int rep) { 
615           RRI_I12_OBSERVATION ret = null;
616           try {
617              ret = (RRI_I12_OBSERVATION)this.get("OBSERVATION", rep);
618           } catch(HL7Exception e) {
619              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
620              throw new RuntimeException(e);
621           }
622           return ret;
623        }
624    
625        /** 
626         * Returns the number of existing repetitions of OBSERVATION 
627         */ 
628        public int getOBSERVATIONReps() { 
629            int reps = -1; 
630            try { 
631                reps = this.getAll("OBSERVATION").length; 
632            } catch (HL7Exception e) { 
633                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
634                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
635                throw new RuntimeException(message);
636            } 
637            return reps; 
638        } 
639    
640        /**
641         * Inserts a specific repetition of OBSERVATION (a Group object)
642         * @see AbstractGroup\#insertRepetition(Structure, int) 
643         */
644        public void insertOBSERVATION(RRI_I12_OBSERVATION structure, int rep) throws HL7Exception { 
645           super.insertRepetition( "OBSERVATION", structure, rep);
646        }
647    
648    
649        /**
650         * Inserts a specific repetition of OBSERVATION (a Group object)
651         * @see AbstractGroup\#insertRepetition(Structure, int) 
652         */
653        public RRI_I12_OBSERVATION insertOBSERVATION(int rep) throws HL7Exception { 
654           return (RRI_I12_OBSERVATION)super.insertRepetition("OBSERVATION", rep);
655        }
656    
657    
658        /**
659         * Removes a specific repetition of OBSERVATION (a Group object)
660         * @see AbstractGroup\#removeRepetition(String, int) 
661         */
662        public RRI_I12_OBSERVATION removeOBSERVATION(int rep) throws HL7Exception { 
663           return (RRI_I12_OBSERVATION)super.removeRepetition("OBSERVATION", rep);
664        }
665    
666    
667    
668        /**
669         * Returns
670         * PATIENT_VISIT (a Group object) - creates it if necessary
671         */
672        public RRI_I12_PATIENT_VISIT getPATIENT_VISIT() { 
673           RRI_I12_PATIENT_VISIT ret = null;
674           try {
675              ret = (RRI_I12_PATIENT_VISIT)this.get("PATIENT_VISIT");
676           } catch(HL7Exception e) {
677              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
678              throw new RuntimeException(e);
679           }
680           return ret;
681        }
682    
683    
684    
685    
686        /**
687         * Returns
688         * the first repetition of 
689         * NTE (Notes and Comments) - creates it if necessary
690         */
691        public NTE getNTE() { 
692           NTE ret = null;
693           try {
694              ret = (NTE)this.get("NTE");
695           } catch(HL7Exception e) {
696              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
697              throw new RuntimeException(e);
698           }
699           return ret;
700        }
701    
702    
703        /**
704         * Returns a specific repetition of
705         * NTE (Notes and Comments) - creates it if necessary
706         *
707         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
708         * @throws HL7Exception if the repetition requested is more than one 
709         *     greater than the number of existing repetitions.
710         */
711        public NTE getNTE(int rep) { 
712           NTE ret = null;
713           try {
714              ret = (NTE)this.get("NTE", rep);
715           } catch(HL7Exception e) {
716              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
717              throw new RuntimeException(e);
718           }
719           return ret;
720        }
721    
722        /** 
723         * Returns the number of existing repetitions of NTE 
724         */ 
725        public int getNTEReps() { 
726            int reps = -1; 
727            try { 
728                reps = this.getAll("NTE").length; 
729            } catch (HL7Exception e) { 
730                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
731                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
732                throw new RuntimeException(message);
733            } 
734            return reps; 
735        } 
736    
737        /**
738         * Inserts a specific repetition of NTE (Notes and Comments)
739         * @see AbstractGroup\#insertRepetition(Structure, int) 
740         */
741        public void insertNTE(NTE structure, int rep) throws HL7Exception { 
742           super.insertRepetition( "NTE", structure, rep);
743        }
744    
745    
746        /**
747         * Inserts a specific repetition of NTE (Notes and Comments)
748         * @see AbstractGroup\#insertRepetition(Structure, int) 
749         */
750        public NTE insertNTE(int rep) throws HL7Exception { 
751           return (NTE)super.insertRepetition("NTE", rep);
752        }
753    
754    
755        /**
756         * Removes a specific repetition of NTE (Notes and Comments)
757         * @see AbstractGroup\#removeRepetition(String, int) 
758         */
759        public NTE removeNTE(int rep) throws HL7Exception { 
760           return (NTE)super.removeRepetition("NTE", rep);
761        }
762    
763    
764    
765    }
766