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.v231.segment;
009    
010    // import ca.uhn.hl7v2.model.v231.group.*;
011    import ca.uhn.hl7v2.model.v231.datatype.*;
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.Type;
019    import ca.uhn.hl7v2.model.AbstractSegment;
020    import ca.uhn.hl7v2.model.Varies;
021    
022    /**
023     *<p>Represents an HL7 LDP message segment (LDP - location department segment). 
024     * This segment has the following fields:</p>
025     * <ul>
026         * <li>LDP-1: Primary Key Value - LDP (PL) <b> </b>
027         * <li>LDP-2: Location Department (IS) <b> </b>
028         * <li>LDP-3: Location Service (IS) <b>optional repeating</b>
029         * <li>LDP-4: Specialty Type (CE) <b>optional repeating</b>
030         * <li>LDP-5: Valid Patient Classes (IS) <b>optional repeating</b>
031         * <li>LDP-6: Active/Inactive Flag (ID) <b>optional </b>
032         * <li>LDP-7: Activation Date  LDP (TS) <b>optional </b>
033         * <li>LDP-8: Inactivation Date - LDP (TS) <b>optional </b>
034         * <li>LDP-9: Inactivated Reason (ST) <b>optional </b>
035         * <li>LDP-10: Visiting Hours (VH) <b>optional repeating</b>
036         * <li>LDP-11: Contact Phone (XTN) <b>optional </b>
037     * </ul>
038     */
039    public class LDP extends AbstractSegment {
040    
041        /** 
042         * Creates a new LDP segment
043         */
044        public LDP(Group parent, ModelClassFactory factory) {
045           super(parent, factory);
046           init(factory);
047        }
048    
049        private void init(ModelClassFactory factory) {
050           try {
051                                      this.add(PL.class, true, 1, 200, new Object[]{ getMessage(), new Integer(0) }, "Primary Key Value - LDP");
052                                      this.add(IS.class, true, 1, 10, new Object[]{ getMessage() }, "Location Department");
053                                      this.add(IS.class, false, 0, 3, new Object[]{ getMessage() }, "Location Service");
054                                      this.add(CE.class, false, 0, 60, new Object[]{ getMessage(), new Integer(265) }, "Specialty Type");
055                                      this.add(IS.class, false, 0, 1, new Object[]{ getMessage() }, "Valid Patient Classes");
056                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Active/Inactive Flag");
057                                      this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Activation Date  LDP");
058                                      this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Inactivation Date - LDP");
059                                      this.add(ST.class, false, 1, 80, new Object[]{ getMessage(), new Integer(0) }, "Inactivated Reason");
060                                      this.add(VH.class, false, 0, 80, new Object[]{ getMessage(), new Integer(267) }, "Visiting Hours");
061                                      this.add(XTN.class, false, 1, 40, new Object[]{ getMessage(), new Integer(0) }, "Contact Phone");
062           } catch(HL7Exception e) {
063              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating LDP - this is probably a bug in the source code generator.", e);
064           }
065        }
066    
067    
068    
069        /**
070         * Returns
071         * LDP-1: "Primary Key Value - LDP" - creates it if necessary
072         */
073        public PL getPrimaryKeyValueLDP() { 
074            PL ret = null;
075            try {
076                Type t = this.getField(1, 0);
077                ret = (PL)t;
078            } catch (ClassCastException cce) {
079                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
080                throw new RuntimeException(cce);
081            } catch (HL7Exception he) {
082                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
083                throw new RuntimeException(he);
084            }
085            return ret;
086        }
087    
088    
089        /**
090         * Returns
091         * LDP-1: "Primary Key Value - LDP" - creates it if necessary
092         */
093        public PL getLdp1_PrimaryKeyValueLDP() { 
094            PL ret = null;
095            try {
096                Type t = this.getField(1, 0);
097                ret = (PL)t;
098            } catch (ClassCastException cce) {
099                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
100                throw new RuntimeException(cce);
101            } catch (HL7Exception he) {
102                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
103                throw new RuntimeException(he);
104            }
105            return ret;
106        }
107    
108    
109    
110        /**
111         * Returns
112         * LDP-2: "Location Department" - creates it if necessary
113         */
114        public IS getLocationDepartment() { 
115            IS ret = null;
116            try {
117                Type t = this.getField(2, 0);
118                ret = (IS)t;
119            } catch (ClassCastException cce) {
120                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
121                throw new RuntimeException(cce);
122            } catch (HL7Exception he) {
123                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
124                throw new RuntimeException(he);
125            }
126            return ret;
127        }
128    
129    
130        /**
131         * Returns
132         * LDP-2: "Location Department" - creates it if necessary
133         */
134        public IS getLdp2_LocationDepartment() { 
135            IS ret = null;
136            try {
137                Type t = this.getField(2, 0);
138                ret = (IS)t;
139            } catch (ClassCastException cce) {
140                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
141                throw new RuntimeException(cce);
142            } catch (HL7Exception he) {
143                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
144                throw new RuntimeException(he);
145            }
146            return ret;
147        }
148    
149    
150        /**
151         * Returns all repetitions of Location Service (LDP-3).
152         */
153        public IS[] getLocationService() {
154            IS[] ret = null;
155            try {
156                Type[] t = this.getField(3);  
157                ret = new IS[t.length];
158                for (int i = 0; i < ret.length; i++) {
159                    ret[i] = (IS)t[i];
160                }
161            } catch (ClassCastException cce) {
162                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
163                throw new RuntimeException(cce);
164            } catch (HL7Exception he) {
165                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
166                throw new RuntimeException(he);
167            }
168            return ret;
169        }
170    
171    
172        /**
173         * Returns a count of the current number of repetitions of Location Service (LDP-3).
174         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
175         * it will return zero.
176         */
177        public int getLocationServiceReps() {
178            IS[] ret = null;
179            try {
180                Type[] t = this.getField(3);
181                return t.length;  
182            } catch (ClassCastException cce) {
183                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
184                throw new RuntimeException(cce);
185            } catch (HL7Exception he) {
186                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
187                throw new RuntimeException(he);
188            }
189        }
190    
191    
192        /**
193         * Returns a specific repetition of
194         * LDP-3: "Location Service" - creates it if necessary
195         *
196         * @param rep The repetition index (0-indexed)
197         */
198        public IS getLocationService(int rep) { 
199            IS ret = null;
200            try {
201                Type t = this.getField(3, rep);
202                ret = (IS)t;
203            } catch (ClassCastException cce) {
204                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
205                throw new RuntimeException(cce);
206            } catch (HL7Exception he) {
207                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
208                throw new RuntimeException(he);
209            }
210            return ret;
211        }
212    
213        /**
214         * Returns a specific repetition of
215         * LDP-3: "Location Service" - creates it if necessary
216         *
217         * @param rep The repetition index (0-indexed)
218         */
219        public IS getLdp3_LocationService(int rep) { 
220            IS ret = null;
221            try {
222                Type t = this.getField(3, rep);
223                ret = (IS)t;
224            } catch (ClassCastException cce) {
225                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
226                throw new RuntimeException(cce);
227            } catch (HL7Exception he) {
228                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
229                throw new RuntimeException(he);
230            }
231            return ret;
232        }
233    
234    
235        /**
236         * Returns a count of the current number of repetitions of Location Service (LDP-3).
237         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
238         * it will return zero.
239         */
240        public int getLdp3_LocationServiceReps() {
241            IS[] ret = null;
242            try {
243                Type[] t = this.getField(3);
244                return t.length;  
245            } catch (ClassCastException cce) {
246                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
247                throw new RuntimeException(cce);
248            } catch (HL7Exception he) {
249                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
250                throw new RuntimeException(he);
251            }
252        }
253    
254    
255    
256        /**
257         * Inserts a repetition of
258         * LDP-3: "Location Service" at a specific index
259         *
260         * @param rep The repetition index (0-indexed)
261         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
262         */
263        public IS insertLocationService(int rep) throws HL7Exception { 
264            return (IS) super.insertRepetition(3, rep);
265        }
266    
267    
268    
269        /**
270         * Inserts a repetition of
271         * LDP-3: "Location Service" at a specific index
272         *
273         * @param rep The repetition index (0-indexed)
274         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
275         */
276        public IS insertLdp3_LocationService(int rep) throws HL7Exception { 
277            return (IS) super.insertRepetition(3, rep);
278        }
279    
280    
281        /**
282         * Removes a repetition of
283         * LDP-3: "Location Service" at a specific index
284         *
285         * @param rep The repetition index (0-indexed)
286         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
287         */
288        public IS removeLocationService(int rep) throws HL7Exception { 
289            return (IS) super.removeRepetition(3, rep);
290        }
291    
292    
293        /**
294         * Removes a repetition of
295         * LDP-3: "Location Service" at a specific index
296         *
297         * @param rep The repetition index (0-indexed)
298         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
299         */
300        public IS removeLdp3_LocationService(int rep) throws HL7Exception { 
301            return (IS) super.removeRepetition(3, rep);
302        }
303    
304    
305    
306        /**
307         * Returns all repetitions of Specialty Type (LDP-4).
308         */
309        public CE[] getSpecialtyType() {
310            CE[] ret = null;
311            try {
312                Type[] t = this.getField(4);  
313                ret = new CE[t.length];
314                for (int i = 0; i < ret.length; i++) {
315                    ret[i] = (CE)t[i];
316                }
317            } catch (ClassCastException cce) {
318                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
319                throw new RuntimeException(cce);
320            } catch (HL7Exception he) {
321                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
322                throw new RuntimeException(he);
323            }
324            return ret;
325        }
326    
327    
328        /**
329         * Returns a count of the current number of repetitions of Specialty Type (LDP-4).
330         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
331         * it will return zero.
332         */
333        public int getSpecialtyTypeReps() {
334            CE[] ret = null;
335            try {
336                Type[] t = this.getField(4);
337                return t.length;  
338            } catch (ClassCastException cce) {
339                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
340                throw new RuntimeException(cce);
341            } catch (HL7Exception he) {
342                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
343                throw new RuntimeException(he);
344            }
345        }
346    
347    
348        /**
349         * Returns a specific repetition of
350         * LDP-4: "Specialty Type" - creates it if necessary
351         *
352         * @param rep The repetition index (0-indexed)
353         */
354        public CE getSpecialtyType(int rep) { 
355            CE ret = null;
356            try {
357                Type t = this.getField(4, rep);
358                ret = (CE)t;
359            } catch (ClassCastException cce) {
360                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
361                throw new RuntimeException(cce);
362            } catch (HL7Exception he) {
363                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
364                throw new RuntimeException(he);
365            }
366            return ret;
367        }
368    
369        /**
370         * Returns a specific repetition of
371         * LDP-4: "Specialty Type" - creates it if necessary
372         *
373         * @param rep The repetition index (0-indexed)
374         */
375        public CE getLdp4_SpecialtyType(int rep) { 
376            CE ret = null;
377            try {
378                Type t = this.getField(4, rep);
379                ret = (CE)t;
380            } catch (ClassCastException cce) {
381                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
382                throw new RuntimeException(cce);
383            } catch (HL7Exception he) {
384                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
385                throw new RuntimeException(he);
386            }
387            return ret;
388        }
389    
390    
391        /**
392         * Returns a count of the current number of repetitions of Specialty Type (LDP-4).
393         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
394         * it will return zero.
395         */
396        public int getLdp4_SpecialtyTypeReps() {
397            CE[] ret = null;
398            try {
399                Type[] t = this.getField(4);
400                return t.length;  
401            } catch (ClassCastException cce) {
402                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
403                throw new RuntimeException(cce);
404            } catch (HL7Exception he) {
405                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
406                throw new RuntimeException(he);
407            }
408        }
409    
410    
411    
412        /**
413         * Inserts a repetition of
414         * LDP-4: "Specialty Type" at a specific index
415         *
416         * @param rep The repetition index (0-indexed)
417         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
418         */
419        public CE insertSpecialtyType(int rep) throws HL7Exception { 
420            return (CE) super.insertRepetition(4, rep);
421        }
422    
423    
424    
425        /**
426         * Inserts a repetition of
427         * LDP-4: "Specialty Type" at a specific index
428         *
429         * @param rep The repetition index (0-indexed)
430         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
431         */
432        public CE insertLdp4_SpecialtyType(int rep) throws HL7Exception { 
433            return (CE) super.insertRepetition(4, rep);
434        }
435    
436    
437        /**
438         * Removes a repetition of
439         * LDP-4: "Specialty Type" at a specific index
440         *
441         * @param rep The repetition index (0-indexed)
442         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
443         */
444        public CE removeSpecialtyType(int rep) throws HL7Exception { 
445            return (CE) super.removeRepetition(4, rep);
446        }
447    
448    
449        /**
450         * Removes a repetition of
451         * LDP-4: "Specialty Type" at a specific index
452         *
453         * @param rep The repetition index (0-indexed)
454         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
455         */
456        public CE removeLdp4_SpecialtyType(int rep) throws HL7Exception { 
457            return (CE) super.removeRepetition(4, rep);
458        }
459    
460    
461    
462        /**
463         * Returns all repetitions of Valid Patient Classes (LDP-5).
464         */
465        public IS[] getValidPatientClasses() {
466            IS[] ret = null;
467            try {
468                Type[] t = this.getField(5);  
469                ret = new IS[t.length];
470                for (int i = 0; i < ret.length; i++) {
471                    ret[i] = (IS)t[i];
472                }
473            } catch (ClassCastException cce) {
474                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
475                throw new RuntimeException(cce);
476            } catch (HL7Exception he) {
477                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
478                throw new RuntimeException(he);
479            }
480            return ret;
481        }
482    
483    
484        /**
485         * Returns a count of the current number of repetitions of Valid Patient Classes (LDP-5).
486         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
487         * it will return zero.
488         */
489        public int getValidPatientClassesReps() {
490            IS[] ret = null;
491            try {
492                Type[] t = this.getField(5);
493                return t.length;  
494            } catch (ClassCastException cce) {
495                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
496                throw new RuntimeException(cce);
497            } catch (HL7Exception he) {
498                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
499                throw new RuntimeException(he);
500            }
501        }
502    
503    
504        /**
505         * Returns a specific repetition of
506         * LDP-5: "Valid Patient Classes" - creates it if necessary
507         *
508         * @param rep The repetition index (0-indexed)
509         */
510        public IS getValidPatientClasses(int rep) { 
511            IS ret = null;
512            try {
513                Type t = this.getField(5, rep);
514                ret = (IS)t;
515            } catch (ClassCastException cce) {
516                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
517                throw new RuntimeException(cce);
518            } catch (HL7Exception he) {
519                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
520                throw new RuntimeException(he);
521            }
522            return ret;
523        }
524    
525        /**
526         * Returns a specific repetition of
527         * LDP-5: "Valid Patient Classes" - creates it if necessary
528         *
529         * @param rep The repetition index (0-indexed)
530         */
531        public IS getLdp5_ValidPatientClasses(int rep) { 
532            IS ret = null;
533            try {
534                Type t = this.getField(5, rep);
535                ret = (IS)t;
536            } catch (ClassCastException cce) {
537                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
538                throw new RuntimeException(cce);
539            } catch (HL7Exception he) {
540                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
541                throw new RuntimeException(he);
542            }
543            return ret;
544        }
545    
546    
547        /**
548         * Returns a count of the current number of repetitions of Valid Patient Classes (LDP-5).
549         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
550         * it will return zero.
551         */
552        public int getLdp5_ValidPatientClassesReps() {
553            IS[] ret = null;
554            try {
555                Type[] t = this.getField(5);
556                return t.length;  
557            } catch (ClassCastException cce) {
558                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
559                throw new RuntimeException(cce);
560            } catch (HL7Exception he) {
561                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
562                throw new RuntimeException(he);
563            }
564        }
565    
566    
567    
568        /**
569         * Inserts a repetition of
570         * LDP-5: "Valid Patient Classes" at a specific index
571         *
572         * @param rep The repetition index (0-indexed)
573         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
574         */
575        public IS insertValidPatientClasses(int rep) throws HL7Exception { 
576            return (IS) super.insertRepetition(5, rep);
577        }
578    
579    
580    
581        /**
582         * Inserts a repetition of
583         * LDP-5: "Valid Patient Classes" at a specific index
584         *
585         * @param rep The repetition index (0-indexed)
586         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
587         */
588        public IS insertLdp5_ValidPatientClasses(int rep) throws HL7Exception { 
589            return (IS) super.insertRepetition(5, rep);
590        }
591    
592    
593        /**
594         * Removes a repetition of
595         * LDP-5: "Valid Patient Classes" at a specific index
596         *
597         * @param rep The repetition index (0-indexed)
598         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
599         */
600        public IS removeValidPatientClasses(int rep) throws HL7Exception { 
601            return (IS) super.removeRepetition(5, rep);
602        }
603    
604    
605        /**
606         * Removes a repetition of
607         * LDP-5: "Valid Patient Classes" at a specific index
608         *
609         * @param rep The repetition index (0-indexed)
610         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
611         */
612        public IS removeLdp5_ValidPatientClasses(int rep) throws HL7Exception { 
613            return (IS) super.removeRepetition(5, rep);
614        }
615    
616    
617    
618    
619        /**
620         * Returns
621         * LDP-6: "Active/Inactive Flag" - creates it if necessary
622         */
623        public ID getActiveInactiveFlag() { 
624            ID ret = null;
625            try {
626                Type t = this.getField(6, 0);
627                ret = (ID)t;
628            } catch (ClassCastException cce) {
629                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
630                throw new RuntimeException(cce);
631            } catch (HL7Exception he) {
632                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
633                throw new RuntimeException(he);
634            }
635            return ret;
636        }
637    
638    
639        /**
640         * Returns
641         * LDP-6: "Active/Inactive Flag" - creates it if necessary
642         */
643        public ID getLdp6_ActiveInactiveFlag() { 
644            ID ret = null;
645            try {
646                Type t = this.getField(6, 0);
647                ret = (ID)t;
648            } catch (ClassCastException cce) {
649                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
650                throw new RuntimeException(cce);
651            } catch (HL7Exception he) {
652                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
653                throw new RuntimeException(he);
654            }
655            return ret;
656        }
657    
658    
659    
660        /**
661         * Returns
662         * LDP-7: "Activation Date  LDP" - creates it if necessary
663         */
664        public TS getActivationDateLDP() { 
665            TS ret = null;
666            try {
667                Type t = this.getField(7, 0);
668                ret = (TS)t;
669            } catch (ClassCastException cce) {
670                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
671                throw new RuntimeException(cce);
672            } catch (HL7Exception he) {
673                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
674                throw new RuntimeException(he);
675            }
676            return ret;
677        }
678    
679    
680        /**
681         * Returns
682         * LDP-7: "Activation Date  LDP" - creates it if necessary
683         */
684        public TS getLdp7_ActivationDateLDP() { 
685            TS ret = null;
686            try {
687                Type t = this.getField(7, 0);
688                ret = (TS)t;
689            } catch (ClassCastException cce) {
690                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
691                throw new RuntimeException(cce);
692            } catch (HL7Exception he) {
693                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
694                throw new RuntimeException(he);
695            }
696            return ret;
697        }
698    
699    
700    
701        /**
702         * Returns
703         * LDP-8: "Inactivation Date - LDP" - creates it if necessary
704         */
705        public TS getInactivationDateLDP() { 
706            TS ret = null;
707            try {
708                Type t = this.getField(8, 0);
709                ret = (TS)t;
710            } catch (ClassCastException cce) {
711                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
712                throw new RuntimeException(cce);
713            } catch (HL7Exception he) {
714                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
715                throw new RuntimeException(he);
716            }
717            return ret;
718        }
719    
720    
721        /**
722         * Returns
723         * LDP-8: "Inactivation Date - LDP" - creates it if necessary
724         */
725        public TS getLdp8_InactivationDateLDP() { 
726            TS ret = null;
727            try {
728                Type t = this.getField(8, 0);
729                ret = (TS)t;
730            } catch (ClassCastException cce) {
731                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
732                throw new RuntimeException(cce);
733            } catch (HL7Exception he) {
734                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
735                throw new RuntimeException(he);
736            }
737            return ret;
738        }
739    
740    
741    
742        /**
743         * Returns
744         * LDP-9: "Inactivated Reason" - creates it if necessary
745         */
746        public ST getInactivatedReason() { 
747            ST ret = null;
748            try {
749                Type t = this.getField(9, 0);
750                ret = (ST)t;
751            } catch (ClassCastException cce) {
752                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
753                throw new RuntimeException(cce);
754            } catch (HL7Exception he) {
755                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
756                throw new RuntimeException(he);
757            }
758            return ret;
759        }
760    
761    
762        /**
763         * Returns
764         * LDP-9: "Inactivated Reason" - creates it if necessary
765         */
766        public ST getLdp9_InactivatedReason() { 
767            ST ret = null;
768            try {
769                Type t = this.getField(9, 0);
770                ret = (ST)t;
771            } catch (ClassCastException cce) {
772                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
773                throw new RuntimeException(cce);
774            } catch (HL7Exception he) {
775                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
776                throw new RuntimeException(he);
777            }
778            return ret;
779        }
780    
781    
782        /**
783         * Returns all repetitions of Visiting Hours (LDP-10).
784         */
785        public VH[] getVisitingHours() {
786            VH[] ret = null;
787            try {
788                Type[] t = this.getField(10);  
789                ret = new VH[t.length];
790                for (int i = 0; i < ret.length; i++) {
791                    ret[i] = (VH)t[i];
792                }
793            } catch (ClassCastException cce) {
794                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
795                throw new RuntimeException(cce);
796            } catch (HL7Exception he) {
797                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
798                throw new RuntimeException(he);
799            }
800            return ret;
801        }
802    
803    
804        /**
805         * Returns a count of the current number of repetitions of Visiting Hours (LDP-10).
806         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
807         * it will return zero.
808         */
809        public int getVisitingHoursReps() {
810            VH[] ret = null;
811            try {
812                Type[] t = this.getField(10);
813                return t.length;  
814            } catch (ClassCastException cce) {
815                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
816                throw new RuntimeException(cce);
817            } catch (HL7Exception he) {
818                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
819                throw new RuntimeException(he);
820            }
821        }
822    
823    
824        /**
825         * Returns a specific repetition of
826         * LDP-10: "Visiting Hours" - creates it if necessary
827         *
828         * @param rep The repetition index (0-indexed)
829         */
830        public VH getVisitingHours(int rep) { 
831            VH ret = null;
832            try {
833                Type t = this.getField(10, rep);
834                ret = (VH)t;
835            } catch (ClassCastException cce) {
836                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
837                throw new RuntimeException(cce);
838            } catch (HL7Exception he) {
839                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
840                throw new RuntimeException(he);
841            }
842            return ret;
843        }
844    
845        /**
846         * Returns a specific repetition of
847         * LDP-10: "Visiting Hours" - creates it if necessary
848         *
849         * @param rep The repetition index (0-indexed)
850         */
851        public VH getLdp10_VisitingHours(int rep) { 
852            VH ret = null;
853            try {
854                Type t = this.getField(10, rep);
855                ret = (VH)t;
856            } catch (ClassCastException cce) {
857                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
858                throw new RuntimeException(cce);
859            } catch (HL7Exception he) {
860                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
861                throw new RuntimeException(he);
862            }
863            return ret;
864        }
865    
866    
867        /**
868         * Returns a count of the current number of repetitions of Visiting Hours (LDP-10).
869         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
870         * it will return zero.
871         */
872        public int getLdp10_VisitingHoursReps() {
873            VH[] ret = null;
874            try {
875                Type[] t = this.getField(10);
876                return t.length;  
877            } catch (ClassCastException cce) {
878                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
879                throw new RuntimeException(cce);
880            } catch (HL7Exception he) {
881                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
882                throw new RuntimeException(he);
883            }
884        }
885    
886    
887    
888        /**
889         * Inserts a repetition of
890         * LDP-10: "Visiting Hours" at a specific index
891         *
892         * @param rep The repetition index (0-indexed)
893         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
894         */
895        public VH insertVisitingHours(int rep) throws HL7Exception { 
896            return (VH) super.insertRepetition(10, rep);
897        }
898    
899    
900    
901        /**
902         * Inserts a repetition of
903         * LDP-10: "Visiting Hours" at a specific index
904         *
905         * @param rep The repetition index (0-indexed)
906         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
907         */
908        public VH insertLdp10_VisitingHours(int rep) throws HL7Exception { 
909            return (VH) super.insertRepetition(10, rep);
910        }
911    
912    
913        /**
914         * Removes a repetition of
915         * LDP-10: "Visiting Hours" at a specific index
916         *
917         * @param rep The repetition index (0-indexed)
918         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
919         */
920        public VH removeVisitingHours(int rep) throws HL7Exception { 
921            return (VH) super.removeRepetition(10, rep);
922        }
923    
924    
925        /**
926         * Removes a repetition of
927         * LDP-10: "Visiting Hours" at a specific index
928         *
929         * @param rep The repetition index (0-indexed)
930         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
931         */
932        public VH removeLdp10_VisitingHours(int rep) throws HL7Exception { 
933            return (VH) super.removeRepetition(10, rep);
934        }
935    
936    
937    
938    
939        /**
940         * Returns
941         * LDP-11: "Contact Phone" - creates it if necessary
942         */
943        public XTN getContactPhone() { 
944            XTN ret = null;
945            try {
946                Type t = this.getField(11, 0);
947                ret = (XTN)t;
948            } catch (ClassCastException cce) {
949                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
950                throw new RuntimeException(cce);
951            } catch (HL7Exception he) {
952                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
953                throw new RuntimeException(he);
954            }
955            return ret;
956        }
957    
958    
959        /**
960         * Returns
961         * LDP-11: "Contact Phone" - creates it if necessary
962         */
963        public XTN getLdp11_ContactPhone() { 
964            XTN ret = null;
965            try {
966                Type t = this.getField(11, 0);
967                ret = (XTN)t;
968            } catch (ClassCastException cce) {
969                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
970                throw new RuntimeException(cce);
971            } catch (HL7Exception he) {
972                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
973                throw new RuntimeException(he);
974            }
975            return ret;
976        }
977    
978    
979    
980    
981    
982        /** {@inheritDoc} */   
983        protected Type createNewTypeWithoutReflection(int field) {
984           switch (field) {
985              case 0: return new PL(getMessage());
986              case 1: return new IS(getMessage(), new Integer( 264 ));
987              case 2: return new IS(getMessage(), new Integer( 69 ));
988              case 3: return new CE(getMessage());
989              case 4: return new IS(getMessage(), new Integer( 4 ));
990              case 5: return new ID(getMessage(), new Integer( 183 ));
991              case 6: return new TS(getMessage());
992              case 7: return new TS(getMessage());
993              case 8: return new ST(getMessage());
994              case 9: return new VH(getMessage());
995              case 10: return new XTN(getMessage());
996              default: return null;
997           }
998       }
999    
1000    
1001    }
1002