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 AUT message segment (Authorization Information). 
024     * This segment has the following fields:</p>
025     * <ul>
026         * <li>AUT-1: Authorizing Payor, Plan ID (CE) <b>optional </b>
027         * <li>AUT-2: Authorizing Payor, Company ID (CE) <b> </b>
028         * <li>AUT-3: Authorizing Payor, Company Name (ST) <b>optional </b>
029         * <li>AUT-4: Authorization Effective Date (TS) <b>optional </b>
030         * <li>AUT-5: Authorization Expiration Date (TS) <b>optional </b>
031         * <li>AUT-6: Authorization Identifier (EI) <b>optional </b>
032         * <li>AUT-7: Reimbursement Limit (CP) <b>optional </b>
033         * <li>AUT-8: Requested Number of Treatments (NM) <b>optional </b>
034         * <li>AUT-9: Authorized Number of Treatments (NM) <b>optional </b>
035         * <li>AUT-10: Process Date (TS) <b>optional </b>
036     * </ul>
037     */
038    public class AUT extends AbstractSegment {
039    
040        /** 
041         * Creates a new AUT segment
042         */
043        public AUT(Group parent, ModelClassFactory factory) {
044           super(parent, factory);
045           init(factory);
046        }
047    
048        private void init(ModelClassFactory factory) {
049           try {
050                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(72) }, "Authorizing Payor, Plan ID");
051                                      this.add(CE.class, true, 1, 250, new Object[]{ getMessage(), new Integer(285) }, "Authorizing Payor, Company ID");
052                                      this.add(ST.class, false, 1, 45, new Object[]{ getMessage(), new Integer(0) }, "Authorizing Payor, Company Name");
053                                      this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Authorization Effective Date");
054                                      this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Authorization Expiration Date");
055                                      this.add(EI.class, false, 1, 30, new Object[]{ getMessage(), new Integer(0) }, "Authorization Identifier");
056                                      this.add(CP.class, false, 1, 25, new Object[]{ getMessage(), new Integer(0) }, "Reimbursement Limit");
057                                      this.add(NM.class, false, 1, 2, new Object[]{ getMessage(), new Integer(0) }, "Requested Number of Treatments");
058                                      this.add(NM.class, false, 1, 2, new Object[]{ getMessage(), new Integer(0) }, "Authorized Number of Treatments");
059                                      this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Process Date");
060           } catch(HL7Exception e) {
061              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating AUT - this is probably a bug in the source code generator.", e);
062           }
063        }
064    
065    
066    
067        /**
068         * Returns
069         * AUT-1: "Authorizing Payor, Plan ID" - creates it if necessary
070         */
071        public CE getAuthorizingPayorPlanID() { 
072            CE ret = null;
073            try {
074                Type t = this.getField(1, 0);
075                ret = (CE)t;
076            } catch (ClassCastException cce) {
077                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
078                throw new RuntimeException(cce);
079            } catch (HL7Exception he) {
080                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
081                throw new RuntimeException(he);
082            }
083            return ret;
084        }
085    
086    
087        /**
088         * Returns
089         * AUT-1: "Authorizing Payor, Plan ID" - creates it if necessary
090         */
091        public CE getAut1_AuthorizingPayorPlanID() { 
092            CE ret = null;
093            try {
094                Type t = this.getField(1, 0);
095                ret = (CE)t;
096            } catch (ClassCastException cce) {
097                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
098                throw new RuntimeException(cce);
099            } catch (HL7Exception he) {
100                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
101                throw new RuntimeException(he);
102            }
103            return ret;
104        }
105    
106    
107    
108        /**
109         * Returns
110         * AUT-2: "Authorizing Payor, Company ID" - creates it if necessary
111         */
112        public CE getAuthorizingPayorCompanyID() { 
113            CE ret = null;
114            try {
115                Type t = this.getField(2, 0);
116                ret = (CE)t;
117            } catch (ClassCastException cce) {
118                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
119                throw new RuntimeException(cce);
120            } catch (HL7Exception he) {
121                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
122                throw new RuntimeException(he);
123            }
124            return ret;
125        }
126    
127    
128        /**
129         * Returns
130         * AUT-2: "Authorizing Payor, Company ID" - creates it if necessary
131         */
132        public CE getAut2_AuthorizingPayorCompanyID() { 
133            CE ret = null;
134            try {
135                Type t = this.getField(2, 0);
136                ret = (CE)t;
137            } catch (ClassCastException cce) {
138                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
139                throw new RuntimeException(cce);
140            } catch (HL7Exception he) {
141                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
142                throw new RuntimeException(he);
143            }
144            return ret;
145        }
146    
147    
148    
149        /**
150         * Returns
151         * AUT-3: "Authorizing Payor, Company Name" - creates it if necessary
152         */
153        public ST getAuthorizingPayorCompanyName() { 
154            ST ret = null;
155            try {
156                Type t = this.getField(3, 0);
157                ret = (ST)t;
158            } catch (ClassCastException cce) {
159                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
160                throw new RuntimeException(cce);
161            } catch (HL7Exception he) {
162                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
163                throw new RuntimeException(he);
164            }
165            return ret;
166        }
167    
168    
169        /**
170         * Returns
171         * AUT-3: "Authorizing Payor, Company Name" - creates it if necessary
172         */
173        public ST getAut3_AuthorizingPayorCompanyName() { 
174            ST ret = null;
175            try {
176                Type t = this.getField(3, 0);
177                ret = (ST)t;
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            return ret;
186        }
187    
188    
189    
190        /**
191         * Returns
192         * AUT-4: "Authorization Effective Date" - creates it if necessary
193         */
194        public TS getAuthorizationEffectiveDate() { 
195            TS ret = null;
196            try {
197                Type t = this.getField(4, 0);
198                ret = (TS)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        /**
211         * Returns
212         * AUT-4: "Authorization Effective Date" - creates it if necessary
213         */
214        public TS getAut4_AuthorizationEffectiveDate() { 
215            TS ret = null;
216            try {
217                Type t = this.getField(4, 0);
218                ret = (TS)t;
219            } catch (ClassCastException cce) {
220                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
221                throw new RuntimeException(cce);
222            } catch (HL7Exception he) {
223                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
224                throw new RuntimeException(he);
225            }
226            return ret;
227        }
228    
229    
230    
231        /**
232         * Returns
233         * AUT-5: "Authorization Expiration Date" - creates it if necessary
234         */
235        public TS getAuthorizationExpirationDate() { 
236            TS ret = null;
237            try {
238                Type t = this.getField(5, 0);
239                ret = (TS)t;
240            } catch (ClassCastException cce) {
241                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
242                throw new RuntimeException(cce);
243            } catch (HL7Exception he) {
244                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
245                throw new RuntimeException(he);
246            }
247            return ret;
248        }
249    
250    
251        /**
252         * Returns
253         * AUT-5: "Authorization Expiration Date" - creates it if necessary
254         */
255        public TS getAut5_AuthorizationExpirationDate() { 
256            TS ret = null;
257            try {
258                Type t = this.getField(5, 0);
259                ret = (TS)t;
260            } catch (ClassCastException cce) {
261                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
262                throw new RuntimeException(cce);
263            } catch (HL7Exception he) {
264                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
265                throw new RuntimeException(he);
266            }
267            return ret;
268        }
269    
270    
271    
272        /**
273         * Returns
274         * AUT-6: "Authorization Identifier" - creates it if necessary
275         */
276        public EI getAuthorizationIdentifier() { 
277            EI ret = null;
278            try {
279                Type t = this.getField(6, 0);
280                ret = (EI)t;
281            } catch (ClassCastException cce) {
282                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
283                throw new RuntimeException(cce);
284            } catch (HL7Exception he) {
285                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
286                throw new RuntimeException(he);
287            }
288            return ret;
289        }
290    
291    
292        /**
293         * Returns
294         * AUT-6: "Authorization Identifier" - creates it if necessary
295         */
296        public EI getAut6_AuthorizationIdentifier() { 
297            EI ret = null;
298            try {
299                Type t = this.getField(6, 0);
300                ret = (EI)t;
301            } catch (ClassCastException cce) {
302                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
303                throw new RuntimeException(cce);
304            } catch (HL7Exception he) {
305                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
306                throw new RuntimeException(he);
307            }
308            return ret;
309        }
310    
311    
312    
313        /**
314         * Returns
315         * AUT-7: "Reimbursement Limit" - creates it if necessary
316         */
317        public CP getReimbursementLimit() { 
318            CP ret = null;
319            try {
320                Type t = this.getField(7, 0);
321                ret = (CP)t;
322            } catch (ClassCastException cce) {
323                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
324                throw new RuntimeException(cce);
325            } catch (HL7Exception he) {
326                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
327                throw new RuntimeException(he);
328            }
329            return ret;
330        }
331    
332    
333        /**
334         * Returns
335         * AUT-7: "Reimbursement Limit" - creates it if necessary
336         */
337        public CP getAut7_ReimbursementLimit() { 
338            CP ret = null;
339            try {
340                Type t = this.getField(7, 0);
341                ret = (CP)t;
342            } catch (ClassCastException cce) {
343                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
344                throw new RuntimeException(cce);
345            } catch (HL7Exception he) {
346                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
347                throw new RuntimeException(he);
348            }
349            return ret;
350        }
351    
352    
353    
354        /**
355         * Returns
356         * AUT-8: "Requested Number of Treatments" - creates it if necessary
357         */
358        public NM getRequestedNumberOfTreatments() { 
359            NM ret = null;
360            try {
361                Type t = this.getField(8, 0);
362                ret = (NM)t;
363            } catch (ClassCastException cce) {
364                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
365                throw new RuntimeException(cce);
366            } catch (HL7Exception he) {
367                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
368                throw new RuntimeException(he);
369            }
370            return ret;
371        }
372    
373    
374        /**
375         * Returns
376         * AUT-8: "Requested Number of Treatments" - creates it if necessary
377         */
378        public NM getAut8_RequestedNumberOfTreatments() { 
379            NM ret = null;
380            try {
381                Type t = this.getField(8, 0);
382                ret = (NM)t;
383            } catch (ClassCastException cce) {
384                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
385                throw new RuntimeException(cce);
386            } catch (HL7Exception he) {
387                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
388                throw new RuntimeException(he);
389            }
390            return ret;
391        }
392    
393    
394    
395        /**
396         * Returns
397         * AUT-9: "Authorized Number of Treatments" - creates it if necessary
398         */
399        public NM getAuthorizedNumberOfTreatments() { 
400            NM ret = null;
401            try {
402                Type t = this.getField(9, 0);
403                ret = (NM)t;
404            } catch (ClassCastException cce) {
405                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
406                throw new RuntimeException(cce);
407            } catch (HL7Exception he) {
408                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
409                throw new RuntimeException(he);
410            }
411            return ret;
412        }
413    
414    
415        /**
416         * Returns
417         * AUT-9: "Authorized Number of Treatments" - creates it if necessary
418         */
419        public NM getAut9_AuthorizedNumberOfTreatments() { 
420            NM ret = null;
421            try {
422                Type t = this.getField(9, 0);
423                ret = (NM)t;
424            } catch (ClassCastException cce) {
425                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
426                throw new RuntimeException(cce);
427            } catch (HL7Exception he) {
428                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
429                throw new RuntimeException(he);
430            }
431            return ret;
432        }
433    
434    
435    
436        /**
437         * Returns
438         * AUT-10: "Process Date" - creates it if necessary
439         */
440        public TS getProcessDate() { 
441            TS ret = null;
442            try {
443                Type t = this.getField(10, 0);
444                ret = (TS)t;
445            } catch (ClassCastException cce) {
446                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
447                throw new RuntimeException(cce);
448            } catch (HL7Exception he) {
449                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
450                throw new RuntimeException(he);
451            }
452            return ret;
453        }
454    
455    
456        /**
457         * Returns
458         * AUT-10: "Process Date" - creates it if necessary
459         */
460        public TS getAut10_ProcessDate() { 
461            TS ret = null;
462            try {
463                Type t = this.getField(10, 0);
464                ret = (TS)t;
465            } catch (ClassCastException cce) {
466                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
467                throw new RuntimeException(cce);
468            } catch (HL7Exception he) {
469                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
470                throw new RuntimeException(he);
471            }
472            return ret;
473        }
474    
475    
476    
477    
478    
479        /** {@inheritDoc} */   
480        protected Type createNewTypeWithoutReflection(int field) {
481           switch (field) {
482              case 0: return new CE(getMessage());
483              case 1: return new CE(getMessage());
484              case 2: return new ST(getMessage());
485              case 3: return new TS(getMessage());
486              case 4: return new TS(getMessage());
487              case 5: return new EI(getMessage());
488              case 6: return new CP(getMessage());
489              case 7: return new NM(getMessage());
490              case 8: return new NM(getMessage());
491              case 9: return new TS(getMessage());
492              default: return null;
493           }
494       }
495    
496    
497    }
498