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 LA2 (Location with address information (variant 2)) data type.
019 * This type consists of the following components:</p>
020 * <ul>
021 * <li>point of care (IS) (IS)
022 * <li>room (IS)
023 * <li>bed (IS)
024 * <li>facility (HD) (HD)
025 * <li>location status (IS)
026 * <li>person location type (IS)
027 * <li>building (IS)
028 * <li>floor (IS)
029 * <li>street address (ST) (ST)
030 * <li>other designation (ST)
031 * <li>city (ST)
032 * <li>state or province (ST)
033 * <li>zip or postal code (ST)
034 * <li>country (ID)
035 * <li>address type (ID)
036 * <li>other geographic designation (ST)
037 * </ul>
038 */
039 public class LA2 extends AbstractType implements Composite {
040
041 private Type[] data;
042
043 /**
044 * Creates a new LA2 type
045 */
046 public LA2(Message message) {
047 super(message);
048 init();
049 }
050
051 private void init() {
052 data = new Type[16];
053 data[0] = new IS(getMessage(), 0);
054 data[1] = new IS(getMessage(), 0);
055 data[2] = new IS(getMessage(), 0);
056 data[3] = new HD(getMessage());
057 data[4] = new IS(getMessage(), 0);
058 data[5] = new IS(getMessage(), 0);
059 data[6] = new IS(getMessage(), 0);
060 data[7] = new IS(getMessage(), 0);
061 data[8] = new ST(getMessage());
062 data[9] = new ST(getMessage());
063 data[10] = new ST(getMessage());
064 data[11] = new ST(getMessage());
065 data[12] = new ST(getMessage());
066 data[13] = new ID(getMessage(), 0);
067 data[14] = new ID(getMessage(), 0);
068 data[15] = new ST(getMessage());
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 point of care (IS) (component #1). This is a convenience method that saves you from
097 * casting and handling an exception.
098 */
099 public IS getPointOfCare() {
100 IS ret = null;
101 try {
102 ret = (IS)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 point of care (IS) (component #1). This is a convenience method that saves you from
113 * casting and handling an exception.
114 */
115 public IS getLa21_PointOfCare() {
116 IS ret = null;
117 try {
118 ret = (IS)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 room (component #2). This is a convenience method that saves you from
129 * casting and handling an exception.
130 */
131 public IS getRoom() {
132 IS ret = null;
133 try {
134 ret = (IS)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 room (component #2). This is a convenience method that saves you from
145 * casting and handling an exception.
146 */
147 public IS getLa22_Room() {
148 IS ret = null;
149 try {
150 ret = (IS)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 bed (component #3). This is a convenience method that saves you from
161 * casting and handling an exception.
162 */
163 public IS getBed() {
164 IS ret = null;
165 try {
166 ret = (IS)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 bed (component #3). This is a convenience method that saves you from
177 * casting and handling an exception.
178 */
179 public IS getLa23_Bed() {
180 IS ret = null;
181 try {
182 ret = (IS)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 facility (HD) (component #4). This is a convenience method that saves you from
193 * casting and handling an exception.
194 */
195 public HD getFacility() {
196 HD ret = null;
197 try {
198 ret = (HD)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 facility (HD) (component #4). This is a convenience method that saves you from
209 * casting and handling an exception.
210 */
211 public HD getLa24_Facility() {
212 HD ret = null;
213 try {
214 ret = (HD)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 location status (component #5). This is a convenience method that saves you from
225 * casting and handling an exception.
226 */
227 public IS getLocationStatus() {
228 IS ret = null;
229 try {
230 ret = (IS)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 location status (component #5). This is a convenience method that saves you from
241 * casting and handling an exception.
242 */
243 public IS getLa25_LocationStatus() {
244 IS ret = null;
245 try {
246 ret = (IS)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 person location type (component #6). This is a convenience method that saves you from
257 * casting and handling an exception.
258 */
259 public IS getPersonLocationType() {
260 IS ret = null;
261 try {
262 ret = (IS)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 person location type (component #6). This is a convenience method that saves you from
273 * casting and handling an exception.
274 */
275 public IS getLa26_PersonLocationType() {
276 IS ret = null;
277 try {
278 ret = (IS)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 building (component #7). This is a convenience method that saves you from
289 * casting and handling an exception.
290 */
291 public IS getBuilding() {
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 building (component #7). This is a convenience method that saves you from
305 * casting and handling an exception.
306 */
307 public IS getLa27_Building() {
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 floor (component #8). This is a convenience method that saves you from
321 * casting and handling an exception.
322 */
323 public IS getFloor() {
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 floor (component #8). This is a convenience method that saves you from
337 * casting and handling an exception.
338 */
339 public IS getLa28_Floor() {
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 street address (ST) (component #9). This is a convenience method that saves you from
353 * casting and handling an exception.
354 */
355 public ST getStreetAddress() {
356 ST ret = null;
357 try {
358 ret = (ST)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 street address (ST) (component #9). This is a convenience method that saves you from
369 * casting and handling an exception.
370 */
371 public ST getLa29_StreetAddress() {
372 ST ret = null;
373 try {
374 ret = (ST)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 other designation (component #10). This is a convenience method that saves you from
385 * casting and handling an exception.
386 */
387 public ST getOtherDesignation() {
388 ST ret = null;
389 try {
390 ret = (ST)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 other designation (component #10). This is a convenience method that saves you from
401 * casting and handling an exception.
402 */
403 public ST getLa210_OtherDesignation() {
404 ST ret = null;
405 try {
406 ret = (ST)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 city (component #11). This is a convenience method that saves you from
417 * casting and handling an exception.
418 */
419 public ST getCity() {
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 city (component #11). This is a convenience method that saves you from
433 * casting and handling an exception.
434 */
435 public ST getLa211_City() {
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 state or province (component #12). This is a convenience method that saves you from
449 * casting and handling an exception.
450 */
451 public ST getStateOrProvince() {
452 ST ret = null;
453 try {
454 ret = (ST)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 state or province (component #12). This is a convenience method that saves you from
465 * casting and handling an exception.
466 */
467 public ST getLa212_StateOrProvince() {
468 ST ret = null;
469 try {
470 ret = (ST)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 zip or postal code (component #13). This is a convenience method that saves you from
481 * casting and handling an exception.
482 */
483 public ST getZipOrPostalCode() {
484 ST ret = null;
485 try {
486 ret = (ST)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 zip or postal code (component #13). This is a convenience method that saves you from
497 * casting and handling an exception.
498 */
499 public ST getLa213_ZipOrPostalCode() {
500 ST ret = null;
501 try {
502 ret = (ST)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 country (component #14). This is a convenience method that saves you from
513 * casting and handling an exception.
514 */
515 public ID getCountry() {
516 ID ret = null;
517 try {
518 ret = (ID)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 country (component #14). This is a convenience method that saves you from
529 * casting and handling an exception.
530 */
531 public ID getLa214_Country() {
532 ID ret = null;
533 try {
534 ret = (ID)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 address type (component #15). This is a convenience method that saves you from
545 * casting and handling an exception.
546 */
547 public ID getAddressType() {
548 ID ret = null;
549 try {
550 ret = (ID)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 address type (component #15). This is a convenience method that saves you from
561 * casting and handling an exception.
562 */
563 public ID getLa215_AddressType() {
564 ID ret = null;
565 try {
566 ret = (ID)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 other geographic designation (component #16). This is a convenience method that saves you from
577 * casting and handling an exception.
578 */
579 public ST getOtherGeographicDesignation() {
580 ST ret = null;
581 try {
582 ret = (ST)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 other geographic designation (component #16). This is a convenience method that saves you from
593 * casting and handling an exception.
594 */
595 public ST getLa216_OtherGeographicDesignation() {
596 ST ret = null;
597 try {
598 ret = (ST)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