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 ORM_O01_OBRRQDRQ1ODSODTRXONTEDG1RXRRXCNTEOBXNTE 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: OBR (OBR - observation request segment) <b> </b></li>
028                     * <li>2: RQD (RQD - requisition detail segment) <b> </b></li>
029                     * <li>3: RQ1 (RQ1 - requisition detail-1 segment) <b> </b></li>
030                     * <li>4: ODS (ODS - dietary orders, supplements, and preferences segment) <b> </b></li>
031                     * <li>5: ODT (ODT - diet tray instructions segment) <b> </b></li>
032                     * <li>6: RXO (RXO - pharmacy/treatment order segment) <b> </b></li>
033                     * <li>7: NTE (NTE - notes and comments segment) <b>optional repeating</b></li>
034                     * <li>8: DG1 (DG1 - diagnosis segment) <b>optional repeating</b></li>
035                     * <li>9: RXR (RXR - pharmacy/treatment route segment) <b> repeating</b></li>
036                     * <li>10: ORM_O01_RXCNTE (a Group object) <b>optional </b></li>
037                     * <li>11: ORM_O01_OBXNTE (a Group object) <b>optional repeating</b></li>
038     * </ul>
039     */
040    public class ORM_O01_OBRRQDRQ1ODSODTRXONTEDG1RXRRXCNTEOBXNTE extends AbstractGroup {
041    
042        /** 
043         * Creates a new ORM_O01_OBRRQDRQ1ODSODTRXONTEDG1RXRRXCNTEOBXNTE group
044         */
045        public ORM_O01_OBRRQDRQ1ODSODTRXONTEDG1RXRRXCNTEOBXNTE(Group parent, ModelClassFactory factory) {
046           super(parent, factory);
047           init(factory);
048        }
049    
050        private void init(ModelClassFactory factory) {
051           try {
052                              this.add(OBR.class, true, false);
053                              this.add(RQD.class, true, false);
054                              this.add(RQ1.class, true, false);
055                              this.add(ODS.class, true, false);
056                              this.add(ODT.class, true, false);
057                              this.add(RXO.class, true, false);
058                              this.add(NTE.class, false, true);
059                              this.add(DG1.class, false, true);
060                              this.add(RXR.class, true, true);
061                              this.add(ORM_O01_RXCNTE.class, false, false);
062                              this.add(ORM_O01_OBXNTE.class, false, true);
063           } catch(HL7Exception e) {
064              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating ORM_O01_OBRRQDRQ1ODSODTRXONTEDG1RXRRXCNTEOBXNTE - this is probably a bug in the source code generator.", e);
065           }
066        }
067    
068        /** 
069         * Returns "2.3.1"
070         */
071        public String getVersion() {
072           return "2.3.1";
073        }
074    
075    
076    
077        /**
078         * Returns
079         * OBR (OBR - observation request segment) - creates it if necessary
080         */
081        public OBR getOBR() { 
082           OBR ret = null;
083           try {
084              ret = (OBR)this.get("OBR");
085           } catch(HL7Exception e) {
086              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
087              throw new RuntimeException(e);
088           }
089           return ret;
090        }
091    
092    
093    
094    
095        /**
096         * Returns
097         * RQD (RQD - requisition detail segment) - creates it if necessary
098         */
099        public RQD getRQD() { 
100           RQD ret = null;
101           try {
102              ret = (RQD)this.get("RQD");
103           } catch(HL7Exception e) {
104              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
105              throw new RuntimeException(e);
106           }
107           return ret;
108        }
109    
110    
111    
112    
113        /**
114         * Returns
115         * RQ1 (RQ1 - requisition detail-1 segment) - creates it if necessary
116         */
117        public RQ1 getRQ1() { 
118           RQ1 ret = null;
119           try {
120              ret = (RQ1)this.get("RQ1");
121           } catch(HL7Exception e) {
122              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
123              throw new RuntimeException(e);
124           }
125           return ret;
126        }
127    
128    
129    
130    
131        /**
132         * Returns
133         * ODS (ODS - dietary orders, supplements, and preferences segment) - creates it if necessary
134         */
135        public ODS getODS() { 
136           ODS ret = null;
137           try {
138              ret = (ODS)this.get("ODS");
139           } catch(HL7Exception e) {
140              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
141              throw new RuntimeException(e);
142           }
143           return ret;
144        }
145    
146    
147    
148    
149        /**
150         * Returns
151         * ODT (ODT - diet tray instructions segment) - creates it if necessary
152         */
153        public ODT getODT() { 
154           ODT ret = null;
155           try {
156              ret = (ODT)this.get("ODT");
157           } catch(HL7Exception e) {
158              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
159              throw new RuntimeException(e);
160           }
161           return ret;
162        }
163    
164    
165    
166    
167        /**
168         * Returns
169         * RXO (RXO - pharmacy/treatment order segment) - creates it if necessary
170         */
171        public RXO getRXO() { 
172           RXO ret = null;
173           try {
174              ret = (RXO)this.get("RXO");
175           } catch(HL7Exception e) {
176              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
177              throw new RuntimeException(e);
178           }
179           return ret;
180        }
181    
182    
183    
184    
185        /**
186         * Returns
187         * the first repetition of 
188         * NTE (NTE - notes and comments segment) - creates it if necessary
189         */
190        public NTE getNTE() { 
191           NTE ret = null;
192           try {
193              ret = (NTE)this.get("NTE");
194           } catch(HL7Exception e) {
195              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
196              throw new RuntimeException(e);
197           }
198           return ret;
199        }
200    
201    
202        /**
203         * Returns a specific repetition of
204         * NTE (NTE - notes and comments segment) - creates it if necessary
205         *
206         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
207         * @throws HL7Exception if the repetition requested is more than one 
208         *     greater than the number of existing repetitions.
209         */
210        public NTE getNTE(int rep) { 
211           NTE ret = null;
212           try {
213              ret = (NTE)this.get("NTE", rep);
214           } catch(HL7Exception e) {
215              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
216              throw new RuntimeException(e);
217           }
218           return ret;
219        }
220    
221        /** 
222         * Returns the number of existing repetitions of NTE 
223         */ 
224        public int getNTEReps() { 
225            int reps = -1; 
226            try { 
227                reps = this.getAll("NTE").length; 
228            } catch (HL7Exception e) { 
229                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
230                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
231                throw new RuntimeException(message);
232            } 
233            return reps; 
234        } 
235    
236        /**
237         * Inserts a specific repetition of NTE (NTE - notes and comments segment)
238         * @see AbstractGroup#insertRepetition(Structure, int) 
239         */
240        public void insertNTE(NTE structure, int rep) throws HL7Exception { 
241           super.insertRepetition("NTE", structure, rep);
242        }
243    
244    
245        /**
246         * Inserts a specific repetition of NTE (NTE - notes and comments segment)
247         * @see AbstractGroup#insertRepetition(Structure, int) 
248         */
249        public NTE insertNTE(int rep) throws HL7Exception { 
250           return (NTE)super.insertRepetition("NTE", rep);
251        }
252    
253    
254        /**
255         * Removes a specific repetition of NTE (NTE - notes and comments segment)
256         * @see AbstractGroup#removeRepetition(String, int) 
257         */
258        public NTE removeNTE(int rep) throws HL7Exception { 
259           return (NTE)super.removeRepetition("NTE", rep);
260        }
261    
262    
263    
264        /**
265         * Returns
266         * the first repetition of 
267         * DG1 (DG1 - diagnosis segment) - creates it if necessary
268         */
269        public DG1 getDG1() { 
270           DG1 ret = null;
271           try {
272              ret = (DG1)this.get("DG1");
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         * Returns a specific repetition of
283         * DG1 (DG1 - diagnosis segment) - creates it if necessary
284         *
285         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
286         * @throws HL7Exception if the repetition requested is more than one 
287         *     greater than the number of existing repetitions.
288         */
289        public DG1 getDG1(int rep) { 
290           DG1 ret = null;
291           try {
292              ret = (DG1)this.get("DG1", rep);
293           } catch(HL7Exception e) {
294              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
295              throw new RuntimeException(e);
296           }
297           return ret;
298        }
299    
300        /** 
301         * Returns the number of existing repetitions of DG1 
302         */ 
303        public int getDG1Reps() { 
304            int reps = -1; 
305            try { 
306                reps = this.getAll("DG1").length; 
307            } catch (HL7Exception e) { 
308                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
309                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
310                throw new RuntimeException(message);
311            } 
312            return reps; 
313        } 
314    
315        /**
316         * Inserts a specific repetition of DG1 (DG1 - diagnosis segment)
317         * @see AbstractGroup#insertRepetition(Structure, int) 
318         */
319        public void insertDG1(DG1 structure, int rep) throws HL7Exception { 
320           super.insertRepetition("DG1", structure, rep);
321        }
322    
323    
324        /**
325         * Inserts a specific repetition of DG1 (DG1 - diagnosis segment)
326         * @see AbstractGroup#insertRepetition(Structure, int) 
327         */
328        public DG1 insertDG1(int rep) throws HL7Exception { 
329           return (DG1)super.insertRepetition("DG1", rep);
330        }
331    
332    
333        /**
334         * Removes a specific repetition of DG1 (DG1 - diagnosis segment)
335         * @see AbstractGroup#removeRepetition(String, int) 
336         */
337        public DG1 removeDG1(int rep) throws HL7Exception { 
338           return (DG1)super.removeRepetition("DG1", rep);
339        }
340    
341    
342    
343        /**
344         * Returns
345         * the first repetition of 
346         * RXR (RXR - pharmacy/treatment route segment) - creates it if necessary
347         */
348        public RXR getRXR() { 
349           RXR ret = null;
350           try {
351              ret = (RXR)this.get("RXR");
352           } catch(HL7Exception e) {
353              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
354              throw new RuntimeException(e);
355           }
356           return ret;
357        }
358    
359    
360        /**
361         * Returns a specific repetition of
362         * RXR (RXR - pharmacy/treatment route segment) - creates it if necessary
363         *
364         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
365         * @throws HL7Exception if the repetition requested is more than one 
366         *     greater than the number of existing repetitions.
367         */
368        public RXR getRXR(int rep) { 
369           RXR ret = null;
370           try {
371              ret = (RXR)this.get("RXR", rep);
372           } catch(HL7Exception e) {
373              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
374              throw new RuntimeException(e);
375           }
376           return ret;
377        }
378    
379        /** 
380         * Returns the number of existing repetitions of RXR 
381         */ 
382        public int getRXRReps() { 
383            int reps = -1; 
384            try { 
385                reps = this.getAll("RXR").length; 
386            } catch (HL7Exception e) { 
387                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
388                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
389                throw new RuntimeException(message);
390            } 
391            return reps; 
392        } 
393    
394        /**
395         * Inserts a specific repetition of RXR (RXR - pharmacy/treatment route segment)
396         * @see AbstractGroup#insertRepetition(Structure, int) 
397         */
398        public void insertRXR(RXR structure, int rep) throws HL7Exception { 
399           super.insertRepetition("RXR", structure, rep);
400        }
401    
402    
403        /**
404         * Inserts a specific repetition of RXR (RXR - pharmacy/treatment route segment)
405         * @see AbstractGroup#insertRepetition(Structure, int) 
406         */
407        public RXR insertRXR(int rep) throws HL7Exception { 
408           return (RXR)super.insertRepetition("RXR", rep);
409        }
410    
411    
412        /**
413         * Removes a specific repetition of RXR (RXR - pharmacy/treatment route segment)
414         * @see AbstractGroup#removeRepetition(String, int) 
415         */
416        public RXR removeRXR(int rep) throws HL7Exception { 
417           return (RXR)super.removeRepetition("RXR", rep);
418        }
419    
420    
421    
422        /**
423         * Returns
424         * RXCNTE (a Group object) - creates it if necessary
425         */
426        public ORM_O01_RXCNTE getRXCNTE() { 
427           ORM_O01_RXCNTE ret = null;
428           try {
429              ret = (ORM_O01_RXCNTE)this.get("RXCNTE");
430           } catch(HL7Exception e) {
431              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
432              throw new RuntimeException(e);
433           }
434           return ret;
435        }
436    
437    
438    
439    
440        /**
441         * Returns
442         * the first repetition of 
443         * OBXNTE (a Group object) - creates it if necessary
444         */
445        public ORM_O01_OBXNTE getOBXNTE() { 
446           ORM_O01_OBXNTE ret = null;
447           try {
448              ret = (ORM_O01_OBXNTE)this.get("OBXNTE");
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         * Returns a specific repetition of
459         * OBXNTE (a Group object) - creates it if necessary
460         *
461         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
462         * @throws HL7Exception if the repetition requested is more than one 
463         *     greater than the number of existing repetitions.
464         */
465        public ORM_O01_OBXNTE getOBXNTE(int rep) { 
466           ORM_O01_OBXNTE ret = null;
467           try {
468              ret = (ORM_O01_OBXNTE)this.get("OBXNTE", rep);
469           } catch(HL7Exception e) {
470              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
471              throw new RuntimeException(e);
472           }
473           return ret;
474        }
475    
476        /** 
477         * Returns the number of existing repetitions of OBXNTE 
478         */ 
479        public int getOBXNTEReps() { 
480            int reps = -1; 
481            try { 
482                reps = this.getAll("OBXNTE").length; 
483            } catch (HL7Exception e) { 
484                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
485                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
486                throw new RuntimeException(message);
487            } 
488            return reps; 
489        } 
490    
491        /**
492         * Inserts a specific repetition of OBXNTE (a Group object)
493         * @see AbstractGroup#insertRepetition(Structure, int) 
494         */
495        public void insertOBXNTE(ORM_O01_OBXNTE structure, int rep) throws HL7Exception { 
496           super.insertRepetition("OBXNTE", structure, rep);
497        }
498    
499    
500        /**
501         * Inserts a specific repetition of OBXNTE (a Group object)
502         * @see AbstractGroup#insertRepetition(Structure, int) 
503         */
504        public ORM_O01_OBXNTE insertOBXNTE(int rep) throws HL7Exception { 
505           return (ORM_O01_OBXNTE)super.insertRepetition("OBXNTE", rep);
506        }
507    
508    
509        /**
510         * Removes a specific repetition of OBXNTE (a Group object)
511         * @see AbstractGroup#removeRepetition(String, int) 
512         */
513        public ORM_O01_OBXNTE removeOBXNTE(int rep) throws HL7Exception { 
514           return (ORM_O01_OBXNTE)super.removeRepetition("OBXNTE", rep);
515        }
516    
517    
518    
519    }
520