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 RSP_K25_STAFF 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: STF (Staff Identification) <b> </b></li>
028                     * <li>2: PRA (Practitioner Detail) <b>optional </b></li>
029                     * <li>3: ORG (Practitioner Organization Unit) <b>optional repeating</b></li>
030                     * <li>4: AFF (Professional Affiliation) <b>optional repeating</b></li>
031                     * <li>5: LAN (Language Detail) <b>optional repeating</b></li>
032                     * <li>6: EDU (Educational Detail) <b>optional repeating</b></li>
033     * </ul>
034     */
035    public class RSP_K25_STAFF extends AbstractGroup {
036    
037        /** 
038         * Creates a new RSP_K25_STAFF group
039         */
040        public RSP_K25_STAFF(Group parent, ModelClassFactory factory) {
041           super(parent, factory);
042           init(factory);
043        }
044    
045        private void init(ModelClassFactory factory) {
046           try {
047                              this.add(STF.class, true, false);
048                              this.add(PRA.class, false, false);
049                              this.add(ORG.class, false, true);
050                              this.add(AFF.class, false, true);
051                              this.add(LAN.class, false, true);
052                              this.add(EDU.class, false, true);
053           } catch(HL7Exception e) {
054              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating RSP_K25_STAFF - 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         * STF (Staff Identification) - creates it if necessary
070         */
071        public STF getSTF() { 
072           STF ret = null;
073           try {
074              ret = (STF)this.get("STF");
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         * PRA (Practitioner Detail) - creates it if necessary
088         */
089        public PRA getPRA() { 
090           PRA ret = null;
091           try {
092              ret = (PRA)this.get("PRA");
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         * the first repetition of 
106         * ORG (Practitioner Organization Unit) - creates it if necessary
107         */
108        public ORG getORG() { 
109           ORG ret = null;
110           try {
111              ret = (ORG)this.get("ORG");
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        /**
121         * Returns a specific repetition of
122         * ORG (Practitioner Organization Unit) - creates it if necessary
123         *
124         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
125         * @throws HL7Exception if the repetition requested is more than one 
126         *     greater than the number of existing repetitions.
127         */
128        public ORG getORG(int rep) { 
129           ORG ret = null;
130           try {
131              ret = (ORG)this.get("ORG", rep);
132           } catch(HL7Exception e) {
133              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
134              throw new RuntimeException(e);
135           }
136           return ret;
137        }
138    
139        /** 
140         * Returns the number of existing repetitions of ORG 
141         */ 
142        public int getORGReps() { 
143            int reps = -1; 
144            try { 
145                reps = this.getAll("ORG").length; 
146            } catch (HL7Exception e) { 
147                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
148                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
149                throw new RuntimeException(message);
150            } 
151            return reps; 
152        } 
153    
154        /**
155         * Inserts a specific repetition of ORG (Practitioner Organization Unit)
156         * @see AbstractGroup#insertRepetition(Structure, int) 
157         */
158        public void insertORG(ORG structure, int rep) throws HL7Exception { 
159           super.insertRepetition("ORG", structure, rep);
160        }
161    
162    
163        /**
164         * Inserts a specific repetition of ORG (Practitioner Organization Unit)
165         * @see AbstractGroup#insertRepetition(Structure, int) 
166         */
167        public ORG insertORG(int rep) throws HL7Exception { 
168           return (ORG)super.insertRepetition("ORG", rep);
169        }
170    
171    
172        /**
173         * Removes a specific repetition of ORG (Practitioner Organization Unit)
174         * @see AbstractGroup#removeRepetition(String, int) 
175         */
176        public ORG removeORG(int rep) throws HL7Exception { 
177           return (ORG)super.removeRepetition("ORG", rep);
178        }
179    
180    
181    
182        /**
183         * Returns
184         * the first repetition of 
185         * AFF (Professional Affiliation) - creates it if necessary
186         */
187        public AFF getAFF() { 
188           AFF ret = null;
189           try {
190              ret = (AFF)this.get("AFF");
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        /**
200         * Returns a specific repetition of
201         * AFF (Professional Affiliation) - creates it if necessary
202         *
203         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
204         * @throws HL7Exception if the repetition requested is more than one 
205         *     greater than the number of existing repetitions.
206         */
207        public AFF getAFF(int rep) { 
208           AFF ret = null;
209           try {
210              ret = (AFF)this.get("AFF", rep);
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         * Returns the number of existing repetitions of AFF 
220         */ 
221        public int getAFFReps() { 
222            int reps = -1; 
223            try { 
224                reps = this.getAll("AFF").length; 
225            } catch (HL7Exception e) { 
226                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
227                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
228                throw new RuntimeException(message);
229            } 
230            return reps; 
231        } 
232    
233        /**
234         * Inserts a specific repetition of AFF (Professional Affiliation)
235         * @see AbstractGroup#insertRepetition(Structure, int) 
236         */
237        public void insertAFF(AFF structure, int rep) throws HL7Exception { 
238           super.insertRepetition("AFF", structure, rep);
239        }
240    
241    
242        /**
243         * Inserts a specific repetition of AFF (Professional Affiliation)
244         * @see AbstractGroup#insertRepetition(Structure, int) 
245         */
246        public AFF insertAFF(int rep) throws HL7Exception { 
247           return (AFF)super.insertRepetition("AFF", rep);
248        }
249    
250    
251        /**
252         * Removes a specific repetition of AFF (Professional Affiliation)
253         * @see AbstractGroup#removeRepetition(String, int) 
254         */
255        public AFF removeAFF(int rep) throws HL7Exception { 
256           return (AFF)super.removeRepetition("AFF", rep);
257        }
258    
259    
260    
261        /**
262         * Returns
263         * the first repetition of 
264         * LAN (Language Detail) - creates it if necessary
265         */
266        public LAN getLAN() { 
267           LAN ret = null;
268           try {
269              ret = (LAN)this.get("LAN");
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        /**
279         * Returns a specific repetition of
280         * LAN (Language Detail) - creates it if necessary
281         *
282         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
283         * @throws HL7Exception if the repetition requested is more than one 
284         *     greater than the number of existing repetitions.
285         */
286        public LAN getLAN(int rep) { 
287           LAN ret = null;
288           try {
289              ret = (LAN)this.get("LAN", rep);
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         * Returns the number of existing repetitions of LAN 
299         */ 
300        public int getLANReps() { 
301            int reps = -1; 
302            try { 
303                reps = this.getAll("LAN").length; 
304            } catch (HL7Exception e) { 
305                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
306                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
307                throw new RuntimeException(message);
308            } 
309            return reps; 
310        } 
311    
312        /**
313         * Inserts a specific repetition of LAN (Language Detail)
314         * @see AbstractGroup#insertRepetition(Structure, int) 
315         */
316        public void insertLAN(LAN structure, int rep) throws HL7Exception { 
317           super.insertRepetition("LAN", structure, rep);
318        }
319    
320    
321        /**
322         * Inserts a specific repetition of LAN (Language Detail)
323         * @see AbstractGroup#insertRepetition(Structure, int) 
324         */
325        public LAN insertLAN(int rep) throws HL7Exception { 
326           return (LAN)super.insertRepetition("LAN", rep);
327        }
328    
329    
330        /**
331         * Removes a specific repetition of LAN (Language Detail)
332         * @see AbstractGroup#removeRepetition(String, int) 
333         */
334        public LAN removeLAN(int rep) throws HL7Exception { 
335           return (LAN)super.removeRepetition("LAN", rep);
336        }
337    
338    
339    
340        /**
341         * Returns
342         * the first repetition of 
343         * EDU (Educational Detail) - creates it if necessary
344         */
345        public EDU getEDU() { 
346           EDU ret = null;
347           try {
348              ret = (EDU)this.get("EDU");
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        /**
358         * Returns a specific repetition of
359         * EDU (Educational Detail) - creates it if necessary
360         *
361         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
362         * @throws HL7Exception if the repetition requested is more than one 
363         *     greater than the number of existing repetitions.
364         */
365        public EDU getEDU(int rep) { 
366           EDU ret = null;
367           try {
368              ret = (EDU)this.get("EDU", rep);
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         * Returns the number of existing repetitions of EDU 
378         */ 
379        public int getEDUReps() { 
380            int reps = -1; 
381            try { 
382                reps = this.getAll("EDU").length; 
383            } catch (HL7Exception e) { 
384                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
385                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
386                throw new RuntimeException(message);
387            } 
388            return reps; 
389        } 
390    
391        /**
392         * Inserts a specific repetition of EDU (Educational Detail)
393         * @see AbstractGroup#insertRepetition(Structure, int) 
394         */
395        public void insertEDU(EDU structure, int rep) throws HL7Exception { 
396           super.insertRepetition("EDU", structure, rep);
397        }
398    
399    
400        /**
401         * Inserts a specific repetition of EDU (Educational Detail)
402         * @see AbstractGroup#insertRepetition(Structure, int) 
403         */
404        public EDU insertEDU(int rep) throws HL7Exception { 
405           return (EDU)super.insertRepetition("EDU", rep);
406        }
407    
408    
409        /**
410         * Removes a specific repetition of EDU (Educational Detail)
411         * @see AbstractGroup#removeRepetition(String, int) 
412         */
413        public EDU removeEDU(int rep) throws HL7Exception { 
414           return (EDU)super.removeRepetition("EDU", rep);
415        }
416    
417    
418    
419    }
420