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