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 ORU_R01_ORDER_OBSERVATION 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>optional </b></li>
028                     * <li>2: OBR (Observation Request) <b> </b></li>
029                     * <li>3: NTE (Notes and Comments) <b>optional repeating</b></li>
030                     * <li>4: CTD (Contact Data) <b>optional </b></li>
031                     * <li>5: ORU_R01_OBSERVATION (a Group object) <b> repeating</b></li>
032                     * <li>6: FT1 (Financial Transaction) <b>optional repeating</b></li>
033                     * <li>7: CTI (Clinical Trial Identification) <b>optional repeating</b></li>
034     * </ul>
035     */
036    public class ORU_R01_ORDER_OBSERVATION extends AbstractGroup {
037    
038        /** 
039         * Creates a new ORU_R01_ORDER_OBSERVATION group
040         */
041        public ORU_R01_ORDER_OBSERVATION(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, false, false);
049                              this.add(OBR.class, true, false);
050                              this.add(NTE.class, false, true);
051                              this.add(CTD.class, false, false);
052                              this.add(ORU_R01_OBSERVATION.class, true, true);
053                              this.add(FT1.class, false, true);
054                              this.add(CTI.class, false, true);
055           } catch(HL7Exception e) {
056              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating ORU_R01_ORDER_OBSERVATION - 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         * OBR (Observation Request) - creates it if necessary
090         */
091        public OBR getOBR() { 
092           OBR ret = null;
093           try {
094              ret = (OBR)this.get("OBR");
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         * the first repetition of 
108         * NTE (Notes and Comments) - creates it if necessary
109         */
110        public NTE getNTE() { 
111           NTE ret = null;
112           try {
113              ret = (NTE)this.get("NTE");
114           } catch(HL7Exception e) {
115              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
116              throw new RuntimeException(e);
117           }
118           return ret;
119        }
120    
121    
122        /**
123         * Returns a specific repetition of
124         * NTE (Notes and Comments) - creates it if necessary
125         *
126         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
127         * @throws HL7Exception if the repetition requested is more than one 
128         *     greater than the number of existing repetitions.
129         */
130        public NTE getNTE(int rep) { 
131           NTE ret = null;
132           try {
133              ret = (NTE)this.get("NTE", rep);
134           } catch(HL7Exception e) {
135              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
136              throw new RuntimeException(e);
137           }
138           return ret;
139        }
140    
141        /** 
142         * Returns the number of existing repetitions of NTE 
143         */ 
144        public int getNTEReps() { 
145            int reps = -1; 
146            try { 
147                reps = this.getAll("NTE").length; 
148            } catch (HL7Exception e) { 
149                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
150                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
151                throw new RuntimeException(message);
152            } 
153            return reps; 
154        } 
155    
156        /**
157         * Inserts a specific repetition of NTE (Notes and Comments)
158         * @see AbstractGroup#insertRepetition(Structure, int) 
159         */
160        public void insertNTE(NTE structure, int rep) throws HL7Exception { 
161           super.insertRepetition("NTE", structure, rep);
162        }
163    
164    
165        /**
166         * Inserts a specific repetition of NTE (Notes and Comments)
167         * @see AbstractGroup#insertRepetition(Structure, int) 
168         */
169        public NTE insertNTE(int rep) throws HL7Exception { 
170           return (NTE)super.insertRepetition("NTE", rep);
171        }
172    
173    
174        /**
175         * Removes a specific repetition of NTE (Notes and Comments)
176         * @see AbstractGroup#removeRepetition(String, int) 
177         */
178        public NTE removeNTE(int rep) throws HL7Exception { 
179           return (NTE)super.removeRepetition("NTE", rep);
180        }
181    
182    
183    
184        /**
185         * Returns
186         * CTD (Contact Data) - creates it if necessary
187         */
188        public CTD getCTD() { 
189           CTD ret = null;
190           try {
191              ret = (CTD)this.get("CTD");
192           } catch(HL7Exception e) {
193              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
194              throw new RuntimeException(e);
195           }
196           return ret;
197        }
198    
199    
200    
201    
202        /**
203         * Returns
204         * the first repetition of 
205         * OBSERVATION (a Group object) - creates it if necessary
206         */
207        public ORU_R01_OBSERVATION getOBSERVATION() { 
208           ORU_R01_OBSERVATION ret = null;
209           try {
210              ret = (ORU_R01_OBSERVATION)this.get("OBSERVATION");
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         * OBSERVATION (a Group object) - 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 ORU_R01_OBSERVATION getOBSERVATION(int rep) { 
228           ORU_R01_OBSERVATION ret = null;
229           try {
230              ret = (ORU_R01_OBSERVATION)this.get("OBSERVATION", 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 OBSERVATION 
240         */ 
241        public int getOBSERVATIONReps() { 
242            int reps = -1; 
243            try { 
244                reps = this.getAll("OBSERVATION").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 OBSERVATION (a Group object)
255         * @see AbstractGroup#insertRepetition(Structure, int) 
256         */
257        public void insertOBSERVATION(ORU_R01_OBSERVATION structure, int rep) throws HL7Exception { 
258           super.insertRepetition("OBSERVATION", structure, rep);
259        }
260    
261    
262        /**
263         * Inserts a specific repetition of OBSERVATION (a Group object)
264         * @see AbstractGroup#insertRepetition(Structure, int) 
265         */
266        public ORU_R01_OBSERVATION insertOBSERVATION(int rep) throws HL7Exception { 
267           return (ORU_R01_OBSERVATION)super.insertRepetition("OBSERVATION", rep);
268        }
269    
270    
271        /**
272         * Removes a specific repetition of OBSERVATION (a Group object)
273         * @see AbstractGroup#removeRepetition(String, int) 
274         */
275        public ORU_R01_OBSERVATION removeOBSERVATION(int rep) throws HL7Exception { 
276           return (ORU_R01_OBSERVATION)super.removeRepetition("OBSERVATION", rep);
277        }
278    
279    
280    
281        /**
282         * Returns
283         * the first repetition of 
284         * FT1 (Financial Transaction) - creates it if necessary
285         */
286        public FT1 getFT1() { 
287           FT1 ret = null;
288           try {
289              ret = (FT1)this.get("FT1");
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         * FT1 (Financial Transaction) - 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 FT1 getFT1(int rep) { 
307           FT1 ret = null;
308           try {
309              ret = (FT1)this.get("FT1", 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 FT1 
319         */ 
320        public int getFT1Reps() { 
321            int reps = -1; 
322            try { 
323                reps = this.getAll("FT1").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 FT1 (Financial Transaction)
334         * @see AbstractGroup#insertRepetition(Structure, int) 
335         */
336        public void insertFT1(FT1 structure, int rep) throws HL7Exception { 
337           super.insertRepetition("FT1", structure, rep);
338        }
339    
340    
341        /**
342         * Inserts a specific repetition of FT1 (Financial Transaction)
343         * @see AbstractGroup#insertRepetition(Structure, int) 
344         */
345        public FT1 insertFT1(int rep) throws HL7Exception { 
346           return (FT1)super.insertRepetition("FT1", rep);
347        }
348    
349    
350        /**
351         * Removes a specific repetition of FT1 (Financial Transaction)
352         * @see AbstractGroup#removeRepetition(String, int) 
353         */
354        public FT1 removeFT1(int rep) throws HL7Exception { 
355           return (FT1)super.removeRepetition("FT1", 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