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 PTR_PCF_PROBLEM 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: PRB (Problem Details) <b> </b></li>
028                     * <li>2: NTE (Notes and Comments) <b>optional repeating</b></li>
029                     * <li>3: VAR (Variance) <b>optional repeating</b></li>
030                     * <li>4: PTR_PCF_PROBLEM_ROLE (a Group object) <b>optional repeating</b></li>
031                     * <li>5: PTR_PCF_PROBLEM_OBSERVATION (a Group object) <b>optional repeating</b></li>
032                     * <li>6: PTR_PCF_GOAL (a Group object) <b>optional repeating</b></li>
033                     * <li>7: PTR_PCF_ORDER (a Group object) <b>optional repeating</b></li>
034     * </ul>
035     */
036    public class PTR_PCF_PROBLEM extends AbstractGroup {
037    
038        /** 
039         * Creates a new PTR_PCF_PROBLEM group
040         */
041        public PTR_PCF_PROBLEM(Group parent, ModelClassFactory factory) {
042           super(parent, factory);
043           init(factory);
044        }
045    
046        private void init(ModelClassFactory factory) {
047           try {
048                              this.add(PRB.class, true, false);
049                              this.add(NTE.class, false, true);
050                              this.add(VAR.class, false, true);
051                              this.add(PTR_PCF_PROBLEM_ROLE.class, false, true);
052                              this.add(PTR_PCF_PROBLEM_OBSERVATION.class, false, true);
053                              this.add(PTR_PCF_GOAL.class, false, true);
054                              this.add(PTR_PCF_ORDER.class, false, true);
055           } catch(HL7Exception e) {
056              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating PTR_PCF_PROBLEM - this is probably a bug in the source code generator.", e);
057           }
058        }
059    
060        /** 
061         * Returns "2.4"
062         */
063        public String getVersion() {
064           return "2.4";
065        }
066    
067    
068    
069        /**
070         * Returns
071         * PRB (Problem Details) - creates it if necessary
072         */
073        public PRB getPRB() { 
074           PRB ret = null;
075           try {
076              ret = (PRB)this.get("PRB");
077           } catch(HL7Exception e) {
078              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
079              throw new RuntimeException(e);
080           }
081           return ret;
082        }
083    
084    
085    
086    
087        /**
088         * Returns
089         * the first repetition of 
090         * NTE (Notes and Comments) - creates it if necessary
091         */
092        public NTE getNTE() { 
093           NTE ret = null;
094           try {
095              ret = (NTE)this.get("NTE");
096           } catch(HL7Exception e) {
097              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
098              throw new RuntimeException(e);
099           }
100           return ret;
101        }
102    
103    
104        /**
105         * Returns a specific repetition of
106         * NTE (Notes and Comments) - creates it if necessary
107         *
108         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
109         * @throws HL7Exception if the repetition requested is more than one 
110         *     greater than the number of existing repetitions.
111         */
112        public NTE getNTE(int rep) { 
113           NTE ret = null;
114           try {
115              ret = (NTE)this.get("NTE", rep);
116           } catch(HL7Exception e) {
117              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
118              throw new RuntimeException(e);
119           }
120           return ret;
121        }
122    
123        /** 
124         * Returns the number of existing repetitions of NTE 
125         */ 
126        public int getNTEReps() { 
127            int reps = -1; 
128            try { 
129                reps = this.getAll("NTE").length; 
130            } catch (HL7Exception e) { 
131                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
132                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
133                throw new RuntimeException(message);
134            } 
135            return reps; 
136        } 
137    
138        /**
139         * Inserts a specific repetition of NTE (Notes and Comments)
140         * @see AbstractGroup#insertRepetition(Structure, int) 
141         */
142        public void insertNTE(NTE structure, int rep) throws HL7Exception { 
143           super.insertRepetition("NTE", structure, rep);
144        }
145    
146    
147        /**
148         * Inserts a specific repetition of NTE (Notes and Comments)
149         * @see AbstractGroup#insertRepetition(Structure, int) 
150         */
151        public NTE insertNTE(int rep) throws HL7Exception { 
152           return (NTE)super.insertRepetition("NTE", rep);
153        }
154    
155    
156        /**
157         * Removes a specific repetition of NTE (Notes and Comments)
158         * @see AbstractGroup#removeRepetition(String, int) 
159         */
160        public NTE removeNTE(int rep) throws HL7Exception { 
161           return (NTE)super.removeRepetition("NTE", rep);
162        }
163    
164    
165    
166        /**
167         * Returns
168         * the first repetition of 
169         * VAR (Variance) - creates it if necessary
170         */
171        public VAR getVAR() { 
172           VAR ret = null;
173           try {
174              ret = (VAR)this.get("VAR");
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         * Returns a specific repetition of
185         * VAR (Variance) - creates it if necessary
186         *
187         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
188         * @throws HL7Exception if the repetition requested is more than one 
189         *     greater than the number of existing repetitions.
190         */
191        public VAR getVAR(int rep) { 
192           VAR ret = null;
193           try {
194              ret = (VAR)this.get("VAR", rep);
195           } catch(HL7Exception e) {
196              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
197              throw new RuntimeException(e);
198           }
199           return ret;
200        }
201    
202        /** 
203         * Returns the number of existing repetitions of VAR 
204         */ 
205        public int getVARReps() { 
206            int reps = -1; 
207            try { 
208                reps = this.getAll("VAR").length; 
209            } catch (HL7Exception e) { 
210                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
211                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
212                throw new RuntimeException(message);
213            } 
214            return reps; 
215        } 
216    
217        /**
218         * Inserts a specific repetition of VAR (Variance)
219         * @see AbstractGroup#insertRepetition(Structure, int) 
220         */
221        public void insertVAR(VAR structure, int rep) throws HL7Exception { 
222           super.insertRepetition("VAR", structure, rep);
223        }
224    
225    
226        /**
227         * Inserts a specific repetition of VAR (Variance)
228         * @see AbstractGroup#insertRepetition(Structure, int) 
229         */
230        public VAR insertVAR(int rep) throws HL7Exception { 
231           return (VAR)super.insertRepetition("VAR", rep);
232        }
233    
234    
235        /**
236         * Removes a specific repetition of VAR (Variance)
237         * @see AbstractGroup#removeRepetition(String, int) 
238         */
239        public VAR removeVAR(int rep) throws HL7Exception { 
240           return (VAR)super.removeRepetition("VAR", rep);
241        }
242    
243    
244    
245        /**
246         * Returns
247         * the first repetition of 
248         * PROBLEM_ROLE (a Group object) - creates it if necessary
249         */
250        public PTR_PCF_PROBLEM_ROLE getPROBLEM_ROLE() { 
251           PTR_PCF_PROBLEM_ROLE ret = null;
252           try {
253              ret = (PTR_PCF_PROBLEM_ROLE)this.get("PROBLEM_ROLE");
254           } catch(HL7Exception e) {
255              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
256              throw new RuntimeException(e);
257           }
258           return ret;
259        }
260    
261    
262        /**
263         * Returns a specific repetition of
264         * PROBLEM_ROLE (a Group object) - creates it if necessary
265         *
266         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
267         * @throws HL7Exception if the repetition requested is more than one 
268         *     greater than the number of existing repetitions.
269         */
270        public PTR_PCF_PROBLEM_ROLE getPROBLEM_ROLE(int rep) { 
271           PTR_PCF_PROBLEM_ROLE ret = null;
272           try {
273              ret = (PTR_PCF_PROBLEM_ROLE)this.get("PROBLEM_ROLE", rep);
274           } catch(HL7Exception e) {
275              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
276              throw new RuntimeException(e);
277           }
278           return ret;
279        }
280    
281        /** 
282         * Returns the number of existing repetitions of PROBLEM_ROLE 
283         */ 
284        public int getPROBLEM_ROLEReps() { 
285            int reps = -1; 
286            try { 
287                reps = this.getAll("PROBLEM_ROLE").length; 
288            } catch (HL7Exception e) { 
289                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
290                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
291                throw new RuntimeException(message);
292            } 
293            return reps; 
294        } 
295    
296        /**
297         * Inserts a specific repetition of PROBLEM_ROLE (a Group object)
298         * @see AbstractGroup#insertRepetition(Structure, int) 
299         */
300        public void insertPROBLEM_ROLE(PTR_PCF_PROBLEM_ROLE structure, int rep) throws HL7Exception { 
301           super.insertRepetition("PROBLEM_ROLE", structure, rep);
302        }
303    
304    
305        /**
306         * Inserts a specific repetition of PROBLEM_ROLE (a Group object)
307         * @see AbstractGroup#insertRepetition(Structure, int) 
308         */
309        public PTR_PCF_PROBLEM_ROLE insertPROBLEM_ROLE(int rep) throws HL7Exception { 
310           return (PTR_PCF_PROBLEM_ROLE)super.insertRepetition("PROBLEM_ROLE", rep);
311        }
312    
313    
314        /**
315         * Removes a specific repetition of PROBLEM_ROLE (a Group object)
316         * @see AbstractGroup#removeRepetition(String, int) 
317         */
318        public PTR_PCF_PROBLEM_ROLE removePROBLEM_ROLE(int rep) throws HL7Exception { 
319           return (PTR_PCF_PROBLEM_ROLE)super.removeRepetition("PROBLEM_ROLE", rep);
320        }
321    
322    
323    
324        /**
325         * Returns
326         * the first repetition of 
327         * PROBLEM_OBSERVATION (a Group object) - creates it if necessary
328         */
329        public PTR_PCF_PROBLEM_OBSERVATION getPROBLEM_OBSERVATION() { 
330           PTR_PCF_PROBLEM_OBSERVATION ret = null;
331           try {
332              ret = (PTR_PCF_PROBLEM_OBSERVATION)this.get("PROBLEM_OBSERVATION");
333           } catch(HL7Exception e) {
334              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
335              throw new RuntimeException(e);
336           }
337           return ret;
338        }
339    
340    
341        /**
342         * Returns a specific repetition of
343         * PROBLEM_OBSERVATION (a Group object) - creates it if necessary
344         *
345         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
346         * @throws HL7Exception if the repetition requested is more than one 
347         *     greater than the number of existing repetitions.
348         */
349        public PTR_PCF_PROBLEM_OBSERVATION getPROBLEM_OBSERVATION(int rep) { 
350           PTR_PCF_PROBLEM_OBSERVATION ret = null;
351           try {
352              ret = (PTR_PCF_PROBLEM_OBSERVATION)this.get("PROBLEM_OBSERVATION", rep);
353           } catch(HL7Exception e) {
354              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
355              throw new RuntimeException(e);
356           }
357           return ret;
358        }
359    
360        /** 
361         * Returns the number of existing repetitions of PROBLEM_OBSERVATION 
362         */ 
363        public int getPROBLEM_OBSERVATIONReps() { 
364            int reps = -1; 
365            try { 
366                reps = this.getAll("PROBLEM_OBSERVATION").length; 
367            } catch (HL7Exception e) { 
368                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
369                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
370                throw new RuntimeException(message);
371            } 
372            return reps; 
373        } 
374    
375        /**
376         * Inserts a specific repetition of PROBLEM_OBSERVATION (a Group object)
377         * @see AbstractGroup#insertRepetition(Structure, int) 
378         */
379        public void insertPROBLEM_OBSERVATION(PTR_PCF_PROBLEM_OBSERVATION structure, int rep) throws HL7Exception { 
380           super.insertRepetition("PROBLEM_OBSERVATION", structure, rep);
381        }
382    
383    
384        /**
385         * Inserts a specific repetition of PROBLEM_OBSERVATION (a Group object)
386         * @see AbstractGroup#insertRepetition(Structure, int) 
387         */
388        public PTR_PCF_PROBLEM_OBSERVATION insertPROBLEM_OBSERVATION(int rep) throws HL7Exception { 
389           return (PTR_PCF_PROBLEM_OBSERVATION)super.insertRepetition("PROBLEM_OBSERVATION", rep);
390        }
391    
392    
393        /**
394         * Removes a specific repetition of PROBLEM_OBSERVATION (a Group object)
395         * @see AbstractGroup#removeRepetition(String, int) 
396         */
397        public PTR_PCF_PROBLEM_OBSERVATION removePROBLEM_OBSERVATION(int rep) throws HL7Exception { 
398           return (PTR_PCF_PROBLEM_OBSERVATION)super.removeRepetition("PROBLEM_OBSERVATION", rep);
399        }
400    
401    
402    
403        /**
404         * Returns
405         * the first repetition of 
406         * GOAL (a Group object) - creates it if necessary
407         */
408        public PTR_PCF_GOAL getGOAL() { 
409           PTR_PCF_GOAL ret = null;
410           try {
411              ret = (PTR_PCF_GOAL)this.get("GOAL");
412           } catch(HL7Exception e) {
413              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
414              throw new RuntimeException(e);
415           }
416           return ret;
417        }
418    
419    
420        /**
421         * Returns a specific repetition of
422         * GOAL (a Group object) - creates it if necessary
423         *
424         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
425         * @throws HL7Exception if the repetition requested is more than one 
426         *     greater than the number of existing repetitions.
427         */
428        public PTR_PCF_GOAL getGOAL(int rep) { 
429           PTR_PCF_GOAL ret = null;
430           try {
431              ret = (PTR_PCF_GOAL)this.get("GOAL", rep);
432           } catch(HL7Exception e) {
433              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
434              throw new RuntimeException(e);
435           }
436           return ret;
437        }
438    
439        /** 
440         * Returns the number of existing repetitions of GOAL 
441         */ 
442        public int getGOALReps() { 
443            int reps = -1; 
444            try { 
445                reps = this.getAll("GOAL").length; 
446            } catch (HL7Exception e) { 
447                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
448                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
449                throw new RuntimeException(message);
450            } 
451            return reps; 
452        } 
453    
454        /**
455         * Inserts a specific repetition of GOAL (a Group object)
456         * @see AbstractGroup#insertRepetition(Structure, int) 
457         */
458        public void insertGOAL(PTR_PCF_GOAL structure, int rep) throws HL7Exception { 
459           super.insertRepetition("GOAL", structure, rep);
460        }
461    
462    
463        /**
464         * Inserts a specific repetition of GOAL (a Group object)
465         * @see AbstractGroup#insertRepetition(Structure, int) 
466         */
467        public PTR_PCF_GOAL insertGOAL(int rep) throws HL7Exception { 
468           return (PTR_PCF_GOAL)super.insertRepetition("GOAL", rep);
469        }
470    
471    
472        /**
473         * Removes a specific repetition of GOAL (a Group object)
474         * @see AbstractGroup#removeRepetition(String, int) 
475         */
476        public PTR_PCF_GOAL removeGOAL(int rep) throws HL7Exception { 
477           return (PTR_PCF_GOAL)super.removeRepetition("GOAL", rep);
478        }
479    
480    
481    
482        /**
483         * Returns
484         * the first repetition of 
485         * ORDER (a Group object) - creates it if necessary
486         */
487        public PTR_PCF_ORDER getORDER() { 
488           PTR_PCF_ORDER ret = null;
489           try {
490              ret = (PTR_PCF_ORDER)this.get("ORDER");
491           } catch(HL7Exception e) {
492              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
493              throw new RuntimeException(e);
494           }
495           return ret;
496        }
497    
498    
499        /**
500         * Returns a specific repetition of
501         * ORDER (a Group object) - creates it if necessary
502         *
503         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
504         * @throws HL7Exception if the repetition requested is more than one 
505         *     greater than the number of existing repetitions.
506         */
507        public PTR_PCF_ORDER getORDER(int rep) { 
508           PTR_PCF_ORDER ret = null;
509           try {
510              ret = (PTR_PCF_ORDER)this.get("ORDER", rep);
511           } catch(HL7Exception e) {
512              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
513              throw new RuntimeException(e);
514           }
515           return ret;
516        }
517    
518        /** 
519         * Returns the number of existing repetitions of ORDER 
520         */ 
521        public int getORDERReps() { 
522            int reps = -1; 
523            try { 
524                reps = this.getAll("ORDER").length; 
525            } catch (HL7Exception e) { 
526                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
527                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
528                throw new RuntimeException(message);
529            } 
530            return reps; 
531        } 
532    
533        /**
534         * Inserts a specific repetition of ORDER (a Group object)
535         * @see AbstractGroup#insertRepetition(Structure, int) 
536         */
537        public void insertORDER(PTR_PCF_ORDER structure, int rep) throws HL7Exception { 
538           super.insertRepetition("ORDER", structure, rep);
539        }
540    
541    
542        /**
543         * Inserts a specific repetition of ORDER (a Group object)
544         * @see AbstractGroup#insertRepetition(Structure, int) 
545         */
546        public PTR_PCF_ORDER insertORDER(int rep) throws HL7Exception { 
547           return (PTR_PCF_ORDER)super.insertRepetition("ORDER", rep);
548        }
549    
550    
551        /**
552         * Removes a specific repetition of ORDER (a Group object)
553         * @see AbstractGroup#removeRepetition(String, int) 
554         */
555        public PTR_PCF_ORDER removeORDER(int rep) throws HL7Exception { 
556           return (PTR_PCF_ORDER)super.removeRepetition("ORDER", rep);
557        }
558    
559    
560    
561    }
562