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.datatype;
009    
010    import ca.uhn.hl7v2.model.Composite;
011    import ca.uhn.hl7v2.model.DataTypeException;
012    import ca.uhn.hl7v2.model.Message;
013    import ca.uhn.hl7v2.model.Type;
014    import ca.uhn.hl7v2.model.AbstractType;
015    import ca.uhn.log.HapiLogFactory;
016    
017    /**
018     * <p>Represents an HL7 PPN (performing person time stamp) data type. 
019     * This type consists of the following components:</p>
020     * <ul>
021     * <li>ID number (ST) (ST)
022     * <li>family name (FN)
023     * <li>given name (ST)
024     * <li>second and further given names or initials thereof (ST)
025     * <li>suffix (e.g., JR or III) (ST)
026     * <li>prefix (e.g., DR) (ST)
027     * <li>degree (e.g., MD) (IS)
028     * <li>source table (IS)
029     * <li>assigning authority (HD)
030     * <li>name type code (ID)
031     * <li>identifier check digit (ST)
032     * <li>code identifying the check digit scheme employed (ID)
033     * <li>identifier type code (IS) (IS)
034     * <li>assigning facility (HD)
035     * <li>Date/Time Action Performed (TS)
036     * <li>Name Representation code (ID)
037     * <li>name context (CE)
038     * <li>name validity range (DR)
039     * <li>name assembly order (ID)
040     * </ul>
041     */
042    public class PPN extends AbstractType implements Composite {
043    
044        private Type[] data;
045    
046        /** 
047         * Creates a new PPN type
048         */
049        public PPN(Message message) {
050            super(message);
051            init();
052        }
053    
054        private void init() {
055            data = new Type[19];    
056            data[0] = new ST(getMessage());
057            data[1] = new FN(getMessage());
058            data[2] = new ST(getMessage());
059            data[3] = new ST(getMessage());
060            data[4] = new ST(getMessage());
061            data[5] = new ST(getMessage());
062            data[6] = new IS(getMessage(), 0);
063            data[7] = new IS(getMessage(), 0);
064            data[8] = new HD(getMessage());
065            data[9] = new ID(getMessage(), 0);
066            data[10] = new ST(getMessage());
067            data[11] = new ID(getMessage(), 0);
068            data[12] = new IS(getMessage(), 0);
069            data[13] = new HD(getMessage());
070            data[14] = new TS(getMessage());
071            data[15] = new ID(getMessage(), 0);
072            data[16] = new CE(getMessage());
073            data[17] = new DR(getMessage());
074            data[18] = new ID(getMessage(), 0);
075        }
076    
077    
078        /**
079         * Returns an array containing the data elements.
080         */
081        public Type[] getComponents() { 
082            return this.data; 
083        }
084    
085        /**
086         * Returns an individual data component.
087         *
088         * @param number The component number (0-indexed)
089         * @throws DataTypeException if the given element number is out of range.
090         */
091        public Type getComponent(int number) throws DataTypeException { 
092    
093            try { 
094                return this.data[number]; 
095            } catch (ArrayIndexOutOfBoundsException e) { 
096                throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)"); 
097            } 
098        } 
099    
100    
101        /**
102         * Returns ID number (ST) (component #1).  This is a convenience method that saves you from 
103         * casting and handling an exception.
104         */
105        public ST getIDNumber() {
106           ST ret = null;
107           try {
108              ret = (ST)getComponent(0);
109           } catch (DataTypeException e) {
110              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
111              throw new RuntimeException(e);
112           }
113           return ret;
114        }
115    
116        
117        /**
118         * Returns ID number (ST) (component #1).  This is a convenience method that saves you from 
119         * casting and handling an exception.
120         */
121        public ST getPpn1_IDNumber() {
122           ST ret = null;
123           try {
124              ret = (ST)getComponent(0);
125           } catch (DataTypeException e) {
126              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
127              throw new RuntimeException(e);
128           }
129           return ret;
130        }
131    
132    
133        /**
134         * Returns family name (component #2).  This is a convenience method that saves you from 
135         * casting and handling an exception.
136         */
137        public FN getFamilyName() {
138           FN ret = null;
139           try {
140              ret = (FN)getComponent(1);
141           } catch (DataTypeException e) {
142              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
143              throw new RuntimeException(e);
144           }
145           return ret;
146        }
147    
148        
149        /**
150         * Returns family name (component #2).  This is a convenience method that saves you from 
151         * casting and handling an exception.
152         */
153        public FN getPpn2_FamilyName() {
154           FN ret = null;
155           try {
156              ret = (FN)getComponent(1);
157           } catch (DataTypeException e) {
158              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
159              throw new RuntimeException(e);
160           }
161           return ret;
162        }
163    
164    
165        /**
166         * Returns given name (component #3).  This is a convenience method that saves you from 
167         * casting and handling an exception.
168         */
169        public ST getGivenName() {
170           ST ret = null;
171           try {
172              ret = (ST)getComponent(2);
173           } catch (DataTypeException e) {
174              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
175              throw new RuntimeException(e);
176           }
177           return ret;
178        }
179    
180        
181        /**
182         * Returns given name (component #3).  This is a convenience method that saves you from 
183         * casting and handling an exception.
184         */
185        public ST getPpn3_GivenName() {
186           ST ret = null;
187           try {
188              ret = (ST)getComponent(2);
189           } catch (DataTypeException e) {
190              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
191              throw new RuntimeException(e);
192           }
193           return ret;
194        }
195    
196    
197        /**
198         * Returns second and further given names or initials thereof (component #4).  This is a convenience method that saves you from 
199         * casting and handling an exception.
200         */
201        public ST getSecondAndFurtherGivenNamesOrInitialsThereof() {
202           ST ret = null;
203           try {
204              ret = (ST)getComponent(3);
205           } catch (DataTypeException e) {
206              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
207              throw new RuntimeException(e);
208           }
209           return ret;
210        }
211    
212        
213        /**
214         * Returns second and further given names or initials thereof (component #4).  This is a convenience method that saves you from 
215         * casting and handling an exception.
216         */
217        public ST getPpn4_SecondAndFurtherGivenNamesOrInitialsThereof() {
218           ST ret = null;
219           try {
220              ret = (ST)getComponent(3);
221           } catch (DataTypeException e) {
222              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
223              throw new RuntimeException(e);
224           }
225           return ret;
226        }
227    
228    
229        /**
230         * Returns suffix (e.g., JR or III) (component #5).  This is a convenience method that saves you from 
231         * casting and handling an exception.
232         */
233        public ST getSuffixEgJRorIII() {
234           ST ret = null;
235           try {
236              ret = (ST)getComponent(4);
237           } catch (DataTypeException e) {
238              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
239              throw new RuntimeException(e);
240           }
241           return ret;
242        }
243    
244        
245        /**
246         * Returns suffix (e.g., JR or III) (component #5).  This is a convenience method that saves you from 
247         * casting and handling an exception.
248         */
249        public ST getPpn5_SuffixEgJRorIII() {
250           ST ret = null;
251           try {
252              ret = (ST)getComponent(4);
253           } catch (DataTypeException e) {
254              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
255              throw new RuntimeException(e);
256           }
257           return ret;
258        }
259    
260    
261        /**
262         * Returns prefix (e.g., DR) (component #6).  This is a convenience method that saves you from 
263         * casting and handling an exception.
264         */
265        public ST getPrefixEgDR() {
266           ST ret = null;
267           try {
268              ret = (ST)getComponent(5);
269           } catch (DataTypeException e) {
270              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
271              throw new RuntimeException(e);
272           }
273           return ret;
274        }
275    
276        
277        /**
278         * Returns prefix (e.g., DR) (component #6).  This is a convenience method that saves you from 
279         * casting and handling an exception.
280         */
281        public ST getPpn6_PrefixEgDR() {
282           ST ret = null;
283           try {
284              ret = (ST)getComponent(5);
285           } catch (DataTypeException e) {
286              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
287              throw new RuntimeException(e);
288           }
289           return ret;
290        }
291    
292    
293        /**
294         * Returns degree (e.g., MD) (component #7).  This is a convenience method that saves you from 
295         * casting and handling an exception.
296         */
297        public IS getDegreeEgMD() {
298           IS ret = null;
299           try {
300              ret = (IS)getComponent(6);
301           } catch (DataTypeException e) {
302              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
303              throw new RuntimeException(e);
304           }
305           return ret;
306        }
307    
308        
309        /**
310         * Returns degree (e.g., MD) (component #7).  This is a convenience method that saves you from 
311         * casting and handling an exception.
312         */
313        public IS getPpn7_DegreeEgMD() {
314           IS ret = null;
315           try {
316              ret = (IS)getComponent(6);
317           } catch (DataTypeException e) {
318              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
319              throw new RuntimeException(e);
320           }
321           return ret;
322        }
323    
324    
325        /**
326         * Returns source table (component #8).  This is a convenience method that saves you from 
327         * casting and handling an exception.
328         */
329        public IS getSourceTable() {
330           IS ret = null;
331           try {
332              ret = (IS)getComponent(7);
333           } catch (DataTypeException e) {
334              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
335              throw new RuntimeException(e);
336           }
337           return ret;
338        }
339    
340        
341        /**
342         * Returns source table (component #8).  This is a convenience method that saves you from 
343         * casting and handling an exception.
344         */
345        public IS getPpn8_SourceTable() {
346           IS ret = null;
347           try {
348              ret = (IS)getComponent(7);
349           } catch (DataTypeException e) {
350              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
351              throw new RuntimeException(e);
352           }
353           return ret;
354        }
355    
356    
357        /**
358         * Returns assigning authority (component #9).  This is a convenience method that saves you from 
359         * casting and handling an exception.
360         */
361        public HD getAssigningAuthority() {
362           HD ret = null;
363           try {
364              ret = (HD)getComponent(8);
365           } catch (DataTypeException e) {
366              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
367              throw new RuntimeException(e);
368           }
369           return ret;
370        }
371    
372        
373        /**
374         * Returns assigning authority (component #9).  This is a convenience method that saves you from 
375         * casting and handling an exception.
376         */
377        public HD getPpn9_AssigningAuthority() {
378           HD ret = null;
379           try {
380              ret = (HD)getComponent(8);
381           } catch (DataTypeException e) {
382              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
383              throw new RuntimeException(e);
384           }
385           return ret;
386        }
387    
388    
389        /**
390         * Returns name type code (component #10).  This is a convenience method that saves you from 
391         * casting and handling an exception.
392         */
393        public ID getNameTypeCode() {
394           ID ret = null;
395           try {
396              ret = (ID)getComponent(9);
397           } catch (DataTypeException e) {
398              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
399              throw new RuntimeException(e);
400           }
401           return ret;
402        }
403    
404        
405        /**
406         * Returns name type code (component #10).  This is a convenience method that saves you from 
407         * casting and handling an exception.
408         */
409        public ID getPpn10_NameTypeCode() {
410           ID ret = null;
411           try {
412              ret = (ID)getComponent(9);
413           } catch (DataTypeException e) {
414              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
415              throw new RuntimeException(e);
416           }
417           return ret;
418        }
419    
420    
421        /**
422         * Returns identifier check digit (component #11).  This is a convenience method that saves you from 
423         * casting and handling an exception.
424         */
425        public ST getIdentifierCheckDigit() {
426           ST ret = null;
427           try {
428              ret = (ST)getComponent(10);
429           } catch (DataTypeException e) {
430              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
431              throw new RuntimeException(e);
432           }
433           return ret;
434        }
435    
436        
437        /**
438         * Returns identifier check digit (component #11).  This is a convenience method that saves you from 
439         * casting and handling an exception.
440         */
441        public ST getPpn11_IdentifierCheckDigit() {
442           ST ret = null;
443           try {
444              ret = (ST)getComponent(10);
445           } catch (DataTypeException e) {
446              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
447              throw new RuntimeException(e);
448           }
449           return ret;
450        }
451    
452    
453        /**
454         * Returns code identifying the check digit scheme employed (component #12).  This is a convenience method that saves you from 
455         * casting and handling an exception.
456         */
457        public ID getCodeIdentifyingTheCheckDigitSchemeEmployed() {
458           ID ret = null;
459           try {
460              ret = (ID)getComponent(11);
461           } catch (DataTypeException e) {
462              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
463              throw new RuntimeException(e);
464           }
465           return ret;
466        }
467    
468        
469        /**
470         * Returns code identifying the check digit scheme employed (component #12).  This is a convenience method that saves you from 
471         * casting and handling an exception.
472         */
473        public ID getPpn12_CodeIdentifyingTheCheckDigitSchemeEmployed() {
474           ID ret = null;
475           try {
476              ret = (ID)getComponent(11);
477           } catch (DataTypeException e) {
478              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
479              throw new RuntimeException(e);
480           }
481           return ret;
482        }
483    
484    
485        /**
486         * Returns identifier type code (IS) (component #13).  This is a convenience method that saves you from 
487         * casting and handling an exception.
488         */
489        public IS getIdentifierTypeCode() {
490           IS ret = null;
491           try {
492              ret = (IS)getComponent(12);
493           } catch (DataTypeException e) {
494              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
495              throw new RuntimeException(e);
496           }
497           return ret;
498        }
499    
500        
501        /**
502         * Returns identifier type code (IS) (component #13).  This is a convenience method that saves you from 
503         * casting and handling an exception.
504         */
505        public IS getPpn13_IdentifierTypeCode() {
506           IS ret = null;
507           try {
508              ret = (IS)getComponent(12);
509           } catch (DataTypeException e) {
510              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
511              throw new RuntimeException(e);
512           }
513           return ret;
514        }
515    
516    
517        /**
518         * Returns assigning facility (component #14).  This is a convenience method that saves you from 
519         * casting and handling an exception.
520         */
521        public HD getAssigningFacility() {
522           HD ret = null;
523           try {
524              ret = (HD)getComponent(13);
525           } catch (DataTypeException e) {
526              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
527              throw new RuntimeException(e);
528           }
529           return ret;
530        }
531    
532        
533        /**
534         * Returns assigning facility (component #14).  This is a convenience method that saves you from 
535         * casting and handling an exception.
536         */
537        public HD getPpn14_AssigningFacility() {
538           HD ret = null;
539           try {
540              ret = (HD)getComponent(13);
541           } catch (DataTypeException e) {
542              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
543              throw new RuntimeException(e);
544           }
545           return ret;
546        }
547    
548    
549        /**
550         * Returns Date/Time Action Performed (component #15).  This is a convenience method that saves you from 
551         * casting and handling an exception.
552         */
553        public TS getDateTimeActionPerformed() {
554           TS ret = null;
555           try {
556              ret = (TS)getComponent(14);
557           } catch (DataTypeException e) {
558              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
559              throw new RuntimeException(e);
560           }
561           return ret;
562        }
563    
564        
565        /**
566         * Returns Date/Time Action Performed (component #15).  This is a convenience method that saves you from 
567         * casting and handling an exception.
568         */
569        public TS getPpn15_DateTimeActionPerformed() {
570           TS ret = null;
571           try {
572              ret = (TS)getComponent(14);
573           } catch (DataTypeException e) {
574              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
575              throw new RuntimeException(e);
576           }
577           return ret;
578        }
579    
580    
581        /**
582         * Returns Name Representation code (component #16).  This is a convenience method that saves you from 
583         * casting and handling an exception.
584         */
585        public ID getNameRepresentationCode() {
586           ID ret = null;
587           try {
588              ret = (ID)getComponent(15);
589           } catch (DataTypeException e) {
590              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
591              throw new RuntimeException(e);
592           }
593           return ret;
594        }
595    
596        
597        /**
598         * Returns Name Representation code (component #16).  This is a convenience method that saves you from 
599         * casting and handling an exception.
600         */
601        public ID getPpn16_NameRepresentationCode() {
602           ID ret = null;
603           try {
604              ret = (ID)getComponent(15);
605           } catch (DataTypeException e) {
606              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
607              throw new RuntimeException(e);
608           }
609           return ret;
610        }
611    
612    
613        /**
614         * Returns name context (component #17).  This is a convenience method that saves you from 
615         * casting and handling an exception.
616         */
617        public CE getNameContext() {
618           CE ret = null;
619           try {
620              ret = (CE)getComponent(16);
621           } catch (DataTypeException e) {
622              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
623              throw new RuntimeException(e);
624           }
625           return ret;
626        }
627    
628        
629        /**
630         * Returns name context (component #17).  This is a convenience method that saves you from 
631         * casting and handling an exception.
632         */
633        public CE getPpn17_NameContext() {
634           CE ret = null;
635           try {
636              ret = (CE)getComponent(16);
637           } catch (DataTypeException e) {
638              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
639              throw new RuntimeException(e);
640           }
641           return ret;
642        }
643    
644    
645        /**
646         * Returns name validity range (component #18).  This is a convenience method that saves you from 
647         * casting and handling an exception.
648         */
649        public DR getNameValidityRange() {
650           DR ret = null;
651           try {
652              ret = (DR)getComponent(17);
653           } catch (DataTypeException e) {
654              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
655              throw new RuntimeException(e);
656           }
657           return ret;
658        }
659    
660        
661        /**
662         * Returns name validity range (component #18).  This is a convenience method that saves you from 
663         * casting and handling an exception.
664         */
665        public DR getPpn18_NameValidityRange() {
666           DR ret = null;
667           try {
668              ret = (DR)getComponent(17);
669           } catch (DataTypeException e) {
670              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
671              throw new RuntimeException(e);
672           }
673           return ret;
674        }
675    
676    
677        /**
678         * Returns name assembly order (component #19).  This is a convenience method that saves you from 
679         * casting and handling an exception.
680         */
681        public ID getNameAssemblyOrder() {
682           ID ret = null;
683           try {
684              ret = (ID)getComponent(18);
685           } catch (DataTypeException e) {
686              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
687              throw new RuntimeException(e);
688           }
689           return ret;
690        }
691    
692        
693        /**
694         * Returns name assembly order (component #19).  This is a convenience method that saves you from 
695         * casting and handling an exception.
696         */
697        public ID getPpn19_NameAssemblyOrder() {
698           ID ret = null;
699           try {
700              ret = (ID)getComponent(18);
701           } catch (DataTypeException e) {
702              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
703              throw new RuntimeException(e);
704           }
705           return ret;
706        }
707    
708    
709    
710    }
711