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.group;
009    
010    import ca.uhn.hl7v2.model.v231.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 RDO_O01_RXONTERXRRXCNTEOBXNTE 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 (RXO - pharmacy/treatment order segment) <b> </b></li>
028                     * <li>2: NTE (NTE - notes and comments segment) <b>optional repeating</b></li>
029                     * <li>3: RXR (RXR - pharmacy/treatment route segment) <b> repeating</b></li>
030                     * <li>4: RDO_O01_RXCNTE (a Group object) <b>optional </b></li>
031                     * <li>5: RDO_O01_OBXNTE (a Group object) <b>optional repeating</b></li>
032     * </ul>
033     */
034    public class RDO_O01_RXONTERXRRXCNTEOBXNTE extends AbstractGroup {
035    
036        /** 
037         * Creates a new RDO_O01_RXONTERXRRXCNTEOBXNTE group
038         */
039        public RDO_O01_RXONTERXRRXCNTEOBXNTE(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(RDO_O01_RXCNTE.class, false, false);
050                              this.add(RDO_O01_OBXNTE.class, false, true);
051           } catch(HL7Exception e) {
052              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating RDO_O01_RXONTERXRRXCNTEOBXNTE - this is probably a bug in the source code generator.", e);
053           }
054        }
055    
056        /** 
057         * Returns "2.3.1"
058         */
059        public String getVersion() {
060           return "2.3.1";
061        }
062    
063    
064    
065        /**
066         * Returns
067         * RXO (RXO - pharmacy/treatment order segment) - 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 (NTE - notes and comments segment) - 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 (NTE - notes and comments segment) - 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 (NTE - notes and comments segment)
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 (NTE - notes and comments segment)
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 (NTE - notes and comments segment)
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 (RXR - pharmacy/treatment route segment) - 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 (RXR - pharmacy/treatment route segment) - 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 (RXR - pharmacy/treatment route segment)
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 (RXR - pharmacy/treatment route segment)
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 (RXR - pharmacy/treatment route segment)
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         * RXCNTE (a Group object) - creates it if necessary
244         */
245        public RDO_O01_RXCNTE getRXCNTE() { 
246           RDO_O01_RXCNTE ret = null;
247           try {
248              ret = (RDO_O01_RXCNTE)this.get("RXCNTE");
249           } catch(HL7Exception e) {
250              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
251              throw new RuntimeException(e);
252           }
253           return ret;
254        }
255    
256    
257    
258    
259        /**
260         * Returns
261         * the first repetition of 
262         * OBXNTE (a Group object) - creates it if necessary
263         */
264        public RDO_O01_OBXNTE getOBXNTE() { 
265           RDO_O01_OBXNTE ret = null;
266           try {
267              ret = (RDO_O01_OBXNTE)this.get("OBXNTE");
268           } catch(HL7Exception e) {
269              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
270              throw new RuntimeException(e);
271           }
272           return ret;
273        }
274    
275    
276        /**
277         * Returns a specific repetition of
278         * OBXNTE (a Group object) - creates it if necessary
279         *
280         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
281         * @throws HL7Exception if the repetition requested is more than one 
282         *     greater than the number of existing repetitions.
283         */
284        public RDO_O01_OBXNTE getOBXNTE(int rep) { 
285           RDO_O01_OBXNTE ret = null;
286           try {
287              ret = (RDO_O01_OBXNTE)this.get("OBXNTE", rep);
288           } catch(HL7Exception e) {
289              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
290              throw new RuntimeException(e);
291           }
292           return ret;
293        }
294    
295        /** 
296         * Returns the number of existing repetitions of OBXNTE 
297         */ 
298        public int getOBXNTEReps() { 
299            int reps = -1; 
300            try { 
301                reps = this.getAll("OBXNTE").length; 
302            } catch (HL7Exception e) { 
303                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
304                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
305                throw new RuntimeException(message);
306            } 
307            return reps; 
308        } 
309    
310        /**
311         * Inserts a specific repetition of OBXNTE (a Group object)
312         * @see AbstractGroup#insertRepetition(Structure, int) 
313         */
314        public void insertOBXNTE(RDO_O01_OBXNTE structure, int rep) throws HL7Exception { 
315           super.insertRepetition("OBXNTE", structure, rep);
316        }
317    
318    
319        /**
320         * Inserts a specific repetition of OBXNTE (a Group object)
321         * @see AbstractGroup#insertRepetition(Structure, int) 
322         */
323        public RDO_O01_OBXNTE insertOBXNTE(int rep) throws HL7Exception { 
324           return (RDO_O01_OBXNTE)super.insertRepetition("OBXNTE", rep);
325        }
326    
327    
328        /**
329         * Removes a specific repetition of OBXNTE (a Group object)
330         * @see AbstractGroup#removeRepetition(String, int) 
331         */
332        public RDO_O01_OBXNTE removeOBXNTE(int rep) throws HL7Exception { 
333           return (RDO_O01_OBXNTE)super.removeRepetition("OBXNTE", rep);
334        }
335    
336    
337    
338    }
339