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