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.message;
009    
010    import ca.uhn.hl7v2.model.v24.group.*;
011    import ca.uhn.hl7v2.model.v24.segment.*;
012    
013    import ca.uhn.log.HapiLogFactory;
014    import ca.uhn.hl7v2.HL7Exception;
015    import ca.uhn.hl7v2.parser.ModelClassFactory;
016    import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
017    import ca.uhn.hl7v2.model.AbstractMessage;
018    
019    /**
020     * <p>Represents a PMU_B01 message structure (see chapter 15). This structure contains the 
021     * following elements: </p>
022     * <ul>
023                     * <li>1: MSH (Message Header) <b> </b></li>
024                     * <li>2: EVN (Event Type) <b> </b></li>
025                     * <li>3: STF (Staff Identification) <b> </b></li>
026                     * <li>4: PRA (Practitioner Detail) <b>optional repeating</b></li>
027                     * <li>5: ORG (Practitioner Organization Unit) <b>optional repeating</b></li>
028                     * <li>6: AFF (Professional Affiliation) <b>optional repeating</b></li>
029                     * <li>7: LAN (Language Detail) <b>optional repeating</b></li>
030                     * <li>8: EDU (Educational Detail) <b>optional repeating</b></li>
031     * </ul>
032     */
033    public class PMU_B01 extends AbstractMessage  {
034    
035        /**
036         * Creates a new PMU_B01 message with DefaultModelClassFactory. 
037         */ 
038        public PMU_B01() { 
039           this(new DefaultModelClassFactory());
040        }
041    
042        /** 
043         * Creates a new PMU_B01 message with custom ModelClassFactory.
044         */
045        public PMU_B01(ModelClassFactory factory) {
046           super(factory);
047           init(factory);
048        }
049    
050        private void init(ModelClassFactory factory) {
051           try {
052                              this.add(MSH.class, true, false);
053                              this.add(EVN.class, true, false);
054                              this.add(STF.class, true, false);
055                              this.add(PRA.class, false, true);
056                              this.add(ORG.class, false, true);
057                              this.add(AFF.class, false, true);
058                              this.add(LAN.class, false, true);
059                              this.add(EDU.class, false, true);
060           } catch(HL7Exception e) {
061              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating PMU_B01 - this is probably a bug in the source code generator.", e);
062           }
063        }
064    
065        /** 
066         * Returns "2.4"
067         */
068        public String getVersion() {
069           return "2.4";
070        }
071    
072    
073    
074        /**
075         * Returns
076         * MSH (Message Header) - creates it if necessary
077         */
078        public MSH getMSH() { 
079           MSH ret = null;
080           try {
081              ret = (MSH)this.get("MSH");
082           } catch(HL7Exception e) {
083              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
084              throw new RuntimeException(e);
085           }
086           return ret;
087        }
088    
089    
090    
091    
092        /**
093         * Returns
094         * EVN (Event Type) - creates it if necessary
095         */
096        public EVN getEVN() { 
097           EVN ret = null;
098           try {
099              ret = (EVN)this.get("EVN");
100           } catch(HL7Exception e) {
101              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
102              throw new RuntimeException(e);
103           }
104           return ret;
105        }
106    
107    
108    
109    
110        /**
111         * Returns
112         * STF (Staff Identification) - creates it if necessary
113         */
114        public STF getSTF() { 
115           STF ret = null;
116           try {
117              ret = (STF)this.get("STF");
118           } catch(HL7Exception e) {
119              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
120              throw new RuntimeException(e);
121           }
122           return ret;
123        }
124    
125    
126    
127    
128        /**
129         * Returns
130         * the first repetition of 
131         * PRA (Practitioner Detail) - creates it if necessary
132         */
133        public PRA getPRA() { 
134           PRA ret = null;
135           try {
136              ret = (PRA)this.get("PRA");
137           } catch(HL7Exception e) {
138              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
139              throw new RuntimeException(e);
140           }
141           return ret;
142        }
143    
144    
145        /**
146         * Returns a specific repetition of
147         * PRA (Practitioner Detail) - creates it if necessary
148         *
149         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
150         * @throws HL7Exception if the repetition requested is more than one 
151         *     greater than the number of existing repetitions.
152         */
153        public PRA getPRA(int rep) { 
154           PRA ret = null;
155           try {
156              ret = (PRA)this.get("PRA", rep);
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         * Returns the number of existing repetitions of PRA 
166         */ 
167        public int getPRAReps() { 
168            int reps = -1; 
169            try { 
170                reps = this.getAll("PRA").length; 
171            } catch (HL7Exception e) { 
172                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
173                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
174                throw new RuntimeException(message);
175            } 
176            return reps; 
177        } 
178    
179        /**
180         * Inserts a specific repetition of PRA (Practitioner Detail)
181         * @see AbstractGroup\#insertRepetition(Structure, int) 
182         */
183        public void insertPRA(PRA structure, int rep) throws HL7Exception { 
184           super.insertRepetition( "PRA", structure, rep);
185        }
186    
187    
188        /**
189         * Inserts a specific repetition of PRA (Practitioner Detail)
190         * @see AbstractGroup\#insertRepetition(Structure, int) 
191         */
192        public PRA insertPRA(int rep) throws HL7Exception { 
193           return (PRA)super.insertRepetition("PRA", rep);
194        }
195    
196    
197        /**
198         * Removes a specific repetition of PRA (Practitioner Detail)
199         * @see AbstractGroup\#removeRepetition(String, int) 
200         */
201        public PRA removePRA(int rep) throws HL7Exception { 
202           return (PRA)super.removeRepetition("PRA", rep);
203        }
204    
205    
206    
207        /**
208         * Returns
209         * the first repetition of 
210         * ORG (Practitioner Organization Unit) - creates it if necessary
211         */
212        public ORG getORG() { 
213           ORG ret = null;
214           try {
215              ret = (ORG)this.get("ORG");
216           } catch(HL7Exception e) {
217              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
218              throw new RuntimeException(e);
219           }
220           return ret;
221        }
222    
223    
224        /**
225         * Returns a specific repetition of
226         * ORG (Practitioner Organization Unit) - creates it if necessary
227         *
228         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
229         * @throws HL7Exception if the repetition requested is more than one 
230         *     greater than the number of existing repetitions.
231         */
232        public ORG getORG(int rep) { 
233           ORG ret = null;
234           try {
235              ret = (ORG)this.get("ORG", rep);
236           } catch(HL7Exception e) {
237              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
238              throw new RuntimeException(e);
239           }
240           return ret;
241        }
242    
243        /** 
244         * Returns the number of existing repetitions of ORG 
245         */ 
246        public int getORGReps() { 
247            int reps = -1; 
248            try { 
249                reps = this.getAll("ORG").length; 
250            } catch (HL7Exception e) { 
251                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
252                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
253                throw new RuntimeException(message);
254            } 
255            return reps; 
256        } 
257    
258        /**
259         * Inserts a specific repetition of ORG (Practitioner Organization Unit)
260         * @see AbstractGroup\#insertRepetition(Structure, int) 
261         */
262        public void insertORG(ORG structure, int rep) throws HL7Exception { 
263           super.insertRepetition( "ORG", structure, rep);
264        }
265    
266    
267        /**
268         * Inserts a specific repetition of ORG (Practitioner Organization Unit)
269         * @see AbstractGroup\#insertRepetition(Structure, int) 
270         */
271        public ORG insertORG(int rep) throws HL7Exception { 
272           return (ORG)super.insertRepetition("ORG", rep);
273        }
274    
275    
276        /**
277         * Removes a specific repetition of ORG (Practitioner Organization Unit)
278         * @see AbstractGroup\#removeRepetition(String, int) 
279         */
280        public ORG removeORG(int rep) throws HL7Exception { 
281           return (ORG)super.removeRepetition("ORG", rep);
282        }
283    
284    
285    
286        /**
287         * Returns
288         * the first repetition of 
289         * AFF (Professional Affiliation) - creates it if necessary
290         */
291        public AFF getAFF() { 
292           AFF ret = null;
293           try {
294              ret = (AFF)this.get("AFF");
295           } catch(HL7Exception e) {
296              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
297              throw new RuntimeException(e);
298           }
299           return ret;
300        }
301    
302    
303        /**
304         * Returns a specific repetition of
305         * AFF (Professional Affiliation) - creates it if necessary
306         *
307         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
308         * @throws HL7Exception if the repetition requested is more than one 
309         *     greater than the number of existing repetitions.
310         */
311        public AFF getAFF(int rep) { 
312           AFF ret = null;
313           try {
314              ret = (AFF)this.get("AFF", rep);
315           } catch(HL7Exception e) {
316              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
317              throw new RuntimeException(e);
318           }
319           return ret;
320        }
321    
322        /** 
323         * Returns the number of existing repetitions of AFF 
324         */ 
325        public int getAFFReps() { 
326            int reps = -1; 
327            try { 
328                reps = this.getAll("AFF").length; 
329            } catch (HL7Exception e) { 
330                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
331                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
332                throw new RuntimeException(message);
333            } 
334            return reps; 
335        } 
336    
337        /**
338         * Inserts a specific repetition of AFF (Professional Affiliation)
339         * @see AbstractGroup\#insertRepetition(Structure, int) 
340         */
341        public void insertAFF(AFF structure, int rep) throws HL7Exception { 
342           super.insertRepetition( "AFF", structure, rep);
343        }
344    
345    
346        /**
347         * Inserts a specific repetition of AFF (Professional Affiliation)
348         * @see AbstractGroup\#insertRepetition(Structure, int) 
349         */
350        public AFF insertAFF(int rep) throws HL7Exception { 
351           return (AFF)super.insertRepetition("AFF", rep);
352        }
353    
354    
355        /**
356         * Removes a specific repetition of AFF (Professional Affiliation)
357         * @see AbstractGroup\#removeRepetition(String, int) 
358         */
359        public AFF removeAFF(int rep) throws HL7Exception { 
360           return (AFF)super.removeRepetition("AFF", rep);
361        }
362    
363    
364    
365        /**
366         * Returns
367         * the first repetition of 
368         * LAN (Language Detail) - creates it if necessary
369         */
370        public LAN getLAN() { 
371           LAN ret = null;
372           try {
373              ret = (LAN)this.get("LAN");
374           } catch(HL7Exception e) {
375              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
376              throw new RuntimeException(e);
377           }
378           return ret;
379        }
380    
381    
382        /**
383         * Returns a specific repetition of
384         * LAN (Language Detail) - creates it if necessary
385         *
386         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
387         * @throws HL7Exception if the repetition requested is more than one 
388         *     greater than the number of existing repetitions.
389         */
390        public LAN getLAN(int rep) { 
391           LAN ret = null;
392           try {
393              ret = (LAN)this.get("LAN", rep);
394           } catch(HL7Exception e) {
395              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
396              throw new RuntimeException(e);
397           }
398           return ret;
399        }
400    
401        /** 
402         * Returns the number of existing repetitions of LAN 
403         */ 
404        public int getLANReps() { 
405            int reps = -1; 
406            try { 
407                reps = this.getAll("LAN").length; 
408            } catch (HL7Exception e) { 
409                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
410                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
411                throw new RuntimeException(message);
412            } 
413            return reps; 
414        } 
415    
416        /**
417         * Inserts a specific repetition of LAN (Language Detail)
418         * @see AbstractGroup\#insertRepetition(Structure, int) 
419         */
420        public void insertLAN(LAN structure, int rep) throws HL7Exception { 
421           super.insertRepetition( "LAN", structure, rep);
422        }
423    
424    
425        /**
426         * Inserts a specific repetition of LAN (Language Detail)
427         * @see AbstractGroup\#insertRepetition(Structure, int) 
428         */
429        public LAN insertLAN(int rep) throws HL7Exception { 
430           return (LAN)super.insertRepetition("LAN", rep);
431        }
432    
433    
434        /**
435         * Removes a specific repetition of LAN (Language Detail)
436         * @see AbstractGroup\#removeRepetition(String, int) 
437         */
438        public LAN removeLAN(int rep) throws HL7Exception { 
439           return (LAN)super.removeRepetition("LAN", rep);
440        }
441    
442    
443    
444        /**
445         * Returns
446         * the first repetition of 
447         * EDU (Educational Detail) - creates it if necessary
448         */
449        public EDU getEDU() { 
450           EDU ret = null;
451           try {
452              ret = (EDU)this.get("EDU");
453           } catch(HL7Exception e) {
454              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
455              throw new RuntimeException(e);
456           }
457           return ret;
458        }
459    
460    
461        /**
462         * Returns a specific repetition of
463         * EDU (Educational Detail) - creates it if necessary
464         *
465         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
466         * @throws HL7Exception if the repetition requested is more than one 
467         *     greater than the number of existing repetitions.
468         */
469        public EDU getEDU(int rep) { 
470           EDU ret = null;
471           try {
472              ret = (EDU)this.get("EDU", rep);
473           } catch(HL7Exception e) {
474              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
475              throw new RuntimeException(e);
476           }
477           return ret;
478        }
479    
480        /** 
481         * Returns the number of existing repetitions of EDU 
482         */ 
483        public int getEDUReps() { 
484            int reps = -1; 
485            try { 
486                reps = this.getAll("EDU").length; 
487            } catch (HL7Exception e) { 
488                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
489                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
490                throw new RuntimeException(message);
491            } 
492            return reps; 
493        } 
494    
495        /**
496         * Inserts a specific repetition of EDU (Educational Detail)
497         * @see AbstractGroup\#insertRepetition(Structure, int) 
498         */
499        public void insertEDU(EDU structure, int rep) throws HL7Exception { 
500           super.insertRepetition( "EDU", structure, rep);
501        }
502    
503    
504        /**
505         * Inserts a specific repetition of EDU (Educational Detail)
506         * @see AbstractGroup\#insertRepetition(Structure, int) 
507         */
508        public EDU insertEDU(int rep) throws HL7Exception { 
509           return (EDU)super.insertRepetition("EDU", rep);
510        }
511    
512    
513        /**
514         * Removes a specific repetition of EDU (Educational Detail)
515         * @see AbstractGroup\#removeRepetition(String, int) 
516         */
517        public EDU removeEDU(int rep) throws HL7Exception { 
518           return (EDU)super.removeRepetition("EDU", rep);
519        }
520    
521    
522    
523    }
524