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