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.v231.message;
009    
010    import ca.uhn.hl7v2.model.v231.group.*;
011    import ca.uhn.hl7v2.model.v231.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 RQC_I06 message structure (see chapter ?). This structure contains the 
021     * following elements: </p>
022     * <ul>
023                     * <li>1: MSH (MSH - message header segment) <b> </b></li>
024                     * <li>2: QRD (QRD - original-style query definition segment) <b> </b></li>
025                     * <li>3: QRF (QRF - original style query filter segment) <b>optional </b></li>
026                     * <li>4: RQC_I06_PRDCTD (a Group object) <b> repeating</b></li>
027                     * <li>5: PID (PID - patient identification segment) <b> </b></li>
028                     * <li>6: NK1 (NK1 - next of kin / associated parties segment-) <b>optional repeating</b></li>
029                     * <li>7: GT1 (GT1 - guarantor segment) <b>optional </b></li>
030                     * <li>8: NTE (NTE - notes and comments segment) <b>optional repeating</b></li>
031     * </ul>
032     */
033    public class RQC_I06 extends AbstractMessage  {
034    
035        /**
036         * Creates a new RQC_I06 message with DefaultModelClassFactory. 
037         */ 
038        public RQC_I06() { 
039           this(new DefaultModelClassFactory());
040        }
041    
042        /** 
043         * Creates a new RQC_I06 message with custom ModelClassFactory.
044         */
045        public RQC_I06(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(QRD.class, true, false);
054                              this.add(QRF.class, false, false);
055                              this.add(RQC_I06_PRDCTD.class, true, true);
056                              this.add(PID.class, true, false);
057                              this.add(NK1.class, false, true);
058                              this.add(GT1.class, false, false);
059                              this.add(NTE.class, false, true);
060           } catch(HL7Exception e) {
061              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating RQC_I06 - this is probably a bug in the source code generator.", e);
062           }
063        }
064    
065        /** 
066         * Returns "2.3.1"
067         */
068        public String getVersion() {
069           return "2.3.1";
070        }
071    
072    
073    
074        /**
075         * Returns
076         * MSH (MSH - message header segment) - 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         * QRD (QRD - original-style query definition segment) - creates it if necessary
095         */
096        public QRD getQRD() { 
097           QRD ret = null;
098           try {
099              ret = (QRD)this.get("QRD");
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         * QRF (QRF - original style query filter segment) - creates it if necessary
113         */
114        public QRF getQRF() { 
115           QRF ret = null;
116           try {
117              ret = (QRF)this.get("QRF");
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         * PRDCTD (a Group object) - creates it if necessary
132         */
133        public RQC_I06_PRDCTD getPRDCTD() { 
134           RQC_I06_PRDCTD ret = null;
135           try {
136              ret = (RQC_I06_PRDCTD)this.get("PRDCTD");
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         * PRDCTD (a Group object) - 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 RQC_I06_PRDCTD getPRDCTD(int rep) { 
154           RQC_I06_PRDCTD ret = null;
155           try {
156              ret = (RQC_I06_PRDCTD)this.get("PRDCTD", 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 PRDCTD 
166         */ 
167        public int getPRDCTDReps() { 
168            int reps = -1; 
169            try { 
170                reps = this.getAll("PRDCTD").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 PRDCTD (a Group object)
181         * @see AbstractGroup\#insertRepetition(Structure, int) 
182         */
183        public void insertPRDCTD(RQC_I06_PRDCTD structure, int rep) throws HL7Exception { 
184           super.insertRepetition( "PRDCTD", structure, rep);
185        }
186    
187    
188        /**
189         * Inserts a specific repetition of PRDCTD (a Group object)
190         * @see AbstractGroup\#insertRepetition(Structure, int) 
191         */
192        public RQC_I06_PRDCTD insertPRDCTD(int rep) throws HL7Exception { 
193           return (RQC_I06_PRDCTD)super.insertRepetition("PRDCTD", rep);
194        }
195    
196    
197        /**
198         * Removes a specific repetition of PRDCTD (a Group object)
199         * @see AbstractGroup\#removeRepetition(String, int) 
200         */
201        public RQC_I06_PRDCTD removePRDCTD(int rep) throws HL7Exception { 
202           return (RQC_I06_PRDCTD)super.removeRepetition("PRDCTD", rep);
203        }
204    
205    
206    
207        /**
208         * Returns
209         * PID (PID - patient identification segment) - creates it if necessary
210         */
211        public PID getPID() { 
212           PID ret = null;
213           try {
214              ret = (PID)this.get("PID");
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         * NK1 (NK1 - next of kin / associated parties segment-) - creates it if necessary
229         */
230        public NK1 getNK1() { 
231           NK1 ret = null;
232           try {
233              ret = (NK1)this.get("NK1");
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         * NK1 (NK1 - next of kin / associated parties segment-) - 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 NK1 getNK1(int rep) { 
251           NK1 ret = null;
252           try {
253              ret = (NK1)this.get("NK1", 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 NK1 
263         */ 
264        public int getNK1Reps() { 
265            int reps = -1; 
266            try { 
267                reps = this.getAll("NK1").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 NK1 (NK1 - next of kin / associated parties segment-)
278         * @see AbstractGroup\#insertRepetition(Structure, int) 
279         */
280        public void insertNK1(NK1 structure, int rep) throws HL7Exception { 
281           super.insertRepetition( "NK1", structure, rep);
282        }
283    
284    
285        /**
286         * Inserts a specific repetition of NK1 (NK1 - next of kin / associated parties segment-)
287         * @see AbstractGroup\#insertRepetition(Structure, int) 
288         */
289        public NK1 insertNK1(int rep) throws HL7Exception { 
290           return (NK1)super.insertRepetition("NK1", rep);
291        }
292    
293    
294        /**
295         * Removes a specific repetition of NK1 (NK1 - next of kin / associated parties segment-)
296         * @see AbstractGroup\#removeRepetition(String, int) 
297         */
298        public NK1 removeNK1(int rep) throws HL7Exception { 
299           return (NK1)super.removeRepetition("NK1", rep);
300        }
301    
302    
303    
304        /**
305         * Returns
306         * GT1 (GT1 - guarantor segment) - creates it if necessary
307         */
308        public GT1 getGT1() { 
309           GT1 ret = null;
310           try {
311              ret = (GT1)this.get("GT1");
312           } catch(HL7Exception e) {
313              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
314              throw new RuntimeException(e);
315           }
316           return ret;
317        }
318    
319    
320    
321    
322        /**
323         * Returns
324         * the first repetition of 
325         * NTE (NTE - notes and comments segment) - creates it if necessary
326         */
327        public NTE getNTE() { 
328           NTE ret = null;
329           try {
330              ret = (NTE)this.get("NTE");
331           } catch(HL7Exception e) {
332              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
333              throw new RuntimeException(e);
334           }
335           return ret;
336        }
337    
338    
339        /**
340         * Returns a specific repetition of
341         * NTE (NTE - notes and comments segment) - creates it if necessary
342         *
343         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
344         * @throws HL7Exception if the repetition requested is more than one 
345         *     greater than the number of existing repetitions.
346         */
347        public NTE getNTE(int rep) { 
348           NTE ret = null;
349           try {
350              ret = (NTE)this.get("NTE", rep);
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         * Returns the number of existing repetitions of NTE 
360         */ 
361        public int getNTEReps() { 
362            int reps = -1; 
363            try { 
364                reps = this.getAll("NTE").length; 
365            } catch (HL7Exception e) { 
366                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
367                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
368                throw new RuntimeException(message);
369            } 
370            return reps; 
371        } 
372    
373        /**
374         * Inserts a specific repetition of NTE (NTE - notes and comments segment)
375         * @see AbstractGroup\#insertRepetition(Structure, int) 
376         */
377        public void insertNTE(NTE structure, int rep) throws HL7Exception { 
378           super.insertRepetition( "NTE", structure, rep);
379        }
380    
381    
382        /**
383         * Inserts a specific repetition of NTE (NTE - notes and comments segment)
384         * @see AbstractGroup\#insertRepetition(Structure, int) 
385         */
386        public NTE insertNTE(int rep) throws HL7Exception { 
387           return (NTE)super.insertRepetition("NTE", rep);
388        }
389    
390    
391        /**
392         * Removes a specific repetition of NTE (NTE - notes and comments segment)
393         * @see AbstractGroup\#removeRepetition(String, int) 
394         */
395        public NTE removeNTE(int rep) throws HL7Exception { 
396           return (NTE)super.removeRepetition("NTE", rep);
397        }
398    
399    
400    
401    }
402