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