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