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