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 SQR_S25_RESOURCES 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: RGS (Resource Group) <b> </b></li>
028                     * <li>2: SQR_S25_SERVICE (a Group object) <b>optional repeating</b></li>
029                     * <li>3: SQR_S25_GENERAL_RESOURCE (a Group object) <b>optional repeating</b></li>
030                     * <li>4: SQR_S25_PERSONNEL_RESOURCE (a Group object) <b>optional repeating</b></li>
031                     * <li>5: SQR_S25_LOCATION_RESOURCE (a Group object) <b>optional repeating</b></li>
032     * </ul>
033     */
034    public class SQR_S25_RESOURCES extends AbstractGroup {
035    
036        /** 
037         * Creates a new SQR_S25_RESOURCES group
038         */
039        public SQR_S25_RESOURCES(Group parent, ModelClassFactory factory) {
040           super(parent, factory);
041           init(factory);
042        }
043    
044        private void init(ModelClassFactory factory) {
045           try {
046                              this.add(RGS.class, true, false);
047                              this.add(SQR_S25_SERVICE.class, false, true);
048                              this.add(SQR_S25_GENERAL_RESOURCE.class, false, true);
049                              this.add(SQR_S25_PERSONNEL_RESOURCE.class, false, true);
050                              this.add(SQR_S25_LOCATION_RESOURCE.class, false, true);
051           } catch(HL7Exception e) {
052              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating SQR_S25_RESOURCES - this is probably a bug in the source code generator.", e);
053           }
054        }
055    
056        /** 
057         * Returns "2.4"
058         */
059        public String getVersion() {
060           return "2.4";
061        }
062    
063    
064    
065        /**
066         * Returns
067         * RGS (Resource Group) - creates it if necessary
068         */
069        public RGS getRGS() { 
070           RGS ret = null;
071           try {
072              ret = (RGS)this.get("RGS");
073           } catch(HL7Exception e) {
074              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
075              throw new RuntimeException(e);
076           }
077           return ret;
078        }
079    
080    
081    
082    
083        /**
084         * Returns
085         * the first repetition of 
086         * SERVICE (a Group object) - creates it if necessary
087         */
088        public SQR_S25_SERVICE getSERVICE() { 
089           SQR_S25_SERVICE ret = null;
090           try {
091              ret = (SQR_S25_SERVICE)this.get("SERVICE");
092           } catch(HL7Exception e) {
093              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
094              throw new RuntimeException(e);
095           }
096           return ret;
097        }
098    
099    
100        /**
101         * Returns a specific repetition of
102         * SERVICE (a Group object) - creates it if necessary
103         *
104         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
105         * @throws HL7Exception if the repetition requested is more than one 
106         *     greater than the number of existing repetitions.
107         */
108        public SQR_S25_SERVICE getSERVICE(int rep) { 
109           SQR_S25_SERVICE ret = null;
110           try {
111              ret = (SQR_S25_SERVICE)this.get("SERVICE", rep);
112           } catch(HL7Exception e) {
113              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
114              throw new RuntimeException(e);
115           }
116           return ret;
117        }
118    
119        /** 
120         * Returns the number of existing repetitions of SERVICE 
121         */ 
122        public int getSERVICEReps() { 
123            int reps = -1; 
124            try { 
125                reps = this.getAll("SERVICE").length; 
126            } catch (HL7Exception e) { 
127                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
128                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
129                throw new RuntimeException(message);
130            } 
131            return reps; 
132        } 
133    
134        /**
135         * Inserts a specific repetition of SERVICE (a Group object)
136         * @see AbstractGroup#insertRepetition(Structure, int) 
137         */
138        public void insertSERVICE(SQR_S25_SERVICE structure, int rep) throws HL7Exception { 
139           super.insertRepetition("SERVICE", structure, rep);
140        }
141    
142    
143        /**
144         * Inserts a specific repetition of SERVICE (a Group object)
145         * @see AbstractGroup#insertRepetition(Structure, int) 
146         */
147        public SQR_S25_SERVICE insertSERVICE(int rep) throws HL7Exception { 
148           return (SQR_S25_SERVICE)super.insertRepetition("SERVICE", rep);
149        }
150    
151    
152        /**
153         * Removes a specific repetition of SERVICE (a Group object)
154         * @see AbstractGroup#removeRepetition(String, int) 
155         */
156        public SQR_S25_SERVICE removeSERVICE(int rep) throws HL7Exception { 
157           return (SQR_S25_SERVICE)super.removeRepetition("SERVICE", rep);
158        }
159    
160    
161    
162        /**
163         * Returns
164         * the first repetition of 
165         * GENERAL_RESOURCE (a Group object) - creates it if necessary
166         */
167        public SQR_S25_GENERAL_RESOURCE getGENERAL_RESOURCE() { 
168           SQR_S25_GENERAL_RESOURCE ret = null;
169           try {
170              ret = (SQR_S25_GENERAL_RESOURCE)this.get("GENERAL_RESOURCE");
171           } catch(HL7Exception e) {
172              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
173              throw new RuntimeException(e);
174           }
175           return ret;
176        }
177    
178    
179        /**
180         * Returns a specific repetition of
181         * GENERAL_RESOURCE (a Group object) - creates it if necessary
182         *
183         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
184         * @throws HL7Exception if the repetition requested is more than one 
185         *     greater than the number of existing repetitions.
186         */
187        public SQR_S25_GENERAL_RESOURCE getGENERAL_RESOURCE(int rep) { 
188           SQR_S25_GENERAL_RESOURCE ret = null;
189           try {
190              ret = (SQR_S25_GENERAL_RESOURCE)this.get("GENERAL_RESOURCE", rep);
191           } catch(HL7Exception e) {
192              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
193              throw new RuntimeException(e);
194           }
195           return ret;
196        }
197    
198        /** 
199         * Returns the number of existing repetitions of GENERAL_RESOURCE 
200         */ 
201        public int getGENERAL_RESOURCEReps() { 
202            int reps = -1; 
203            try { 
204                reps = this.getAll("GENERAL_RESOURCE").length; 
205            } catch (HL7Exception e) { 
206                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
207                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
208                throw new RuntimeException(message);
209            } 
210            return reps; 
211        } 
212    
213        /**
214         * Inserts a specific repetition of GENERAL_RESOURCE (a Group object)
215         * @see AbstractGroup#insertRepetition(Structure, int) 
216         */
217        public void insertGENERAL_RESOURCE(SQR_S25_GENERAL_RESOURCE structure, int rep) throws HL7Exception { 
218           super.insertRepetition("GENERAL_RESOURCE", structure, rep);
219        }
220    
221    
222        /**
223         * Inserts a specific repetition of GENERAL_RESOURCE (a Group object)
224         * @see AbstractGroup#insertRepetition(Structure, int) 
225         */
226        public SQR_S25_GENERAL_RESOURCE insertGENERAL_RESOURCE(int rep) throws HL7Exception { 
227           return (SQR_S25_GENERAL_RESOURCE)super.insertRepetition("GENERAL_RESOURCE", rep);
228        }
229    
230    
231        /**
232         * Removes a specific repetition of GENERAL_RESOURCE (a Group object)
233         * @see AbstractGroup#removeRepetition(String, int) 
234         */
235        public SQR_S25_GENERAL_RESOURCE removeGENERAL_RESOURCE(int rep) throws HL7Exception { 
236           return (SQR_S25_GENERAL_RESOURCE)super.removeRepetition("GENERAL_RESOURCE", rep);
237        }
238    
239    
240    
241        /**
242         * Returns
243         * the first repetition of 
244         * PERSONNEL_RESOURCE (a Group object) - creates it if necessary
245         */
246        public SQR_S25_PERSONNEL_RESOURCE getPERSONNEL_RESOURCE() { 
247           SQR_S25_PERSONNEL_RESOURCE ret = null;
248           try {
249              ret = (SQR_S25_PERSONNEL_RESOURCE)this.get("PERSONNEL_RESOURCE");
250           } catch(HL7Exception e) {
251              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
252              throw new RuntimeException(e);
253           }
254           return ret;
255        }
256    
257    
258        /**
259         * Returns a specific repetition of
260         * PERSONNEL_RESOURCE (a Group object) - creates it if necessary
261         *
262         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
263         * @throws HL7Exception if the repetition requested is more than one 
264         *     greater than the number of existing repetitions.
265         */
266        public SQR_S25_PERSONNEL_RESOURCE getPERSONNEL_RESOURCE(int rep) { 
267           SQR_S25_PERSONNEL_RESOURCE ret = null;
268           try {
269              ret = (SQR_S25_PERSONNEL_RESOURCE)this.get("PERSONNEL_RESOURCE", rep);
270           } catch(HL7Exception e) {
271              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
272              throw new RuntimeException(e);
273           }
274           return ret;
275        }
276    
277        /** 
278         * Returns the number of existing repetitions of PERSONNEL_RESOURCE 
279         */ 
280        public int getPERSONNEL_RESOURCEReps() { 
281            int reps = -1; 
282            try { 
283                reps = this.getAll("PERSONNEL_RESOURCE").length; 
284            } catch (HL7Exception e) { 
285                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
286                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
287                throw new RuntimeException(message);
288            } 
289            return reps; 
290        } 
291    
292        /**
293         * Inserts a specific repetition of PERSONNEL_RESOURCE (a Group object)
294         * @see AbstractGroup#insertRepetition(Structure, int) 
295         */
296        public void insertPERSONNEL_RESOURCE(SQR_S25_PERSONNEL_RESOURCE structure, int rep) throws HL7Exception { 
297           super.insertRepetition("PERSONNEL_RESOURCE", structure, rep);
298        }
299    
300    
301        /**
302         * Inserts a specific repetition of PERSONNEL_RESOURCE (a Group object)
303         * @see AbstractGroup#insertRepetition(Structure, int) 
304         */
305        public SQR_S25_PERSONNEL_RESOURCE insertPERSONNEL_RESOURCE(int rep) throws HL7Exception { 
306           return (SQR_S25_PERSONNEL_RESOURCE)super.insertRepetition("PERSONNEL_RESOURCE", rep);
307        }
308    
309    
310        /**
311         * Removes a specific repetition of PERSONNEL_RESOURCE (a Group object)
312         * @see AbstractGroup#removeRepetition(String, int) 
313         */
314        public SQR_S25_PERSONNEL_RESOURCE removePERSONNEL_RESOURCE(int rep) throws HL7Exception { 
315           return (SQR_S25_PERSONNEL_RESOURCE)super.removeRepetition("PERSONNEL_RESOURCE", rep);
316        }
317    
318    
319    
320        /**
321         * Returns
322         * the first repetition of 
323         * LOCATION_RESOURCE (a Group object) - creates it if necessary
324         */
325        public SQR_S25_LOCATION_RESOURCE getLOCATION_RESOURCE() { 
326           SQR_S25_LOCATION_RESOURCE ret = null;
327           try {
328              ret = (SQR_S25_LOCATION_RESOURCE)this.get("LOCATION_RESOURCE");
329           } catch(HL7Exception e) {
330              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
331              throw new RuntimeException(e);
332           }
333           return ret;
334        }
335    
336    
337        /**
338         * Returns a specific repetition of
339         * LOCATION_RESOURCE (a Group object) - creates it if necessary
340         *
341         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
342         * @throws HL7Exception if the repetition requested is more than one 
343         *     greater than the number of existing repetitions.
344         */
345        public SQR_S25_LOCATION_RESOURCE getLOCATION_RESOURCE(int rep) { 
346           SQR_S25_LOCATION_RESOURCE ret = null;
347           try {
348              ret = (SQR_S25_LOCATION_RESOURCE)this.get("LOCATION_RESOURCE", rep);
349           } catch(HL7Exception e) {
350              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
351              throw new RuntimeException(e);
352           }
353           return ret;
354        }
355    
356        /** 
357         * Returns the number of existing repetitions of LOCATION_RESOURCE 
358         */ 
359        public int getLOCATION_RESOURCEReps() { 
360            int reps = -1; 
361            try { 
362                reps = this.getAll("LOCATION_RESOURCE").length; 
363            } catch (HL7Exception e) { 
364                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
365                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
366                throw new RuntimeException(message);
367            } 
368            return reps; 
369        } 
370    
371        /**
372         * Inserts a specific repetition of LOCATION_RESOURCE (a Group object)
373         * @see AbstractGroup#insertRepetition(Structure, int) 
374         */
375        public void insertLOCATION_RESOURCE(SQR_S25_LOCATION_RESOURCE structure, int rep) throws HL7Exception { 
376           super.insertRepetition("LOCATION_RESOURCE", structure, rep);
377        }
378    
379    
380        /**
381         * Inserts a specific repetition of LOCATION_RESOURCE (a Group object)
382         * @see AbstractGroup#insertRepetition(Structure, int) 
383         */
384        public SQR_S25_LOCATION_RESOURCE insertLOCATION_RESOURCE(int rep) throws HL7Exception { 
385           return (SQR_S25_LOCATION_RESOURCE)super.insertRepetition("LOCATION_RESOURCE", rep);
386        }
387    
388    
389        /**
390         * Removes a specific repetition of LOCATION_RESOURCE (a Group object)
391         * @see AbstractGroup#removeRepetition(String, int) 
392         */
393        public SQR_S25_LOCATION_RESOURCE removeLOCATION_RESOURCE(int rep) throws HL7Exception { 
394           return (SQR_S25_LOCATION_RESOURCE)super.removeRepetition("LOCATION_RESOURCE", rep);
395        }
396    
397    
398    
399    }
400