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