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