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