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