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