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