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