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