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.group;
009    
010    import ca.uhn.hl7v2.model.v24.segment.*;
011    
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.AbstractGroup;
019    import ca.uhn.hl7v2.model.GenericSegment;
020    
021    /**
022     * <p>Represents a BAR_P01_VISIT group structure (a Group object).
023     * A Group is an ordered collection of message segments that can repeat together or be optionally in/excluded together.
024     * This Group contains the following elements:  
025     * </p>
026     * <ul>
027                     * <li>1: PV1 (Patient visit) <b>optional </b></li>
028                     * <li>2: PV2 (Patient visit - additional information) <b>optional </b></li>
029                     * <li>3: ROL (Role) <b>optional repeating</b></li>
030                     * <li>4: DB1 (Disability) <b>optional repeating</b></li>
031                     * <li>5: OBX (Observation/Result) <b>optional repeating</b></li>
032                     * <li>6: AL1 (Patient allergy information) <b>optional repeating</b></li>
033                     * <li>7: DG1 (Diagnosis) <b>optional repeating</b></li>
034                     * <li>8: DRG (Diagnosis Related Group) <b>optional </b></li>
035                     * <li>9: BAR_P01_PROCEDURE (a Group object) <b>optional repeating</b></li>
036                     * <li>10: GT1 (Guarantor) <b>optional repeating</b></li>
037                     * <li>11: NK1 (Next of kin / associated parties) <b>optional repeating</b></li>
038                     * <li>12: BAR_P01_INSURANCE (a Group object) <b>optional repeating</b></li>
039                     * <li>13: ACC (Accident) <b>optional </b></li>
040                     * <li>14: UB1 (UB82) <b>optional </b></li>
041                     * <li>15: UB2 (UB92 Data) <b>optional </b></li>
042     * </ul>
043     */
044    public class BAR_P01_VISIT extends AbstractGroup {
045    
046        /** 
047         * Creates a new BAR_P01_VISIT group
048         */
049        public BAR_P01_VISIT(Group parent, ModelClassFactory factory) {
050           super(parent, factory);
051           init(factory);
052        }
053    
054        private void init(ModelClassFactory factory) {
055           try {
056                              this.add(PV1.class, false, false);
057                              this.add(PV2.class, false, false);
058                              this.add(ROL.class, false, true);
059                              this.add(DB1.class, false, true);
060                              this.add(OBX.class, false, true);
061                              this.add(AL1.class, false, true);
062                              this.add(DG1.class, false, true);
063                              this.add(DRG.class, false, false);
064                              this.add(BAR_P01_PROCEDURE.class, false, true);
065                              this.add(GT1.class, false, true);
066                              this.add(NK1.class, false, true);
067                              this.add(BAR_P01_INSURANCE.class, false, true);
068                              this.add(ACC.class, false, false);
069                              this.add(UB1.class, false, false);
070                              this.add(UB2.class, false, false);
071           } catch(HL7Exception e) {
072              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating BAR_P01_VISIT - this is probably a bug in the source code generator.", e);
073           }
074        }
075    
076        /** 
077         * Returns "2.4"
078         */
079        public String getVersion() {
080           return "2.4";
081        }
082    
083    
084    
085        /**
086         * Returns
087         * PV1 (Patient visit) - creates it if necessary
088         */
089        public PV1 getPV1() { 
090           PV1 ret = null;
091           try {
092              ret = (PV1)this.get("PV1");
093           } catch(HL7Exception e) {
094              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
095              throw new RuntimeException(e);
096           }
097           return ret;
098        }
099    
100    
101    
102    
103        /**
104         * Returns
105         * PV2 (Patient visit - additional information) - creates it if necessary
106         */
107        public PV2 getPV2() { 
108           PV2 ret = null;
109           try {
110              ret = (PV2)this.get("PV2");
111           } catch(HL7Exception e) {
112              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
113              throw new RuntimeException(e);
114           }
115           return ret;
116        }
117    
118    
119    
120    
121        /**
122         * Returns
123         * the first repetition of 
124         * ROL (Role) - creates it if necessary
125         */
126        public ROL getROL() { 
127           ROL ret = null;
128           try {
129              ret = (ROL)this.get("ROL");
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         * Returns a specific repetition of
140         * ROL (Role) - creates it if necessary
141         *
142         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
143         * @throws HL7Exception if the repetition requested is more than one 
144         *     greater than the number of existing repetitions.
145         */
146        public ROL getROL(int rep) { 
147           ROL ret = null;
148           try {
149              ret = (ROL)this.get("ROL", rep);
150           } catch(HL7Exception e) {
151              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
152              throw new RuntimeException(e);
153           }
154           return ret;
155        }
156    
157        /** 
158         * Returns the number of existing repetitions of ROL 
159         */ 
160        public int getROLReps() { 
161            int reps = -1; 
162            try { 
163                reps = this.getAll("ROL").length; 
164            } catch (HL7Exception e) { 
165                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
166                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
167                throw new RuntimeException(message);
168            } 
169            return reps; 
170        } 
171    
172        /**
173         * Inserts a specific repetition of ROL (Role)
174         * @see AbstractGroup#insertRepetition(Structure, int) 
175         */
176        public void insertROL(ROL structure, int rep) throws HL7Exception { 
177           super.insertRepetition("ROL", structure, rep);
178        }
179    
180    
181        /**
182         * Inserts a specific repetition of ROL (Role)
183         * @see AbstractGroup#insertRepetition(Structure, int) 
184         */
185        public ROL insertROL(int rep) throws HL7Exception { 
186           return (ROL)super.insertRepetition("ROL", rep);
187        }
188    
189    
190        /**
191         * Removes a specific repetition of ROL (Role)
192         * @see AbstractGroup#removeRepetition(String, int) 
193         */
194        public ROL removeROL(int rep) throws HL7Exception { 
195           return (ROL)super.removeRepetition("ROL", rep);
196        }
197    
198    
199    
200        /**
201         * Returns
202         * the first repetition of 
203         * DB1 (Disability) - creates it if necessary
204         */
205        public DB1 getDB1() { 
206           DB1 ret = null;
207           try {
208              ret = (DB1)this.get("DB1");
209           } catch(HL7Exception e) {
210              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
211              throw new RuntimeException(e);
212           }
213           return ret;
214        }
215    
216    
217        /**
218         * Returns a specific repetition of
219         * DB1 (Disability) - creates it if necessary
220         *
221         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
222         * @throws HL7Exception if the repetition requested is more than one 
223         *     greater than the number of existing repetitions.
224         */
225        public DB1 getDB1(int rep) { 
226           DB1 ret = null;
227           try {
228              ret = (DB1)this.get("DB1", rep);
229           } catch(HL7Exception e) {
230              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
231              throw new RuntimeException(e);
232           }
233           return ret;
234        }
235    
236        /** 
237         * Returns the number of existing repetitions of DB1 
238         */ 
239        public int getDB1Reps() { 
240            int reps = -1; 
241            try { 
242                reps = this.getAll("DB1").length; 
243            } catch (HL7Exception e) { 
244                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
245                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
246                throw new RuntimeException(message);
247            } 
248            return reps; 
249        } 
250    
251        /**
252         * Inserts a specific repetition of DB1 (Disability)
253         * @see AbstractGroup#insertRepetition(Structure, int) 
254         */
255        public void insertDB1(DB1 structure, int rep) throws HL7Exception { 
256           super.insertRepetition("DB1", structure, rep);
257        }
258    
259    
260        /**
261         * Inserts a specific repetition of DB1 (Disability)
262         * @see AbstractGroup#insertRepetition(Structure, int) 
263         */
264        public DB1 insertDB1(int rep) throws HL7Exception { 
265           return (DB1)super.insertRepetition("DB1", rep);
266        }
267    
268    
269        /**
270         * Removes a specific repetition of DB1 (Disability)
271         * @see AbstractGroup#removeRepetition(String, int) 
272         */
273        public DB1 removeDB1(int rep) throws HL7Exception { 
274           return (DB1)super.removeRepetition("DB1", rep);
275        }
276    
277    
278    
279        /**
280         * Returns
281         * the first repetition of 
282         * OBX (Observation/Result) - creates it if necessary
283         */
284        public OBX getOBX() { 
285           OBX ret = null;
286           try {
287              ret = (OBX)this.get("OBX");
288           } catch(HL7Exception e) {
289              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
290              throw new RuntimeException(e);
291           }
292           return ret;
293        }
294    
295    
296        /**
297         * Returns a specific repetition of
298         * OBX (Observation/Result) - creates it if necessary
299         *
300         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
301         * @throws HL7Exception if the repetition requested is more than one 
302         *     greater than the number of existing repetitions.
303         */
304        public OBX getOBX(int rep) { 
305           OBX ret = null;
306           try {
307              ret = (OBX)this.get("OBX", rep);
308           } catch(HL7Exception e) {
309              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
310              throw new RuntimeException(e);
311           }
312           return ret;
313        }
314    
315        /** 
316         * Returns the number of existing repetitions of OBX 
317         */ 
318        public int getOBXReps() { 
319            int reps = -1; 
320            try { 
321                reps = this.getAll("OBX").length; 
322            } catch (HL7Exception e) { 
323                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
324                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
325                throw new RuntimeException(message);
326            } 
327            return reps; 
328        } 
329    
330        /**
331         * Inserts a specific repetition of OBX (Observation/Result)
332         * @see AbstractGroup#insertRepetition(Structure, int) 
333         */
334        public void insertOBX(OBX structure, int rep) throws HL7Exception { 
335           super.insertRepetition("OBX", structure, rep);
336        }
337    
338    
339        /**
340         * Inserts a specific repetition of OBX (Observation/Result)
341         * @see AbstractGroup#insertRepetition(Structure, int) 
342         */
343        public OBX insertOBX(int rep) throws HL7Exception { 
344           return (OBX)super.insertRepetition("OBX", rep);
345        }
346    
347    
348        /**
349         * Removes a specific repetition of OBX (Observation/Result)
350         * @see AbstractGroup#removeRepetition(String, int) 
351         */
352        public OBX removeOBX(int rep) throws HL7Exception { 
353           return (OBX)super.removeRepetition("OBX", rep);
354        }
355    
356    
357    
358        /**
359         * Returns
360         * the first repetition of 
361         * AL1 (Patient allergy information) - creates it if necessary
362         */
363        public AL1 getAL1() { 
364           AL1 ret = null;
365           try {
366              ret = (AL1)this.get("AL1");
367           } catch(HL7Exception e) {
368              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
369              throw new RuntimeException(e);
370           }
371           return ret;
372        }
373    
374    
375        /**
376         * Returns a specific repetition of
377         * AL1 (Patient allergy information) - creates it if necessary
378         *
379         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
380         * @throws HL7Exception if the repetition requested is more than one 
381         *     greater than the number of existing repetitions.
382         */
383        public AL1 getAL1(int rep) { 
384           AL1 ret = null;
385           try {
386              ret = (AL1)this.get("AL1", rep);
387           } catch(HL7Exception e) {
388              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
389              throw new RuntimeException(e);
390           }
391           return ret;
392        }
393    
394        /** 
395         * Returns the number of existing repetitions of AL1 
396         */ 
397        public int getAL1Reps() { 
398            int reps = -1; 
399            try { 
400                reps = this.getAll("AL1").length; 
401            } catch (HL7Exception e) { 
402                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
403                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
404                throw new RuntimeException(message);
405            } 
406            return reps; 
407        } 
408    
409        /**
410         * Inserts a specific repetition of AL1 (Patient allergy information)
411         * @see AbstractGroup#insertRepetition(Structure, int) 
412         */
413        public void insertAL1(AL1 structure, int rep) throws HL7Exception { 
414           super.insertRepetition("AL1", structure, rep);
415        }
416    
417    
418        /**
419         * Inserts a specific repetition of AL1 (Patient allergy information)
420         * @see AbstractGroup#insertRepetition(Structure, int) 
421         */
422        public AL1 insertAL1(int rep) throws HL7Exception { 
423           return (AL1)super.insertRepetition("AL1", rep);
424        }
425    
426    
427        /**
428         * Removes a specific repetition of AL1 (Patient allergy information)
429         * @see AbstractGroup#removeRepetition(String, int) 
430         */
431        public AL1 removeAL1(int rep) throws HL7Exception { 
432           return (AL1)super.removeRepetition("AL1", rep);
433        }
434    
435    
436    
437        /**
438         * Returns
439         * the first repetition of 
440         * DG1 (Diagnosis) - creates it if necessary
441         */
442        public DG1 getDG1() { 
443           DG1 ret = null;
444           try {
445              ret = (DG1)this.get("DG1");
446           } catch(HL7Exception e) {
447              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
448              throw new RuntimeException(e);
449           }
450           return ret;
451        }
452    
453    
454        /**
455         * Returns a specific repetition of
456         * DG1 (Diagnosis) - creates it if necessary
457         *
458         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
459         * @throws HL7Exception if the repetition requested is more than one 
460         *     greater than the number of existing repetitions.
461         */
462        public DG1 getDG1(int rep) { 
463           DG1 ret = null;
464           try {
465              ret = (DG1)this.get("DG1", rep);
466           } catch(HL7Exception e) {
467              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
468              throw new RuntimeException(e);
469           }
470           return ret;
471        }
472    
473        /** 
474         * Returns the number of existing repetitions of DG1 
475         */ 
476        public int getDG1Reps() { 
477            int reps = -1; 
478            try { 
479                reps = this.getAll("DG1").length; 
480            } catch (HL7Exception e) { 
481                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
482                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
483                throw new RuntimeException(message);
484            } 
485            return reps; 
486        } 
487    
488        /**
489         * Inserts a specific repetition of DG1 (Diagnosis)
490         * @see AbstractGroup#insertRepetition(Structure, int) 
491         */
492        public void insertDG1(DG1 structure, int rep) throws HL7Exception { 
493           super.insertRepetition("DG1", structure, rep);
494        }
495    
496    
497        /**
498         * Inserts a specific repetition of DG1 (Diagnosis)
499         * @see AbstractGroup#insertRepetition(Structure, int) 
500         */
501        public DG1 insertDG1(int rep) throws HL7Exception { 
502           return (DG1)super.insertRepetition("DG1", rep);
503        }
504    
505    
506        /**
507         * Removes a specific repetition of DG1 (Diagnosis)
508         * @see AbstractGroup#removeRepetition(String, int) 
509         */
510        public DG1 removeDG1(int rep) throws HL7Exception { 
511           return (DG1)super.removeRepetition("DG1", rep);
512        }
513    
514    
515    
516        /**
517         * Returns
518         * DRG (Diagnosis Related Group) - creates it if necessary
519         */
520        public DRG getDRG() { 
521           DRG ret = null;
522           try {
523              ret = (DRG)this.get("DRG");
524           } catch(HL7Exception e) {
525              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
526              throw new RuntimeException(e);
527           }
528           return ret;
529        }
530    
531    
532    
533    
534        /**
535         * Returns
536         * the first repetition of 
537         * PROCEDURE (a Group object) - creates it if necessary
538         */
539        public BAR_P01_PROCEDURE getPROCEDURE() { 
540           BAR_P01_PROCEDURE ret = null;
541           try {
542              ret = (BAR_P01_PROCEDURE)this.get("PROCEDURE");
543           } catch(HL7Exception e) {
544              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
545              throw new RuntimeException(e);
546           }
547           return ret;
548        }
549    
550    
551        /**
552         * Returns a specific repetition of
553         * PROCEDURE (a Group object) - creates it if necessary
554         *
555         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
556         * @throws HL7Exception if the repetition requested is more than one 
557         *     greater than the number of existing repetitions.
558         */
559        public BAR_P01_PROCEDURE getPROCEDURE(int rep) { 
560           BAR_P01_PROCEDURE ret = null;
561           try {
562              ret = (BAR_P01_PROCEDURE)this.get("PROCEDURE", rep);
563           } catch(HL7Exception e) {
564              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
565              throw new RuntimeException(e);
566           }
567           return ret;
568        }
569    
570        /** 
571         * Returns the number of existing repetitions of PROCEDURE 
572         */ 
573        public int getPROCEDUREReps() { 
574            int reps = -1; 
575            try { 
576                reps = this.getAll("PROCEDURE").length; 
577            } catch (HL7Exception e) { 
578                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
579                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
580                throw new RuntimeException(message);
581            } 
582            return reps; 
583        } 
584    
585        /**
586         * Inserts a specific repetition of PROCEDURE (a Group object)
587         * @see AbstractGroup#insertRepetition(Structure, int) 
588         */
589        public void insertPROCEDURE(BAR_P01_PROCEDURE structure, int rep) throws HL7Exception { 
590           super.insertRepetition("PROCEDURE", structure, rep);
591        }
592    
593    
594        /**
595         * Inserts a specific repetition of PROCEDURE (a Group object)
596         * @see AbstractGroup#insertRepetition(Structure, int) 
597         */
598        public BAR_P01_PROCEDURE insertPROCEDURE(int rep) throws HL7Exception { 
599           return (BAR_P01_PROCEDURE)super.insertRepetition("PROCEDURE", rep);
600        }
601    
602    
603        /**
604         * Removes a specific repetition of PROCEDURE (a Group object)
605         * @see AbstractGroup#removeRepetition(String, int) 
606         */
607        public BAR_P01_PROCEDURE removePROCEDURE(int rep) throws HL7Exception { 
608           return (BAR_P01_PROCEDURE)super.removeRepetition("PROCEDURE", rep);
609        }
610    
611    
612    
613        /**
614         * Returns
615         * the first repetition of 
616         * GT1 (Guarantor) - creates it if necessary
617         */
618        public GT1 getGT1() { 
619           GT1 ret = null;
620           try {
621              ret = (GT1)this.get("GT1");
622           } catch(HL7Exception e) {
623              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
624              throw new RuntimeException(e);
625           }
626           return ret;
627        }
628    
629    
630        /**
631         * Returns a specific repetition of
632         * GT1 (Guarantor) - creates it if necessary
633         *
634         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
635         * @throws HL7Exception if the repetition requested is more than one 
636         *     greater than the number of existing repetitions.
637         */
638        public GT1 getGT1(int rep) { 
639           GT1 ret = null;
640           try {
641              ret = (GT1)this.get("GT1", rep);
642           } catch(HL7Exception e) {
643              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
644              throw new RuntimeException(e);
645           }
646           return ret;
647        }
648    
649        /** 
650         * Returns the number of existing repetitions of GT1 
651         */ 
652        public int getGT1Reps() { 
653            int reps = -1; 
654            try { 
655                reps = this.getAll("GT1").length; 
656            } catch (HL7Exception e) { 
657                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
658                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
659                throw new RuntimeException(message);
660            } 
661            return reps; 
662        } 
663    
664        /**
665         * Inserts a specific repetition of GT1 (Guarantor)
666         * @see AbstractGroup#insertRepetition(Structure, int) 
667         */
668        public void insertGT1(GT1 structure, int rep) throws HL7Exception { 
669           super.insertRepetition("GT1", structure, rep);
670        }
671    
672    
673        /**
674         * Inserts a specific repetition of GT1 (Guarantor)
675         * @see AbstractGroup#insertRepetition(Structure, int) 
676         */
677        public GT1 insertGT1(int rep) throws HL7Exception { 
678           return (GT1)super.insertRepetition("GT1", rep);
679        }
680    
681    
682        /**
683         * Removes a specific repetition of GT1 (Guarantor)
684         * @see AbstractGroup#removeRepetition(String, int) 
685         */
686        public GT1 removeGT1(int rep) throws HL7Exception { 
687           return (GT1)super.removeRepetition("GT1", rep);
688        }
689    
690    
691    
692        /**
693         * Returns
694         * the first repetition of 
695         * NK1 (Next of kin / associated parties) - creates it if necessary
696         */
697        public NK1 getNK1() { 
698           NK1 ret = null;
699           try {
700              ret = (NK1)this.get("NK1");
701           } catch(HL7Exception e) {
702              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
703              throw new RuntimeException(e);
704           }
705           return ret;
706        }
707    
708    
709        /**
710         * Returns a specific repetition of
711         * NK1 (Next of kin / associated parties) - creates it if necessary
712         *
713         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
714         * @throws HL7Exception if the repetition requested is more than one 
715         *     greater than the number of existing repetitions.
716         */
717        public NK1 getNK1(int rep) { 
718           NK1 ret = null;
719           try {
720              ret = (NK1)this.get("NK1", rep);
721           } catch(HL7Exception e) {
722              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
723              throw new RuntimeException(e);
724           }
725           return ret;
726        }
727    
728        /** 
729         * Returns the number of existing repetitions of NK1 
730         */ 
731        public int getNK1Reps() { 
732            int reps = -1; 
733            try { 
734                reps = this.getAll("NK1").length; 
735            } catch (HL7Exception e) { 
736                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
737                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
738                throw new RuntimeException(message);
739            } 
740            return reps; 
741        } 
742    
743        /**
744         * Inserts a specific repetition of NK1 (Next of kin / associated parties)
745         * @see AbstractGroup#insertRepetition(Structure, int) 
746         */
747        public void insertNK1(NK1 structure, int rep) throws HL7Exception { 
748           super.insertRepetition("NK1", structure, rep);
749        }
750    
751    
752        /**
753         * Inserts a specific repetition of NK1 (Next of kin / associated parties)
754         * @see AbstractGroup#insertRepetition(Structure, int) 
755         */
756        public NK1 insertNK1(int rep) throws HL7Exception { 
757           return (NK1)super.insertRepetition("NK1", rep);
758        }
759    
760    
761        /**
762         * Removes a specific repetition of NK1 (Next of kin / associated parties)
763         * @see AbstractGroup#removeRepetition(String, int) 
764         */
765        public NK1 removeNK1(int rep) throws HL7Exception { 
766           return (NK1)super.removeRepetition("NK1", rep);
767        }
768    
769    
770    
771        /**
772         * Returns
773         * the first repetition of 
774         * INSURANCE (a Group object) - creates it if necessary
775         */
776        public BAR_P01_INSURANCE getINSURANCE() { 
777           BAR_P01_INSURANCE ret = null;
778           try {
779              ret = (BAR_P01_INSURANCE)this.get("INSURANCE");
780           } catch(HL7Exception e) {
781              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
782              throw new RuntimeException(e);
783           }
784           return ret;
785        }
786    
787    
788        /**
789         * Returns a specific repetition of
790         * INSURANCE (a Group object) - creates it if necessary
791         *
792         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
793         * @throws HL7Exception if the repetition requested is more than one 
794         *     greater than the number of existing repetitions.
795         */
796        public BAR_P01_INSURANCE getINSURANCE(int rep) { 
797           BAR_P01_INSURANCE ret = null;
798           try {
799              ret = (BAR_P01_INSURANCE)this.get("INSURANCE", rep);
800           } catch(HL7Exception e) {
801              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
802              throw new RuntimeException(e);
803           }
804           return ret;
805        }
806    
807        /** 
808         * Returns the number of existing repetitions of INSURANCE 
809         */ 
810        public int getINSURANCEReps() { 
811            int reps = -1; 
812            try { 
813                reps = this.getAll("INSURANCE").length; 
814            } catch (HL7Exception e) { 
815                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
816                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
817                throw new RuntimeException(message);
818            } 
819            return reps; 
820        } 
821    
822        /**
823         * Inserts a specific repetition of INSURANCE (a Group object)
824         * @see AbstractGroup#insertRepetition(Structure, int) 
825         */
826        public void insertINSURANCE(BAR_P01_INSURANCE structure, int rep) throws HL7Exception { 
827           super.insertRepetition("INSURANCE", structure, rep);
828        }
829    
830    
831        /**
832         * Inserts a specific repetition of INSURANCE (a Group object)
833         * @see AbstractGroup#insertRepetition(Structure, int) 
834         */
835        public BAR_P01_INSURANCE insertINSURANCE(int rep) throws HL7Exception { 
836           return (BAR_P01_INSURANCE)super.insertRepetition("INSURANCE", rep);
837        }
838    
839    
840        /**
841         * Removes a specific repetition of INSURANCE (a Group object)
842         * @see AbstractGroup#removeRepetition(String, int) 
843         */
844        public BAR_P01_INSURANCE removeINSURANCE(int rep) throws HL7Exception { 
845           return (BAR_P01_INSURANCE)super.removeRepetition("INSURANCE", rep);
846        }
847    
848    
849    
850        /**
851         * Returns
852         * ACC (Accident) - creates it if necessary
853         */
854        public ACC getACC() { 
855           ACC ret = null;
856           try {
857              ret = (ACC)this.get("ACC");
858           } catch(HL7Exception e) {
859              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
860              throw new RuntimeException(e);
861           }
862           return ret;
863        }
864    
865    
866    
867    
868        /**
869         * Returns
870         * UB1 (UB82) - creates it if necessary
871         */
872        public UB1 getUB1() { 
873           UB1 ret = null;
874           try {
875              ret = (UB1)this.get("UB1");
876           } catch(HL7Exception e) {
877              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
878              throw new RuntimeException(e);
879           }
880           return ret;
881        }
882    
883    
884    
885    
886        /**
887         * Returns
888         * UB2 (UB92 Data) - creates it if necessary
889         */
890        public UB2 getUB2() { 
891           UB2 ret = null;
892           try {
893              ret = (UB2)this.get("UB2");
894           } catch(HL7Exception e) {
895              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
896              throw new RuntimeException(e);
897           }
898           return ret;
899        }
900    
901    
902    
903    
904    }
905