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 VXU_V04 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: PID (PID - patient identification segment) <b> </b></li>
025                     * <li>3: PD1 (PD1 - patient additional demographic segment) <b>optional </b></li>
026                     * <li>4: NK1 (NK1 - next of kin / associated parties segment-) <b>optional repeating</b></li>
027                     * <li>5: VXU_V04_PV1PV2 (a Group object) <b>optional </b></li>
028                     * <li>6: VXU_V04_IN1IN2IN3 (a Group object) <b>optional repeating</b></li>
029                     * <li>7: VXU_V04_ORCRXARXROBXNTE (a Group object) <b>optional repeating</b></li>
030     * </ul>
031     */
032    public class VXU_V04 extends AbstractMessage  {
033    
034        /**
035         * Creates a new VXU_V04 message with DefaultModelClassFactory. 
036         */ 
037        public VXU_V04() { 
038           this(new DefaultModelClassFactory());
039        }
040    
041        /** 
042         * Creates a new VXU_V04 message with custom ModelClassFactory.
043         */
044        public VXU_V04(ModelClassFactory factory) {
045           super(factory);
046           init(factory);
047        }
048    
049        private void init(ModelClassFactory factory) {
050           try {
051                              this.add(MSH.class, true, false);
052                              this.add(PID.class, true, false);
053                              this.add(PD1.class, false, false);
054                              this.add(NK1.class, false, true);
055                              this.add(VXU_V04_PV1PV2.class, false, false);
056                              this.add(VXU_V04_IN1IN2IN3.class, false, true);
057                              this.add(VXU_V04_ORCRXARXROBXNTE.class, false, true);
058           } catch(HL7Exception e) {
059              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating VXU_V04 - this is probably a bug in the source code generator.", e);
060           }
061        }
062    
063        /** 
064         * Returns "2.3.1"
065         */
066        public String getVersion() {
067           return "2.3.1";
068        }
069    
070    
071    
072        /**
073         * Returns
074         * MSH (MSH - message header segment) - creates it if necessary
075         */
076        public MSH getMSH() { 
077           MSH ret = null;
078           try {
079              ret = (MSH)this.get("MSH");
080           } catch(HL7Exception e) {
081              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
082              throw new RuntimeException(e);
083           }
084           return ret;
085        }
086    
087    
088    
089    
090        /**
091         * Returns
092         * PID (PID - patient identification segment) - creates it if necessary
093         */
094        public PID getPID() { 
095           PID ret = null;
096           try {
097              ret = (PID)this.get("PID");
098           } catch(HL7Exception e) {
099              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
100              throw new RuntimeException(e);
101           }
102           return ret;
103        }
104    
105    
106    
107    
108        /**
109         * Returns
110         * PD1 (PD1 - patient additional demographic segment) - creates it if necessary
111         */
112        public PD1 getPD1() { 
113           PD1 ret = null;
114           try {
115              ret = (PD1)this.get("PD1");
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    
125    
126        /**
127         * Returns
128         * the first repetition of 
129         * NK1 (NK1 - next of kin / associated parties segment-) - creates it if necessary
130         */
131        public NK1 getNK1() { 
132           NK1 ret = null;
133           try {
134              ret = (NK1)this.get("NK1");
135           } catch(HL7Exception e) {
136              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
137              throw new RuntimeException(e);
138           }
139           return ret;
140        }
141    
142    
143        /**
144         * Returns a specific repetition of
145         * NK1 (NK1 - next of kin / associated parties segment-) - creates it if necessary
146         *
147         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
148         * @throws HL7Exception if the repetition requested is more than one 
149         *     greater than the number of existing repetitions.
150         */
151        public NK1 getNK1(int rep) { 
152           NK1 ret = null;
153           try {
154              ret = (NK1)this.get("NK1", rep);
155           } catch(HL7Exception e) {
156              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
157              throw new RuntimeException(e);
158           }
159           return ret;
160        }
161    
162        /** 
163         * Returns the number of existing repetitions of NK1 
164         */ 
165        public int getNK1Reps() { 
166            int reps = -1; 
167            try { 
168                reps = this.getAll("NK1").length; 
169            } catch (HL7Exception e) { 
170                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
171                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
172                throw new RuntimeException(message);
173            } 
174            return reps; 
175        } 
176    
177        /**
178         * Inserts a specific repetition of NK1 (NK1 - next of kin / associated parties segment-)
179         * @see AbstractGroup\#insertRepetition(Structure, int) 
180         */
181        public void insertNK1(NK1 structure, int rep) throws HL7Exception { 
182           super.insertRepetition( "NK1", structure, rep);
183        }
184    
185    
186        /**
187         * Inserts a specific repetition of NK1 (NK1 - next of kin / associated parties segment-)
188         * @see AbstractGroup\#insertRepetition(Structure, int) 
189         */
190        public NK1 insertNK1(int rep) throws HL7Exception { 
191           return (NK1)super.insertRepetition("NK1", rep);
192        }
193    
194    
195        /**
196         * Removes a specific repetition of NK1 (NK1 - next of kin / associated parties segment-)
197         * @see AbstractGroup\#removeRepetition(String, int) 
198         */
199        public NK1 removeNK1(int rep) throws HL7Exception { 
200           return (NK1)super.removeRepetition("NK1", rep);
201        }
202    
203    
204    
205        /**
206         * Returns
207         * PV1PV2 (a Group object) - creates it if necessary
208         */
209        public VXU_V04_PV1PV2 getPV1PV2() { 
210           VXU_V04_PV1PV2 ret = null;
211           try {
212              ret = (VXU_V04_PV1PV2)this.get("PV1PV2");
213           } catch(HL7Exception e) {
214              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
215              throw new RuntimeException(e);
216           }
217           return ret;
218        }
219    
220    
221    
222    
223        /**
224         * Returns
225         * the first repetition of 
226         * IN1IN2IN3 (a Group object) - creates it if necessary
227         */
228        public VXU_V04_IN1IN2IN3 getIN1IN2IN3() { 
229           VXU_V04_IN1IN2IN3 ret = null;
230           try {
231              ret = (VXU_V04_IN1IN2IN3)this.get("IN1IN2IN3");
232           } catch(HL7Exception e) {
233              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
234              throw new RuntimeException(e);
235           }
236           return ret;
237        }
238    
239    
240        /**
241         * Returns a specific repetition of
242         * IN1IN2IN3 (a Group object) - creates it if necessary
243         *
244         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
245         * @throws HL7Exception if the repetition requested is more than one 
246         *     greater than the number of existing repetitions.
247         */
248        public VXU_V04_IN1IN2IN3 getIN1IN2IN3(int rep) { 
249           VXU_V04_IN1IN2IN3 ret = null;
250           try {
251              ret = (VXU_V04_IN1IN2IN3)this.get("IN1IN2IN3", rep);
252           } catch(HL7Exception e) {
253              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
254              throw new RuntimeException(e);
255           }
256           return ret;
257        }
258    
259        /** 
260         * Returns the number of existing repetitions of IN1IN2IN3 
261         */ 
262        public int getIN1IN2IN3Reps() { 
263            int reps = -1; 
264            try { 
265                reps = this.getAll("IN1IN2IN3").length; 
266            } catch (HL7Exception e) { 
267                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
268                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
269                throw new RuntimeException(message);
270            } 
271            return reps; 
272        } 
273    
274        /**
275         * Inserts a specific repetition of IN1IN2IN3 (a Group object)
276         * @see AbstractGroup\#insertRepetition(Structure, int) 
277         */
278        public void insertIN1IN2IN3(VXU_V04_IN1IN2IN3 structure, int rep) throws HL7Exception { 
279           super.insertRepetition( "IN1IN2IN3", structure, rep);
280        }
281    
282    
283        /**
284         * Inserts a specific repetition of IN1IN2IN3 (a Group object)
285         * @see AbstractGroup\#insertRepetition(Structure, int) 
286         */
287        public VXU_V04_IN1IN2IN3 insertIN1IN2IN3(int rep) throws HL7Exception { 
288           return (VXU_V04_IN1IN2IN3)super.insertRepetition("IN1IN2IN3", rep);
289        }
290    
291    
292        /**
293         * Removes a specific repetition of IN1IN2IN3 (a Group object)
294         * @see AbstractGroup\#removeRepetition(String, int) 
295         */
296        public VXU_V04_IN1IN2IN3 removeIN1IN2IN3(int rep) throws HL7Exception { 
297           return (VXU_V04_IN1IN2IN3)super.removeRepetition("IN1IN2IN3", rep);
298        }
299    
300    
301    
302        /**
303         * Returns
304         * the first repetition of 
305         * ORCRXARXROBXNTE (a Group object) - creates it if necessary
306         */
307        public VXU_V04_ORCRXARXROBXNTE getORCRXARXROBXNTE() { 
308           VXU_V04_ORCRXARXROBXNTE ret = null;
309           try {
310              ret = (VXU_V04_ORCRXARXROBXNTE)this.get("ORCRXARXROBXNTE");
311           } catch(HL7Exception e) {
312              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
313              throw new RuntimeException(e);
314           }
315           return ret;
316        }
317    
318    
319        /**
320         * Returns a specific repetition of
321         * ORCRXARXROBXNTE (a Group object) - creates it if necessary
322         *
323         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
324         * @throws HL7Exception if the repetition requested is more than one 
325         *     greater than the number of existing repetitions.
326         */
327        public VXU_V04_ORCRXARXROBXNTE getORCRXARXROBXNTE(int rep) { 
328           VXU_V04_ORCRXARXROBXNTE ret = null;
329           try {
330              ret = (VXU_V04_ORCRXARXROBXNTE)this.get("ORCRXARXROBXNTE", rep);
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         * Returns the number of existing repetitions of ORCRXARXROBXNTE 
340         */ 
341        public int getORCRXARXROBXNTEReps() { 
342            int reps = -1; 
343            try { 
344                reps = this.getAll("ORCRXARXROBXNTE").length; 
345            } catch (HL7Exception e) { 
346                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
347                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
348                throw new RuntimeException(message);
349            } 
350            return reps; 
351        } 
352    
353        /**
354         * Inserts a specific repetition of ORCRXARXROBXNTE (a Group object)
355         * @see AbstractGroup\#insertRepetition(Structure, int) 
356         */
357        public void insertORCRXARXROBXNTE(VXU_V04_ORCRXARXROBXNTE structure, int rep) throws HL7Exception { 
358           super.insertRepetition( "ORCRXARXROBXNTE", structure, rep);
359        }
360    
361    
362        /**
363         * Inserts a specific repetition of ORCRXARXROBXNTE (a Group object)
364         * @see AbstractGroup\#insertRepetition(Structure, int) 
365         */
366        public VXU_V04_ORCRXARXROBXNTE insertORCRXARXROBXNTE(int rep) throws HL7Exception { 
367           return (VXU_V04_ORCRXARXROBXNTE)super.insertRepetition("ORCRXARXROBXNTE", rep);
368        }
369    
370    
371        /**
372         * Removes a specific repetition of ORCRXARXROBXNTE (a Group object)
373         * @see AbstractGroup\#removeRepetition(String, int) 
374         */
375        public VXU_V04_ORCRXARXROBXNTE removeORCRXARXROBXNTE(int rep) throws HL7Exception { 
376           return (VXU_V04_ORCRXARXROBXNTE)super.removeRepetition("ORCRXARXROBXNTE", rep);
377        }
378    
379    
380    
381    }
382