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 OMG_O19_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: 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: DG1 (Diagnosis) <b>optional repeating</b></li>
032                     * <li>6: OMG_O19_OBSERVATION (a Group object) <b>optional repeating</b></li>
033                     * <li>7: OMG_O19_PRIOR_RESULT (a Group object) <b>optional repeating</b></li>
034                     * <li>8: FT1 (Financial Transaction) <b>optional repeating</b></li>
035                     * <li>9: CTI (Clinical Trial Identification) <b>optional repeating</b></li>
036                     * <li>10: BLG (Billing) <b>optional </b></li>
037     * </ul>
038     */
039    public class OMG_O19_ORDER extends AbstractGroup {
040    
041        /** 
042         * Creates a new OMG_O19_ORDER group
043         */
044        public OMG_O19_ORDER(Group parent, ModelClassFactory factory) {
045           super(parent, factory);
046           init(factory);
047        }
048    
049        private void init(ModelClassFactory factory) {
050           try {
051                              this.add(ORC.class, true, false);
052                              this.add(OBR.class, true, false);
053                              this.add(NTE.class, false, true);
054                              this.add(CTD.class, false, false);
055                              this.add(DG1.class, false, true);
056                              this.add(OMG_O19_OBSERVATION.class, false, true);
057                              this.add(OMG_O19_PRIOR_RESULT.class, false, true);
058                              this.add(FT1.class, false, true);
059                              this.add(CTI.class, false, true);
060                              this.add(BLG.class, false, false);
061           } catch(HL7Exception e) {
062              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating OMG_O19_ORDER - this is probably a bug in the source code generator.", e);
063           }
064        }
065    
066        /** 
067         * Returns "2.4"
068         */
069        public String getVersion() {
070           return "2.4";
071        }
072    
073    
074    
075        /**
076         * Returns
077         * ORC (Common Order) - creates it if necessary
078         */
079        public ORC getORC() { 
080           ORC ret = null;
081           try {
082              ret = (ORC)this.get("ORC");
083           } catch(HL7Exception e) {
084              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
085              throw new RuntimeException(e);
086           }
087           return ret;
088        }
089    
090    
091    
092    
093        /**
094         * Returns
095         * OBR (Observation Request) - creates it if necessary
096         */
097        public OBR getOBR() { 
098           OBR ret = null;
099           try {
100              ret = (OBR)this.get("OBR");
101           } catch(HL7Exception e) {
102              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
103              throw new RuntimeException(e);
104           }
105           return ret;
106        }
107    
108    
109    
110    
111        /**
112         * Returns
113         * the first repetition of 
114         * NTE (Notes and Comments) - creates it if necessary
115         */
116        public NTE getNTE() { 
117           NTE ret = null;
118           try {
119              ret = (NTE)this.get("NTE");
120           } catch(HL7Exception e) {
121              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
122              throw new RuntimeException(e);
123           }
124           return ret;
125        }
126    
127    
128        /**
129         * Returns a specific repetition of
130         * NTE (Notes and Comments) - creates it if necessary
131         *
132         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
133         * @throws HL7Exception if the repetition requested is more than one 
134         *     greater than the number of existing repetitions.
135         */
136        public NTE getNTE(int rep) { 
137           NTE ret = null;
138           try {
139              ret = (NTE)this.get("NTE", rep);
140           } catch(HL7Exception e) {
141              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
142              throw new RuntimeException(e);
143           }
144           return ret;
145        }
146    
147        /** 
148         * Returns the number of existing repetitions of NTE 
149         */ 
150        public int getNTEReps() { 
151            int reps = -1; 
152            try { 
153                reps = this.getAll("NTE").length; 
154            } catch (HL7Exception e) { 
155                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
156                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
157                throw new RuntimeException(message);
158            } 
159            return reps; 
160        } 
161    
162        /**
163         * Inserts a specific repetition of NTE (Notes and Comments)
164         * @see AbstractGroup#insertRepetition(Structure, int) 
165         */
166        public void insertNTE(NTE structure, int rep) throws HL7Exception { 
167           super.insertRepetition("NTE", structure, rep);
168        }
169    
170    
171        /**
172         * Inserts a specific repetition of NTE (Notes and Comments)
173         * @see AbstractGroup#insertRepetition(Structure, int) 
174         */
175        public NTE insertNTE(int rep) throws HL7Exception { 
176           return (NTE)super.insertRepetition("NTE", rep);
177        }
178    
179    
180        /**
181         * Removes a specific repetition of NTE (Notes and Comments)
182         * @see AbstractGroup#removeRepetition(String, int) 
183         */
184        public NTE removeNTE(int rep) throws HL7Exception { 
185           return (NTE)super.removeRepetition("NTE", rep);
186        }
187    
188    
189    
190        /**
191         * Returns
192         * CTD (Contact Data) - creates it if necessary
193         */
194        public CTD getCTD() { 
195           CTD ret = null;
196           try {
197              ret = (CTD)this.get("CTD");
198           } catch(HL7Exception e) {
199              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
200              throw new RuntimeException(e);
201           }
202           return ret;
203        }
204    
205    
206    
207    
208        /**
209         * Returns
210         * the first repetition of 
211         * DG1 (Diagnosis) - creates it if necessary
212         */
213        public DG1 getDG1() { 
214           DG1 ret = null;
215           try {
216              ret = (DG1)this.get("DG1");
217           } catch(HL7Exception e) {
218              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
219              throw new RuntimeException(e);
220           }
221           return ret;
222        }
223    
224    
225        /**
226         * Returns a specific repetition of
227         * DG1 (Diagnosis) - creates it if necessary
228         *
229         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
230         * @throws HL7Exception if the repetition requested is more than one 
231         *     greater than the number of existing repetitions.
232         */
233        public DG1 getDG1(int rep) { 
234           DG1 ret = null;
235           try {
236              ret = (DG1)this.get("DG1", rep);
237           } catch(HL7Exception e) {
238              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
239              throw new RuntimeException(e);
240           }
241           return ret;
242        }
243    
244        /** 
245         * Returns the number of existing repetitions of DG1 
246         */ 
247        public int getDG1Reps() { 
248            int reps = -1; 
249            try { 
250                reps = this.getAll("DG1").length; 
251            } catch (HL7Exception e) { 
252                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
253                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
254                throw new RuntimeException(message);
255            } 
256            return reps; 
257        } 
258    
259        /**
260         * Inserts a specific repetition of DG1 (Diagnosis)
261         * @see AbstractGroup#insertRepetition(Structure, int) 
262         */
263        public void insertDG1(DG1 structure, int rep) throws HL7Exception { 
264           super.insertRepetition("DG1", structure, rep);
265        }
266    
267    
268        /**
269         * Inserts a specific repetition of DG1 (Diagnosis)
270         * @see AbstractGroup#insertRepetition(Structure, int) 
271         */
272        public DG1 insertDG1(int rep) throws HL7Exception { 
273           return (DG1)super.insertRepetition("DG1", rep);
274        }
275    
276    
277        /**
278         * Removes a specific repetition of DG1 (Diagnosis)
279         * @see AbstractGroup#removeRepetition(String, int) 
280         */
281        public DG1 removeDG1(int rep) throws HL7Exception { 
282           return (DG1)super.removeRepetition("DG1", rep);
283        }
284    
285    
286    
287        /**
288         * Returns
289         * the first repetition of 
290         * OBSERVATION (a Group object) - creates it if necessary
291         */
292        public OMG_O19_OBSERVATION getOBSERVATION() { 
293           OMG_O19_OBSERVATION ret = null;
294           try {
295              ret = (OMG_O19_OBSERVATION)this.get("OBSERVATION");
296           } catch(HL7Exception e) {
297              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
298              throw new RuntimeException(e);
299           }
300           return ret;
301        }
302    
303    
304        /**
305         * Returns a specific repetition of
306         * OBSERVATION (a Group object) - creates it if necessary
307         *
308         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
309         * @throws HL7Exception if the repetition requested is more than one 
310         *     greater than the number of existing repetitions.
311         */
312        public OMG_O19_OBSERVATION getOBSERVATION(int rep) { 
313           OMG_O19_OBSERVATION ret = null;
314           try {
315              ret = (OMG_O19_OBSERVATION)this.get("OBSERVATION", rep);
316           } catch(HL7Exception e) {
317              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
318              throw new RuntimeException(e);
319           }
320           return ret;
321        }
322    
323        /** 
324         * Returns the number of existing repetitions of OBSERVATION 
325         */ 
326        public int getOBSERVATIONReps() { 
327            int reps = -1; 
328            try { 
329                reps = this.getAll("OBSERVATION").length; 
330            } catch (HL7Exception e) { 
331                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
332                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
333                throw new RuntimeException(message);
334            } 
335            return reps; 
336        } 
337    
338        /**
339         * Inserts a specific repetition of OBSERVATION (a Group object)
340         * @see AbstractGroup#insertRepetition(Structure, int) 
341         */
342        public void insertOBSERVATION(OMG_O19_OBSERVATION structure, int rep) throws HL7Exception { 
343           super.insertRepetition("OBSERVATION", structure, rep);
344        }
345    
346    
347        /**
348         * Inserts a specific repetition of OBSERVATION (a Group object)
349         * @see AbstractGroup#insertRepetition(Structure, int) 
350         */
351        public OMG_O19_OBSERVATION insertOBSERVATION(int rep) throws HL7Exception { 
352           return (OMG_O19_OBSERVATION)super.insertRepetition("OBSERVATION", rep);
353        }
354    
355    
356        /**
357         * Removes a specific repetition of OBSERVATION (a Group object)
358         * @see AbstractGroup#removeRepetition(String, int) 
359         */
360        public OMG_O19_OBSERVATION removeOBSERVATION(int rep) throws HL7Exception { 
361           return (OMG_O19_OBSERVATION)super.removeRepetition("OBSERVATION", rep);
362        }
363    
364    
365    
366        /**
367         * Returns
368         * the first repetition of 
369         * PRIOR_RESULT (a Group object) - creates it if necessary
370         */
371        public OMG_O19_PRIOR_RESULT getPRIOR_RESULT() { 
372           OMG_O19_PRIOR_RESULT ret = null;
373           try {
374              ret = (OMG_O19_PRIOR_RESULT)this.get("PRIOR_RESULT");
375           } catch(HL7Exception e) {
376              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
377              throw new RuntimeException(e);
378           }
379           return ret;
380        }
381    
382    
383        /**
384         * Returns a specific repetition of
385         * PRIOR_RESULT (a Group object) - creates it if necessary
386         *
387         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
388         * @throws HL7Exception if the repetition requested is more than one 
389         *     greater than the number of existing repetitions.
390         */
391        public OMG_O19_PRIOR_RESULT getPRIOR_RESULT(int rep) { 
392           OMG_O19_PRIOR_RESULT ret = null;
393           try {
394              ret = (OMG_O19_PRIOR_RESULT)this.get("PRIOR_RESULT", rep);
395           } catch(HL7Exception e) {
396              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
397              throw new RuntimeException(e);
398           }
399           return ret;
400        }
401    
402        /** 
403         * Returns the number of existing repetitions of PRIOR_RESULT 
404         */ 
405        public int getPRIOR_RESULTReps() { 
406            int reps = -1; 
407            try { 
408                reps = this.getAll("PRIOR_RESULT").length; 
409            } catch (HL7Exception e) { 
410                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
411                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
412                throw new RuntimeException(message);
413            } 
414            return reps; 
415        } 
416    
417        /**
418         * Inserts a specific repetition of PRIOR_RESULT (a Group object)
419         * @see AbstractGroup#insertRepetition(Structure, int) 
420         */
421        public void insertPRIOR_RESULT(OMG_O19_PRIOR_RESULT structure, int rep) throws HL7Exception { 
422           super.insertRepetition("PRIOR_RESULT", structure, rep);
423        }
424    
425    
426        /**
427         * Inserts a specific repetition of PRIOR_RESULT (a Group object)
428         * @see AbstractGroup#insertRepetition(Structure, int) 
429         */
430        public OMG_O19_PRIOR_RESULT insertPRIOR_RESULT(int rep) throws HL7Exception { 
431           return (OMG_O19_PRIOR_RESULT)super.insertRepetition("PRIOR_RESULT", rep);
432        }
433    
434    
435        /**
436         * Removes a specific repetition of PRIOR_RESULT (a Group object)
437         * @see AbstractGroup#removeRepetition(String, int) 
438         */
439        public OMG_O19_PRIOR_RESULT removePRIOR_RESULT(int rep) throws HL7Exception { 
440           return (OMG_O19_PRIOR_RESULT)super.removeRepetition("PRIOR_RESULT", rep);
441        }
442    
443    
444    
445        /**
446         * Returns
447         * the first repetition of 
448         * FT1 (Financial Transaction) - creates it if necessary
449         */
450        public FT1 getFT1() { 
451           FT1 ret = null;
452           try {
453              ret = (FT1)this.get("FT1");
454           } catch(HL7Exception e) {
455              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
456              throw new RuntimeException(e);
457           }
458           return ret;
459        }
460    
461    
462        /**
463         * Returns a specific repetition of
464         * FT1 (Financial Transaction) - creates it if necessary
465         *
466         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
467         * @throws HL7Exception if the repetition requested is more than one 
468         *     greater than the number of existing repetitions.
469         */
470        public FT1 getFT1(int rep) { 
471           FT1 ret = null;
472           try {
473              ret = (FT1)this.get("FT1", rep);
474           } catch(HL7Exception e) {
475              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
476              throw new RuntimeException(e);
477           }
478           return ret;
479        }
480    
481        /** 
482         * Returns the number of existing repetitions of FT1 
483         */ 
484        public int getFT1Reps() { 
485            int reps = -1; 
486            try { 
487                reps = this.getAll("FT1").length; 
488            } catch (HL7Exception e) { 
489                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
490                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
491                throw new RuntimeException(message);
492            } 
493            return reps; 
494        } 
495    
496        /**
497         * Inserts a specific repetition of FT1 (Financial Transaction)
498         * @see AbstractGroup#insertRepetition(Structure, int) 
499         */
500        public void insertFT1(FT1 structure, int rep) throws HL7Exception { 
501           super.insertRepetition("FT1", structure, rep);
502        }
503    
504    
505        /**
506         * Inserts a specific repetition of FT1 (Financial Transaction)
507         * @see AbstractGroup#insertRepetition(Structure, int) 
508         */
509        public FT1 insertFT1(int rep) throws HL7Exception { 
510           return (FT1)super.insertRepetition("FT1", rep);
511        }
512    
513    
514        /**
515         * Removes a specific repetition of FT1 (Financial Transaction)
516         * @see AbstractGroup#removeRepetition(String, int) 
517         */
518        public FT1 removeFT1(int rep) throws HL7Exception { 
519           return (FT1)super.removeRepetition("FT1", rep);
520        }
521    
522    
523    
524        /**
525         * Returns
526         * the first repetition of 
527         * CTI (Clinical Trial Identification) - creates it if necessary
528         */
529        public CTI getCTI() { 
530           CTI ret = null;
531           try {
532              ret = (CTI)this.get("CTI");
533           } catch(HL7Exception e) {
534              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
535              throw new RuntimeException(e);
536           }
537           return ret;
538        }
539    
540    
541        /**
542         * Returns a specific repetition of
543         * CTI (Clinical Trial Identification) - creates it if necessary
544         *
545         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
546         * @throws HL7Exception if the repetition requested is more than one 
547         *     greater than the number of existing repetitions.
548         */
549        public CTI getCTI(int rep) { 
550           CTI ret = null;
551           try {
552              ret = (CTI)this.get("CTI", rep);
553           } catch(HL7Exception e) {
554              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
555              throw new RuntimeException(e);
556           }
557           return ret;
558        }
559    
560        /** 
561         * Returns the number of existing repetitions of CTI 
562         */ 
563        public int getCTIReps() { 
564            int reps = -1; 
565            try { 
566                reps = this.getAll("CTI").length; 
567            } catch (HL7Exception e) { 
568                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
569                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
570                throw new RuntimeException(message);
571            } 
572            return reps; 
573        } 
574    
575        /**
576         * Inserts a specific repetition of CTI (Clinical Trial Identification)
577         * @see AbstractGroup#insertRepetition(Structure, int) 
578         */
579        public void insertCTI(CTI structure, int rep) throws HL7Exception { 
580           super.insertRepetition("CTI", structure, rep);
581        }
582    
583    
584        /**
585         * Inserts a specific repetition of CTI (Clinical Trial Identification)
586         * @see AbstractGroup#insertRepetition(Structure, int) 
587         */
588        public CTI insertCTI(int rep) throws HL7Exception { 
589           return (CTI)super.insertRepetition("CTI", rep);
590        }
591    
592    
593        /**
594         * Removes a specific repetition of CTI (Clinical Trial Identification)
595         * @see AbstractGroup#removeRepetition(String, int) 
596         */
597        public CTI removeCTI(int rep) throws HL7Exception { 
598           return (CTI)super.removeRepetition("CTI", rep);
599        }
600    
601    
602    
603        /**
604         * Returns
605         * BLG (Billing) - creates it if necessary
606         */
607        public BLG getBLG() { 
608           BLG ret = null;
609           try {
610              ret = (BLG)this.get("BLG");
611           } catch(HL7Exception e) {
612              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
613              throw new RuntimeException(e);
614           }
615           return ret;
616        }
617    
618    
619    
620    
621    }
622