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 DFT_P03_FINANCIAL 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: FT1 (Financial Transaction) <b> </b></li>
028                     * <li>2: DFT_P03_FINANCIAL_PROCEDURE (a Group object) <b>optional repeating</b></li>
029                     * <li>3: DFT_P03_FINANCIAL_COMMON_ORDER (a Group object) <b>optional repeating</b></li>
030                     * <li>4: DG1 (Diagnosis) <b>optional repeating</b></li>
031                     * <li>5: DRG (Diagnosis Related Group) <b>optional </b></li>
032                     * <li>6: GT1 (Guarantor) <b>optional repeating</b></li>
033                     * <li>7: DFT_P03_INSURANCE (a Group object) <b>optional repeating</b></li>
034     * </ul>
035     */
036    public class DFT_P03_FINANCIAL extends AbstractGroup {
037    
038        /** 
039         * Creates a new DFT_P03_FINANCIAL group
040         */
041        public DFT_P03_FINANCIAL(Group parent, ModelClassFactory factory) {
042           super(parent, factory);
043           init(factory);
044        }
045    
046        private void init(ModelClassFactory factory) {
047           try {
048                              this.add(FT1.class, true, false);
049                              this.add(DFT_P03_FINANCIAL_PROCEDURE.class, false, true);
050                              this.add(DFT_P03_FINANCIAL_COMMON_ORDER.class, false, true);
051                              this.add(DG1.class, false, true);
052                              this.add(DRG.class, false, false);
053                              this.add(GT1.class, false, true);
054                              this.add(DFT_P03_INSURANCE.class, false, true);
055           } catch(HL7Exception e) {
056              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating DFT_P03_FINANCIAL - this is probably a bug in the source code generator.", e);
057           }
058        }
059    
060        /** 
061         * Returns "2.4"
062         */
063        public String getVersion() {
064           return "2.4";
065        }
066    
067    
068    
069        /**
070         * Returns
071         * FT1 (Financial Transaction) - creates it if necessary
072         */
073        public FT1 getFT1() { 
074           FT1 ret = null;
075           try {
076              ret = (FT1)this.get("FT1");
077           } catch(HL7Exception e) {
078              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
079              throw new RuntimeException(e);
080           }
081           return ret;
082        }
083    
084    
085    
086    
087        /**
088         * Returns
089         * the first repetition of 
090         * FINANCIAL_PROCEDURE (a Group object) - creates it if necessary
091         */
092        public DFT_P03_FINANCIAL_PROCEDURE getFINANCIAL_PROCEDURE() { 
093           DFT_P03_FINANCIAL_PROCEDURE ret = null;
094           try {
095              ret = (DFT_P03_FINANCIAL_PROCEDURE)this.get("FINANCIAL_PROCEDURE");
096           } catch(HL7Exception e) {
097              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
098              throw new RuntimeException(e);
099           }
100           return ret;
101        }
102    
103    
104        /**
105         * Returns a specific repetition of
106         * FINANCIAL_PROCEDURE (a Group object) - creates it if necessary
107         *
108         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
109         * @throws HL7Exception if the repetition requested is more than one 
110         *     greater than the number of existing repetitions.
111         */
112        public DFT_P03_FINANCIAL_PROCEDURE getFINANCIAL_PROCEDURE(int rep) { 
113           DFT_P03_FINANCIAL_PROCEDURE ret = null;
114           try {
115              ret = (DFT_P03_FINANCIAL_PROCEDURE)this.get("FINANCIAL_PROCEDURE", rep);
116           } catch(HL7Exception e) {
117              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
118              throw new RuntimeException(e);
119           }
120           return ret;
121        }
122    
123        /** 
124         * Returns the number of existing repetitions of FINANCIAL_PROCEDURE 
125         */ 
126        public int getFINANCIAL_PROCEDUREReps() { 
127            int reps = -1; 
128            try { 
129                reps = this.getAll("FINANCIAL_PROCEDURE").length; 
130            } catch (HL7Exception e) { 
131                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
132                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
133                throw new RuntimeException(message);
134            } 
135            return reps; 
136        } 
137    
138        /**
139         * Inserts a specific repetition of FINANCIAL_PROCEDURE (a Group object)
140         * @see AbstractGroup#insertRepetition(Structure, int) 
141         */
142        public void insertFINANCIAL_PROCEDURE(DFT_P03_FINANCIAL_PROCEDURE structure, int rep) throws HL7Exception { 
143           super.insertRepetition("FINANCIAL_PROCEDURE", structure, rep);
144        }
145    
146    
147        /**
148         * Inserts a specific repetition of FINANCIAL_PROCEDURE (a Group object)
149         * @see AbstractGroup#insertRepetition(Structure, int) 
150         */
151        public DFT_P03_FINANCIAL_PROCEDURE insertFINANCIAL_PROCEDURE(int rep) throws HL7Exception { 
152           return (DFT_P03_FINANCIAL_PROCEDURE)super.insertRepetition("FINANCIAL_PROCEDURE", rep);
153        }
154    
155    
156        /**
157         * Removes a specific repetition of FINANCIAL_PROCEDURE (a Group object)
158         * @see AbstractGroup#removeRepetition(String, int) 
159         */
160        public DFT_P03_FINANCIAL_PROCEDURE removeFINANCIAL_PROCEDURE(int rep) throws HL7Exception { 
161           return (DFT_P03_FINANCIAL_PROCEDURE)super.removeRepetition("FINANCIAL_PROCEDURE", rep);
162        }
163    
164    
165    
166        /**
167         * Returns
168         * the first repetition of 
169         * FINANCIAL_COMMON_ORDER (a Group object) - creates it if necessary
170         */
171        public DFT_P03_FINANCIAL_COMMON_ORDER getFINANCIAL_COMMON_ORDER() { 
172           DFT_P03_FINANCIAL_COMMON_ORDER ret = null;
173           try {
174              ret = (DFT_P03_FINANCIAL_COMMON_ORDER)this.get("FINANCIAL_COMMON_ORDER");
175           } catch(HL7Exception e) {
176              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
177              throw new RuntimeException(e);
178           }
179           return ret;
180        }
181    
182    
183        /**
184         * Returns a specific repetition of
185         * FINANCIAL_COMMON_ORDER (a Group object) - creates it if necessary
186         *
187         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
188         * @throws HL7Exception if the repetition requested is more than one 
189         *     greater than the number of existing repetitions.
190         */
191        public DFT_P03_FINANCIAL_COMMON_ORDER getFINANCIAL_COMMON_ORDER(int rep) { 
192           DFT_P03_FINANCIAL_COMMON_ORDER ret = null;
193           try {
194              ret = (DFT_P03_FINANCIAL_COMMON_ORDER)this.get("FINANCIAL_COMMON_ORDER", rep);
195           } catch(HL7Exception e) {
196              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
197              throw new RuntimeException(e);
198           }
199           return ret;
200        }
201    
202        /** 
203         * Returns the number of existing repetitions of FINANCIAL_COMMON_ORDER 
204         */ 
205        public int getFINANCIAL_COMMON_ORDERReps() { 
206            int reps = -1; 
207            try { 
208                reps = this.getAll("FINANCIAL_COMMON_ORDER").length; 
209            } catch (HL7Exception e) { 
210                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
211                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
212                throw new RuntimeException(message);
213            } 
214            return reps; 
215        } 
216    
217        /**
218         * Inserts a specific repetition of FINANCIAL_COMMON_ORDER (a Group object)
219         * @see AbstractGroup#insertRepetition(Structure, int) 
220         */
221        public void insertFINANCIAL_COMMON_ORDER(DFT_P03_FINANCIAL_COMMON_ORDER structure, int rep) throws HL7Exception { 
222           super.insertRepetition("FINANCIAL_COMMON_ORDER", structure, rep);
223        }
224    
225    
226        /**
227         * Inserts a specific repetition of FINANCIAL_COMMON_ORDER (a Group object)
228         * @see AbstractGroup#insertRepetition(Structure, int) 
229         */
230        public DFT_P03_FINANCIAL_COMMON_ORDER insertFINANCIAL_COMMON_ORDER(int rep) throws HL7Exception { 
231           return (DFT_P03_FINANCIAL_COMMON_ORDER)super.insertRepetition("FINANCIAL_COMMON_ORDER", rep);
232        }
233    
234    
235        /**
236         * Removes a specific repetition of FINANCIAL_COMMON_ORDER (a Group object)
237         * @see AbstractGroup#removeRepetition(String, int) 
238         */
239        public DFT_P03_FINANCIAL_COMMON_ORDER removeFINANCIAL_COMMON_ORDER(int rep) throws HL7Exception { 
240           return (DFT_P03_FINANCIAL_COMMON_ORDER)super.removeRepetition("FINANCIAL_COMMON_ORDER", rep);
241        }
242    
243    
244    
245        /**
246         * Returns
247         * the first repetition of 
248         * DG1 (Diagnosis) - creates it if necessary
249         */
250        public DG1 getDG1() { 
251           DG1 ret = null;
252           try {
253              ret = (DG1)this.get("DG1");
254           } catch(HL7Exception e) {
255              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
256              throw new RuntimeException(e);
257           }
258           return ret;
259        }
260    
261    
262        /**
263         * Returns a specific repetition of
264         * DG1 (Diagnosis) - creates it if necessary
265         *
266         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
267         * @throws HL7Exception if the repetition requested is more than one 
268         *     greater than the number of existing repetitions.
269         */
270        public DG1 getDG1(int rep) { 
271           DG1 ret = null;
272           try {
273              ret = (DG1)this.get("DG1", rep);
274           } catch(HL7Exception e) {
275              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
276              throw new RuntimeException(e);
277           }
278           return ret;
279        }
280    
281        /** 
282         * Returns the number of existing repetitions of DG1 
283         */ 
284        public int getDG1Reps() { 
285            int reps = -1; 
286            try { 
287                reps = this.getAll("DG1").length; 
288            } catch (HL7Exception e) { 
289                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
290                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
291                throw new RuntimeException(message);
292            } 
293            return reps; 
294        } 
295    
296        /**
297         * Inserts a specific repetition of DG1 (Diagnosis)
298         * @see AbstractGroup#insertRepetition(Structure, int) 
299         */
300        public void insertDG1(DG1 structure, int rep) throws HL7Exception { 
301           super.insertRepetition("DG1", structure, rep);
302        }
303    
304    
305        /**
306         * Inserts a specific repetition of DG1 (Diagnosis)
307         * @see AbstractGroup#insertRepetition(Structure, int) 
308         */
309        public DG1 insertDG1(int rep) throws HL7Exception { 
310           return (DG1)super.insertRepetition("DG1", rep);
311        }
312    
313    
314        /**
315         * Removes a specific repetition of DG1 (Diagnosis)
316         * @see AbstractGroup#removeRepetition(String, int) 
317         */
318        public DG1 removeDG1(int rep) throws HL7Exception { 
319           return (DG1)super.removeRepetition("DG1", rep);
320        }
321    
322    
323    
324        /**
325         * Returns
326         * DRG (Diagnosis Related Group) - creates it if necessary
327         */
328        public DRG getDRG() { 
329           DRG ret = null;
330           try {
331              ret = (DRG)this.get("DRG");
332           } catch(HL7Exception e) {
333              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
334              throw new RuntimeException(e);
335           }
336           return ret;
337        }
338    
339    
340    
341    
342        /**
343         * Returns
344         * the first repetition of 
345         * GT1 (Guarantor) - creates it if necessary
346         */
347        public GT1 getGT1() { 
348           GT1 ret = null;
349           try {
350              ret = (GT1)this.get("GT1");
351           } catch(HL7Exception e) {
352              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
353              throw new RuntimeException(e);
354           }
355           return ret;
356        }
357    
358    
359        /**
360         * Returns a specific repetition of
361         * GT1 (Guarantor) - creates it if necessary
362         *
363         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
364         * @throws HL7Exception if the repetition requested is more than one 
365         *     greater than the number of existing repetitions.
366         */
367        public GT1 getGT1(int rep) { 
368           GT1 ret = null;
369           try {
370              ret = (GT1)this.get("GT1", rep);
371           } catch(HL7Exception e) {
372              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
373              throw new RuntimeException(e);
374           }
375           return ret;
376        }
377    
378        /** 
379         * Returns the number of existing repetitions of GT1 
380         */ 
381        public int getGT1Reps() { 
382            int reps = -1; 
383            try { 
384                reps = this.getAll("GT1").length; 
385            } catch (HL7Exception e) { 
386                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
387                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
388                throw new RuntimeException(message);
389            } 
390            return reps; 
391        } 
392    
393        /**
394         * Inserts a specific repetition of GT1 (Guarantor)
395         * @see AbstractGroup#insertRepetition(Structure, int) 
396         */
397        public void insertGT1(GT1 structure, int rep) throws HL7Exception { 
398           super.insertRepetition("GT1", structure, rep);
399        }
400    
401    
402        /**
403         * Inserts a specific repetition of GT1 (Guarantor)
404         * @see AbstractGroup#insertRepetition(Structure, int) 
405         */
406        public GT1 insertGT1(int rep) throws HL7Exception { 
407           return (GT1)super.insertRepetition("GT1", rep);
408        }
409    
410    
411        /**
412         * Removes a specific repetition of GT1 (Guarantor)
413         * @see AbstractGroup#removeRepetition(String, int) 
414         */
415        public GT1 removeGT1(int rep) throws HL7Exception { 
416           return (GT1)super.removeRepetition("GT1", rep);
417        }
418    
419    
420    
421        /**
422         * Returns
423         * the first repetition of 
424         * INSURANCE (a Group object) - creates it if necessary
425         */
426        public DFT_P03_INSURANCE getINSURANCE() { 
427           DFT_P03_INSURANCE ret = null;
428           try {
429              ret = (DFT_P03_INSURANCE)this.get("INSURANCE");
430           } catch(HL7Exception e) {
431              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
432              throw new RuntimeException(e);
433           }
434           return ret;
435        }
436    
437    
438        /**
439         * Returns a specific repetition of
440         * INSURANCE (a Group object) - creates it if necessary
441         *
442         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
443         * @throws HL7Exception if the repetition requested is more than one 
444         *     greater than the number of existing repetitions.
445         */
446        public DFT_P03_INSURANCE getINSURANCE(int rep) { 
447           DFT_P03_INSURANCE ret = null;
448           try {
449              ret = (DFT_P03_INSURANCE)this.get("INSURANCE", rep);
450           } catch(HL7Exception e) {
451              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
452              throw new RuntimeException(e);
453           }
454           return ret;
455        }
456    
457        /** 
458         * Returns the number of existing repetitions of INSURANCE 
459         */ 
460        public int getINSURANCEReps() { 
461            int reps = -1; 
462            try { 
463                reps = this.getAll("INSURANCE").length; 
464            } catch (HL7Exception e) { 
465                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
466                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
467                throw new RuntimeException(message);
468            } 
469            return reps; 
470        } 
471    
472        /**
473         * Inserts a specific repetition of INSURANCE (a Group object)
474         * @see AbstractGroup#insertRepetition(Structure, int) 
475         */
476        public void insertINSURANCE(DFT_P03_INSURANCE structure, int rep) throws HL7Exception { 
477           super.insertRepetition("INSURANCE", structure, rep);
478        }
479    
480    
481        /**
482         * Inserts a specific repetition of INSURANCE (a Group object)
483         * @see AbstractGroup#insertRepetition(Structure, int) 
484         */
485        public DFT_P03_INSURANCE insertINSURANCE(int rep) throws HL7Exception { 
486           return (DFT_P03_INSURANCE)super.insertRepetition("INSURANCE", rep);
487        }
488    
489    
490        /**
491         * Removes a specific repetition of INSURANCE (a Group object)
492         * @see AbstractGroup#removeRepetition(String, int) 
493         */
494        public DFT_P03_INSURANCE removeINSURANCE(int rep) throws HL7Exception { 
495           return (DFT_P03_INSURANCE)super.removeRepetition("INSURANCE", rep);
496        }
497    
498    
499    
500    }
501