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 VXR_V03 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: MSA (MSA - message acknowledgment segment) <b> </b></li>
025                     * <li>3: QRD (QRD - original-style query definition segment) <b> </b></li>
026                     * <li>4: QRF (QRF - original style query filter segment) <b>optional </b></li>
027                     * <li>5: PID (PID - patient identification segment) <b> </b></li>
028                     * <li>6: PD1 (PD1 - patient additional demographic segment) <b>optional </b></li>
029                     * <li>7: NK1 (NK1 - next of kin / associated parties segment-) <b>optional repeating</b></li>
030                     * <li>8: VXR_V03_PV1PV2 (a Group object) <b>optional </b></li>
031                     * <li>9: VXR_V03_IN1IN2IN3 (a Group object) <b>optional repeating</b></li>
032                     * <li>10: VXR_V03_ORCRXARXROBXNTE (a Group object) <b>optional repeating</b></li>
033     * </ul>
034     */
035    public class VXR_V03 extends AbstractMessage  {
036    
037        /**
038         * Creates a new VXR_V03 message with DefaultModelClassFactory. 
039         */ 
040        public VXR_V03() { 
041           this(new DefaultModelClassFactory());
042        }
043    
044        /** 
045         * Creates a new VXR_V03 message with custom ModelClassFactory.
046         */
047        public VXR_V03(ModelClassFactory factory) {
048           super(factory);
049           init(factory);
050        }
051    
052        private void init(ModelClassFactory factory) {
053           try {
054                              this.add(MSH.class, true, false);
055                              this.add(MSA.class, true, false);
056                              this.add(QRD.class, true, false);
057                              this.add(QRF.class, false, false);
058                              this.add(PID.class, true, false);
059                              this.add(PD1.class, false, false);
060                              this.add(NK1.class, false, true);
061                              this.add(VXR_V03_PV1PV2.class, false, false);
062                              this.add(VXR_V03_IN1IN2IN3.class, false, true);
063                              this.add(VXR_V03_ORCRXARXROBXNTE.class, false, true);
064           } catch(HL7Exception e) {
065              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating VXR_V03 - this is probably a bug in the source code generator.", e);
066           }
067        }
068    
069        /** 
070         * Returns "2.3.1"
071         */
072        public String getVersion() {
073           return "2.3.1";
074        }
075    
076    
077    
078        /**
079         * Returns
080         * MSH (MSH - message header segment) - creates it if necessary
081         */
082        public MSH getMSH() { 
083           MSH ret = null;
084           try {
085              ret = (MSH)this.get("MSH");
086           } catch(HL7Exception e) {
087              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
088              throw new RuntimeException(e);
089           }
090           return ret;
091        }
092    
093    
094    
095    
096        /**
097         * Returns
098         * MSA (MSA - message acknowledgment segment) - creates it if necessary
099         */
100        public MSA getMSA() { 
101           MSA ret = null;
102           try {
103              ret = (MSA)this.get("MSA");
104           } catch(HL7Exception e) {
105              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
106              throw new RuntimeException(e);
107           }
108           return ret;
109        }
110    
111    
112    
113    
114        /**
115         * Returns
116         * QRD (QRD - original-style query definition segment) - creates it if necessary
117         */
118        public QRD getQRD() { 
119           QRD ret = null;
120           try {
121              ret = (QRD)this.get("QRD");
122           } catch(HL7Exception e) {
123              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
124              throw new RuntimeException(e);
125           }
126           return ret;
127        }
128    
129    
130    
131    
132        /**
133         * Returns
134         * QRF (QRF - original style query filter segment) - creates it if necessary
135         */
136        public QRF getQRF() { 
137           QRF ret = null;
138           try {
139              ret = (QRF)this.get("QRF");
140           } catch(HL7Exception e) {
141              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
142              throw new RuntimeException(e);
143           }
144           return ret;
145        }
146    
147    
148    
149    
150        /**
151         * Returns
152         * PID (PID - patient identification segment) - creates it if necessary
153         */
154        public PID getPID() { 
155           PID ret = null;
156           try {
157              ret = (PID)this.get("PID");
158           } catch(HL7Exception e) {
159              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
160              throw new RuntimeException(e);
161           }
162           return ret;
163        }
164    
165    
166    
167    
168        /**
169         * Returns
170         * PD1 (PD1 - patient additional demographic segment) - creates it if necessary
171         */
172        public PD1 getPD1() { 
173           PD1 ret = null;
174           try {
175              ret = (PD1)this.get("PD1");
176           } catch(HL7Exception e) {
177              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
178              throw new RuntimeException(e);
179           }
180           return ret;
181        }
182    
183    
184    
185    
186        /**
187         * Returns
188         * the first repetition of 
189         * NK1 (NK1 - next of kin / associated parties segment-) - creates it if necessary
190         */
191        public NK1 getNK1() { 
192           NK1 ret = null;
193           try {
194              ret = (NK1)this.get("NK1");
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        /**
204         * Returns a specific repetition of
205         * NK1 (NK1 - next of kin / associated parties segment-) - creates it if necessary
206         *
207         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
208         * @throws HL7Exception if the repetition requested is more than one 
209         *     greater than the number of existing repetitions.
210         */
211        public NK1 getNK1(int rep) { 
212           NK1 ret = null;
213           try {
214              ret = (NK1)this.get("NK1", rep);
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         * Returns the number of existing repetitions of NK1 
224         */ 
225        public int getNK1Reps() { 
226            int reps = -1; 
227            try { 
228                reps = this.getAll("NK1").length; 
229            } catch (HL7Exception e) { 
230                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
231                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
232                throw new RuntimeException(message);
233            } 
234            return reps; 
235        } 
236    
237        /**
238         * Inserts a specific repetition of NK1 (NK1 - next of kin / associated parties segment-)
239         * @see AbstractGroup\#insertRepetition(Structure, int) 
240         */
241        public void insertNK1(NK1 structure, int rep) throws HL7Exception { 
242           super.insertRepetition( "NK1", structure, rep);
243        }
244    
245    
246        /**
247         * Inserts a specific repetition of NK1 (NK1 - next of kin / associated parties segment-)
248         * @see AbstractGroup\#insertRepetition(Structure, int) 
249         */
250        public NK1 insertNK1(int rep) throws HL7Exception { 
251           return (NK1)super.insertRepetition("NK1", rep);
252        }
253    
254    
255        /**
256         * Removes a specific repetition of NK1 (NK1 - next of kin / associated parties segment-)
257         * @see AbstractGroup\#removeRepetition(String, int) 
258         */
259        public NK1 removeNK1(int rep) throws HL7Exception { 
260           return (NK1)super.removeRepetition("NK1", rep);
261        }
262    
263    
264    
265        /**
266         * Returns
267         * PV1PV2 (a Group object) - creates it if necessary
268         */
269        public VXR_V03_PV1PV2 getPV1PV2() { 
270           VXR_V03_PV1PV2 ret = null;
271           try {
272              ret = (VXR_V03_PV1PV2)this.get("PV1PV2");
273           } catch(HL7Exception e) {
274              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
275              throw new RuntimeException(e);
276           }
277           return ret;
278        }
279    
280    
281    
282    
283        /**
284         * Returns
285         * the first repetition of 
286         * IN1IN2IN3 (a Group object) - creates it if necessary
287         */
288        public VXR_V03_IN1IN2IN3 getIN1IN2IN3() { 
289           VXR_V03_IN1IN2IN3 ret = null;
290           try {
291              ret = (VXR_V03_IN1IN2IN3)this.get("IN1IN2IN3");
292           } catch(HL7Exception e) {
293              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
294              throw new RuntimeException(e);
295           }
296           return ret;
297        }
298    
299    
300        /**
301         * Returns a specific repetition of
302         * IN1IN2IN3 (a Group object) - creates it if necessary
303         *
304         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
305         * @throws HL7Exception if the repetition requested is more than one 
306         *     greater than the number of existing repetitions.
307         */
308        public VXR_V03_IN1IN2IN3 getIN1IN2IN3(int rep) { 
309           VXR_V03_IN1IN2IN3 ret = null;
310           try {
311              ret = (VXR_V03_IN1IN2IN3)this.get("IN1IN2IN3", rep);
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         * Returns the number of existing repetitions of IN1IN2IN3 
321         */ 
322        public int getIN1IN2IN3Reps() { 
323            int reps = -1; 
324            try { 
325                reps = this.getAll("IN1IN2IN3").length; 
326            } catch (HL7Exception e) { 
327                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
328                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
329                throw new RuntimeException(message);
330            } 
331            return reps; 
332        } 
333    
334        /**
335         * Inserts a specific repetition of IN1IN2IN3 (a Group object)
336         * @see AbstractGroup\#insertRepetition(Structure, int) 
337         */
338        public void insertIN1IN2IN3(VXR_V03_IN1IN2IN3 structure, int rep) throws HL7Exception { 
339           super.insertRepetition( "IN1IN2IN3", structure, rep);
340        }
341    
342    
343        /**
344         * Inserts a specific repetition of IN1IN2IN3 (a Group object)
345         * @see AbstractGroup\#insertRepetition(Structure, int) 
346         */
347        public VXR_V03_IN1IN2IN3 insertIN1IN2IN3(int rep) throws HL7Exception { 
348           return (VXR_V03_IN1IN2IN3)super.insertRepetition("IN1IN2IN3", rep);
349        }
350    
351    
352        /**
353         * Removes a specific repetition of IN1IN2IN3 (a Group object)
354         * @see AbstractGroup\#removeRepetition(String, int) 
355         */
356        public VXR_V03_IN1IN2IN3 removeIN1IN2IN3(int rep) throws HL7Exception { 
357           return (VXR_V03_IN1IN2IN3)super.removeRepetition("IN1IN2IN3", rep);
358        }
359    
360    
361    
362        /**
363         * Returns
364         * the first repetition of 
365         * ORCRXARXROBXNTE (a Group object) - creates it if necessary
366         */
367        public VXR_V03_ORCRXARXROBXNTE getORCRXARXROBXNTE() { 
368           VXR_V03_ORCRXARXROBXNTE ret = null;
369           try {
370              ret = (VXR_V03_ORCRXARXROBXNTE)this.get("ORCRXARXROBXNTE");
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        /**
380         * Returns a specific repetition of
381         * ORCRXARXROBXNTE (a Group object) - creates it if necessary
382         *
383         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
384         * @throws HL7Exception if the repetition requested is more than one 
385         *     greater than the number of existing repetitions.
386         */
387        public VXR_V03_ORCRXARXROBXNTE getORCRXARXROBXNTE(int rep) { 
388           VXR_V03_ORCRXARXROBXNTE ret = null;
389           try {
390              ret = (VXR_V03_ORCRXARXROBXNTE)this.get("ORCRXARXROBXNTE", rep);
391           } catch(HL7Exception e) {
392              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
393              throw new RuntimeException(e);
394           }
395           return ret;
396        }
397    
398        /** 
399         * Returns the number of existing repetitions of ORCRXARXROBXNTE 
400         */ 
401        public int getORCRXARXROBXNTEReps() { 
402            int reps = -1; 
403            try { 
404                reps = this.getAll("ORCRXARXROBXNTE").length; 
405            } catch (HL7Exception e) { 
406                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
407                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
408                throw new RuntimeException(message);
409            } 
410            return reps; 
411        } 
412    
413        /**
414         * Inserts a specific repetition of ORCRXARXROBXNTE (a Group object)
415         * @see AbstractGroup\#insertRepetition(Structure, int) 
416         */
417        public void insertORCRXARXROBXNTE(VXR_V03_ORCRXARXROBXNTE structure, int rep) throws HL7Exception { 
418           super.insertRepetition( "ORCRXARXROBXNTE", structure, rep);
419        }
420    
421    
422        /**
423         * Inserts a specific repetition of ORCRXARXROBXNTE (a Group object)
424         * @see AbstractGroup\#insertRepetition(Structure, int) 
425         */
426        public VXR_V03_ORCRXARXROBXNTE insertORCRXARXROBXNTE(int rep) throws HL7Exception { 
427           return (VXR_V03_ORCRXARXROBXNTE)super.insertRepetition("ORCRXARXROBXNTE", rep);
428        }
429    
430    
431        /**
432         * Removes a specific repetition of ORCRXARXROBXNTE (a Group object)
433         * @see AbstractGroup\#removeRepetition(String, int) 
434         */
435        public VXR_V03_ORCRXARXROBXNTE removeORCRXARXROBXNTE(int rep) throws HL7Exception { 
436           return (VXR_V03_ORCRXARXROBXNTE)super.removeRepetition("ORCRXARXROBXNTE", rep);
437        }
438    
439    
440    
441    }
442