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 OUL_R21_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: OUL_R21_CONTAINER (a Group object) <b>optional </b></li>
028                     * <li>2: ORC (Common Order) <b>optional </b></li>
029                     * <li>3: OBR (Observation Request) <b> </b></li>
030                     * <li>4: NTE (Notes and Comments) <b>optional repeating</b></li>
031                     * <li>5: OUL_R21_OBSERVATION (a Group object) <b> repeating</b></li>
032                     * <li>6: CTI (Clinical Trial Identification) <b>optional repeating</b></li>
033     * </ul>
034     */
035    public class OUL_R21_ORDER_OBSERVATION extends AbstractGroup {
036    
037        /** 
038         * Creates a new OUL_R21_ORDER_OBSERVATION group
039         */
040        public OUL_R21_ORDER_OBSERVATION(Group parent, ModelClassFactory factory) {
041           super(parent, factory);
042           init(factory);
043        }
044    
045        private void init(ModelClassFactory factory) {
046           try {
047                              this.add(OUL_R21_CONTAINER.class, false, false);
048                              this.add(ORC.class, false, false);
049                              this.add(OBR.class, true, false);
050                              this.add(NTE.class, false, true);
051                              this.add(OUL_R21_OBSERVATION.class, true, true);
052                              this.add(CTI.class, false, true);
053           } catch(HL7Exception e) {
054              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating OUL_R21_ORDER_OBSERVATION - this is probably a bug in the source code generator.", e);
055           }
056        }
057    
058        /** 
059         * Returns "2.4"
060         */
061        public String getVersion() {
062           return "2.4";
063        }
064    
065    
066    
067        /**
068         * Returns
069         * CONTAINER (a Group object) - creates it if necessary
070         */
071        public OUL_R21_CONTAINER getCONTAINER() { 
072           OUL_R21_CONTAINER ret = null;
073           try {
074              ret = (OUL_R21_CONTAINER)this.get("CONTAINER");
075           } catch(HL7Exception e) {
076              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
077              throw new RuntimeException(e);
078           }
079           return ret;
080        }
081    
082    
083    
084    
085        /**
086         * Returns
087         * ORC (Common Order) - creates it if necessary
088         */
089        public ORC getORC() { 
090           ORC ret = null;
091           try {
092              ret = (ORC)this.get("ORC");
093           } catch(HL7Exception e) {
094              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
095              throw new RuntimeException(e);
096           }
097           return ret;
098        }
099    
100    
101    
102    
103        /**
104         * Returns
105         * OBR (Observation Request) - creates it if necessary
106         */
107        public OBR getOBR() { 
108           OBR ret = null;
109           try {
110              ret = (OBR)this.get("OBR");
111           } catch(HL7Exception e) {
112              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
113              throw new RuntimeException(e);
114           }
115           return ret;
116        }
117    
118    
119    
120    
121        /**
122         * Returns
123         * the first repetition of 
124         * NTE (Notes and Comments) - creates it if necessary
125         */
126        public NTE getNTE() { 
127           NTE ret = null;
128           try {
129              ret = (NTE)this.get("NTE");
130           } catch(HL7Exception e) {
131              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
132              throw new RuntimeException(e);
133           }
134           return ret;
135        }
136    
137    
138        /**
139         * Returns a specific repetition of
140         * NTE (Notes and Comments) - creates it if necessary
141         *
142         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
143         * @throws HL7Exception if the repetition requested is more than one 
144         *     greater than the number of existing repetitions.
145         */
146        public NTE getNTE(int rep) { 
147           NTE ret = null;
148           try {
149              ret = (NTE)this.get("NTE", rep);
150           } catch(HL7Exception e) {
151              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
152              throw new RuntimeException(e);
153           }
154           return ret;
155        }
156    
157        /** 
158         * Returns the number of existing repetitions of NTE 
159         */ 
160        public int getNTEReps() { 
161            int reps = -1; 
162            try { 
163                reps = this.getAll("NTE").length; 
164            } catch (HL7Exception e) { 
165                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
166                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
167                throw new RuntimeException(message);
168            } 
169            return reps; 
170        } 
171    
172        /**
173         * Inserts a specific repetition of NTE (Notes and Comments)
174         * @see AbstractGroup#insertRepetition(Structure, int) 
175         */
176        public void insertNTE(NTE structure, int rep) throws HL7Exception { 
177           super.insertRepetition("NTE", structure, rep);
178        }
179    
180    
181        /**
182         * Inserts a specific repetition of NTE (Notes and Comments)
183         * @see AbstractGroup#insertRepetition(Structure, int) 
184         */
185        public NTE insertNTE(int rep) throws HL7Exception { 
186           return (NTE)super.insertRepetition("NTE", rep);
187        }
188    
189    
190        /**
191         * Removes a specific repetition of NTE (Notes and Comments)
192         * @see AbstractGroup#removeRepetition(String, int) 
193         */
194        public NTE removeNTE(int rep) throws HL7Exception { 
195           return (NTE)super.removeRepetition("NTE", rep);
196        }
197    
198    
199    
200        /**
201         * Returns
202         * the first repetition of 
203         * OBSERVATION (a Group object) - creates it if necessary
204         */
205        public OUL_R21_OBSERVATION getOBSERVATION() { 
206           OUL_R21_OBSERVATION ret = null;
207           try {
208              ret = (OUL_R21_OBSERVATION)this.get("OBSERVATION");
209           } catch(HL7Exception e) {
210              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
211              throw new RuntimeException(e);
212           }
213           return ret;
214        }
215    
216    
217        /**
218         * Returns a specific repetition of
219         * OBSERVATION (a Group object) - creates it if necessary
220         *
221         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
222         * @throws HL7Exception if the repetition requested is more than one 
223         *     greater than the number of existing repetitions.
224         */
225        public OUL_R21_OBSERVATION getOBSERVATION(int rep) { 
226           OUL_R21_OBSERVATION ret = null;
227           try {
228              ret = (OUL_R21_OBSERVATION)this.get("OBSERVATION", rep);
229           } catch(HL7Exception e) {
230              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
231              throw new RuntimeException(e);
232           }
233           return ret;
234        }
235    
236        /** 
237         * Returns the number of existing repetitions of OBSERVATION 
238         */ 
239        public int getOBSERVATIONReps() { 
240            int reps = -1; 
241            try { 
242                reps = this.getAll("OBSERVATION").length; 
243            } catch (HL7Exception e) { 
244                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
245                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
246                throw new RuntimeException(message);
247            } 
248            return reps; 
249        } 
250    
251        /**
252         * Inserts a specific repetition of OBSERVATION (a Group object)
253         * @see AbstractGroup#insertRepetition(Structure, int) 
254         */
255        public void insertOBSERVATION(OUL_R21_OBSERVATION structure, int rep) throws HL7Exception { 
256           super.insertRepetition("OBSERVATION", structure, rep);
257        }
258    
259    
260        /**
261         * Inserts a specific repetition of OBSERVATION (a Group object)
262         * @see AbstractGroup#insertRepetition(Structure, int) 
263         */
264        public OUL_R21_OBSERVATION insertOBSERVATION(int rep) throws HL7Exception { 
265           return (OUL_R21_OBSERVATION)super.insertRepetition("OBSERVATION", rep);
266        }
267    
268    
269        /**
270         * Removes a specific repetition of OBSERVATION (a Group object)
271         * @see AbstractGroup#removeRepetition(String, int) 
272         */
273        public OUL_R21_OBSERVATION removeOBSERVATION(int rep) throws HL7Exception { 
274           return (OUL_R21_OBSERVATION)super.removeRepetition("OBSERVATION", rep);
275        }
276    
277    
278    
279        /**
280         * Returns
281         * the first repetition of 
282         * CTI (Clinical Trial Identification) - creates it if necessary
283         */
284        public CTI getCTI() { 
285           CTI ret = null;
286           try {
287              ret = (CTI)this.get("CTI");
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        /**
297         * Returns a specific repetition of
298         * CTI (Clinical Trial Identification) - creates it if necessary
299         *
300         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
301         * @throws HL7Exception if the repetition requested is more than one 
302         *     greater than the number of existing repetitions.
303         */
304        public CTI getCTI(int rep) { 
305           CTI ret = null;
306           try {
307              ret = (CTI)this.get("CTI", rep);
308           } catch(HL7Exception e) {
309              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
310              throw new RuntimeException(e);
311           }
312           return ret;
313        }
314    
315        /** 
316         * Returns the number of existing repetitions of CTI 
317         */ 
318        public int getCTIReps() { 
319            int reps = -1; 
320            try { 
321                reps = this.getAll("CTI").length; 
322            } catch (HL7Exception e) { 
323                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
324                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
325                throw new RuntimeException(message);
326            } 
327            return reps; 
328        } 
329    
330        /**
331         * Inserts a specific repetition of CTI (Clinical Trial Identification)
332         * @see AbstractGroup#insertRepetition(Structure, int) 
333         */
334        public void insertCTI(CTI structure, int rep) throws HL7Exception { 
335           super.insertRepetition("CTI", structure, rep);
336        }
337    
338    
339        /**
340         * Inserts a specific repetition of CTI (Clinical Trial Identification)
341         * @see AbstractGroup#insertRepetition(Structure, int) 
342         */
343        public CTI insertCTI(int rep) throws HL7Exception { 
344           return (CTI)super.insertRepetition("CTI", rep);
345        }
346    
347    
348        /**
349         * Removes a specific repetition of CTI (Clinical Trial Identification)
350         * @see AbstractGroup#removeRepetition(String, int) 
351         */
352        public CTI removeCTI(int rep) throws HL7Exception { 
353           return (CTI)super.removeRepetition("CTI", rep);
354        }
355    
356    
357    
358    }
359