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.segment;
009
010 // import ca.uhn.hl7v2.model.v24.group.*;
011 import ca.uhn.hl7v2.model.v24.datatype.*;
012 import ca.uhn.log.HapiLogFactory;
013 import ca.uhn.hl7v2.HL7Exception;
014 import ca.uhn.hl7v2.parser.ModelClassFactory;
015 import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
016 import ca.uhn.hl7v2.model.AbstractMessage;
017 import ca.uhn.hl7v2.model.Group;
018 import ca.uhn.hl7v2.model.Type;
019 import ca.uhn.hl7v2.model.AbstractSegment;
020 import ca.uhn.hl7v2.model.Varies;
021
022 /**
023 *<p>Represents an HL7 AIL message segment (Appointment Information - Location Resource).
024 * This segment has the following fields:</p>
025 * <ul>
026 * <li>AIL-1: Set ID - AIL (SI) <b> </b>
027 * <li>AIL-2: Segment Action Code (ID) <b>optional </b>
028 * <li>AIL-3: Location Resource ID (PL) <b>optional </b>
029 * <li>AIL-4: Location Type-AIL (CE) <b> </b>
030 * <li>AIL-5: Location Group (CE) <b>optional </b>
031 * <li>AIL-6: Start Date/Time (TS) <b>optional </b>
032 * <li>AIL-7: Start Date/Time Offset (NM) <b>optional </b>
033 * <li>AIL-8: Start Date/Time Offset Units (CE) <b>optional </b>
034 * <li>AIL-9: Duration (NM) <b>optional </b>
035 * <li>AIL-10: Duration Units (CE) <b>optional </b>
036 * <li>AIL-11: Allow Substitution Code (IS) <b>optional </b>
037 * <li>AIL-12: Filler Status Code (CE) <b>optional </b>
038 * </ul>
039 */
040 public class AIL extends AbstractSegment {
041
042 /**
043 * Creates a new AIL segment
044 */
045 public AIL(Group parent, ModelClassFactory factory) {
046 super(parent, factory);
047 init(factory);
048 }
049
050 private void init(ModelClassFactory factory) {
051 try {
052 this.add(SI.class, true, 1, 4, new Object[]{ getMessage(), new Integer(0) }, "Set ID - AIL");
053 this.add(ID.class, false, 1, 3, new Object[]{ getMessage() }, "Segment Action Code");
054 this.add(PL.class, false, 1, 80, new Object[]{ getMessage(), new Integer(0) }, "Location Resource ID");
055 this.add(CE.class, true, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Location Type-AIL");
056 this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Location Group");
057 this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Start Date/Time");
058 this.add(NM.class, false, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "Start Date/Time Offset");
059 this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Start Date/Time Offset Units");
060 this.add(NM.class, false, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "Duration");
061 this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Duration Units");
062 this.add(IS.class, false, 1, 10, new Object[]{ getMessage() }, "Allow Substitution Code");
063 this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(278) }, "Filler Status Code");
064 } catch(HL7Exception e) {
065 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating AIL - this is probably a bug in the source code generator.", e);
066 }
067 }
068
069
070
071 /**
072 * Returns
073 * AIL-1: "Set ID - AIL" - creates it if necessary
074 */
075 public SI getSetIDAIL() {
076 SI ret = null;
077 try {
078 Type t = this.getField(1, 0);
079 ret = (SI)t;
080 } catch (ClassCastException cce) {
081 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
082 throw new RuntimeException(cce);
083 } catch (HL7Exception he) {
084 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
085 throw new RuntimeException(he);
086 }
087 return ret;
088 }
089
090
091 /**
092 * Returns
093 * AIL-1: "Set ID - AIL" - creates it if necessary
094 */
095 public SI getAil1_SetIDAIL() {
096 SI ret = null;
097 try {
098 Type t = this.getField(1, 0);
099 ret = (SI)t;
100 } catch (ClassCastException cce) {
101 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
102 throw new RuntimeException(cce);
103 } catch (HL7Exception he) {
104 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
105 throw new RuntimeException(he);
106 }
107 return ret;
108 }
109
110
111
112 /**
113 * Returns
114 * AIL-2: "Segment Action Code" - creates it if necessary
115 */
116 public ID getSegmentActionCode() {
117 ID ret = null;
118 try {
119 Type t = this.getField(2, 0);
120 ret = (ID)t;
121 } catch (ClassCastException cce) {
122 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
123 throw new RuntimeException(cce);
124 } catch (HL7Exception he) {
125 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
126 throw new RuntimeException(he);
127 }
128 return ret;
129 }
130
131
132 /**
133 * Returns
134 * AIL-2: "Segment Action Code" - creates it if necessary
135 */
136 public ID getAil2_SegmentActionCode() {
137 ID ret = null;
138 try {
139 Type t = this.getField(2, 0);
140 ret = (ID)t;
141 } catch (ClassCastException cce) {
142 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
143 throw new RuntimeException(cce);
144 } catch (HL7Exception he) {
145 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
146 throw new RuntimeException(he);
147 }
148 return ret;
149 }
150
151
152
153 /**
154 * Returns
155 * AIL-3: "Location Resource ID" - creates it if necessary
156 */
157 public PL getLocationResourceID() {
158 PL ret = null;
159 try {
160 Type t = this.getField(3, 0);
161 ret = (PL)t;
162 } catch (ClassCastException cce) {
163 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
164 throw new RuntimeException(cce);
165 } catch (HL7Exception he) {
166 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
167 throw new RuntimeException(he);
168 }
169 return ret;
170 }
171
172
173 /**
174 * Returns
175 * AIL-3: "Location Resource ID" - creates it if necessary
176 */
177 public PL getAil3_LocationResourceID() {
178 PL ret = null;
179 try {
180 Type t = this.getField(3, 0);
181 ret = (PL)t;
182 } catch (ClassCastException cce) {
183 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
184 throw new RuntimeException(cce);
185 } catch (HL7Exception he) {
186 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
187 throw new RuntimeException(he);
188 }
189 return ret;
190 }
191
192
193
194 /**
195 * Returns
196 * AIL-4: "Location Type-AIL" - creates it if necessary
197 */
198 public CE getLocationTypeAIL() {
199 CE ret = null;
200 try {
201 Type t = this.getField(4, 0);
202 ret = (CE)t;
203 } catch (ClassCastException cce) {
204 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
205 throw new RuntimeException(cce);
206 } catch (HL7Exception he) {
207 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
208 throw new RuntimeException(he);
209 }
210 return ret;
211 }
212
213
214 /**
215 * Returns
216 * AIL-4: "Location Type-AIL" - creates it if necessary
217 */
218 public CE getAil4_LocationTypeAIL() {
219 CE ret = null;
220 try {
221 Type t = this.getField(4, 0);
222 ret = (CE)t;
223 } catch (ClassCastException cce) {
224 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
225 throw new RuntimeException(cce);
226 } catch (HL7Exception he) {
227 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
228 throw new RuntimeException(he);
229 }
230 return ret;
231 }
232
233
234
235 /**
236 * Returns
237 * AIL-5: "Location Group" - creates it if necessary
238 */
239 public CE getLocationGroup() {
240 CE ret = null;
241 try {
242 Type t = this.getField(5, 0);
243 ret = (CE)t;
244 } catch (ClassCastException cce) {
245 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
246 throw new RuntimeException(cce);
247 } catch (HL7Exception he) {
248 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
249 throw new RuntimeException(he);
250 }
251 return ret;
252 }
253
254
255 /**
256 * Returns
257 * AIL-5: "Location Group" - creates it if necessary
258 */
259 public CE getAil5_LocationGroup() {
260 CE ret = null;
261 try {
262 Type t = this.getField(5, 0);
263 ret = (CE)t;
264 } catch (ClassCastException cce) {
265 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
266 throw new RuntimeException(cce);
267 } catch (HL7Exception he) {
268 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
269 throw new RuntimeException(he);
270 }
271 return ret;
272 }
273
274
275
276 /**
277 * Returns
278 * AIL-6: "Start Date/Time" - creates it if necessary
279 */
280 public TS getStartDateTime() {
281 TS ret = null;
282 try {
283 Type t = this.getField(6, 0);
284 ret = (TS)t;
285 } catch (ClassCastException cce) {
286 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
287 throw new RuntimeException(cce);
288 } catch (HL7Exception he) {
289 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
290 throw new RuntimeException(he);
291 }
292 return ret;
293 }
294
295
296 /**
297 * Returns
298 * AIL-6: "Start Date/Time" - creates it if necessary
299 */
300 public TS getAil6_StartDateTime() {
301 TS ret = null;
302 try {
303 Type t = this.getField(6, 0);
304 ret = (TS)t;
305 } catch (ClassCastException cce) {
306 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
307 throw new RuntimeException(cce);
308 } catch (HL7Exception he) {
309 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
310 throw new RuntimeException(he);
311 }
312 return ret;
313 }
314
315
316
317 /**
318 * Returns
319 * AIL-7: "Start Date/Time Offset" - creates it if necessary
320 */
321 public NM getStartDateTimeOffset() {
322 NM ret = null;
323 try {
324 Type t = this.getField(7, 0);
325 ret = (NM)t;
326 } catch (ClassCastException cce) {
327 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
328 throw new RuntimeException(cce);
329 } catch (HL7Exception he) {
330 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
331 throw new RuntimeException(he);
332 }
333 return ret;
334 }
335
336
337 /**
338 * Returns
339 * AIL-7: "Start Date/Time Offset" - creates it if necessary
340 */
341 public NM getAil7_StartDateTimeOffset() {
342 NM ret = null;
343 try {
344 Type t = this.getField(7, 0);
345 ret = (NM)t;
346 } catch (ClassCastException cce) {
347 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
348 throw new RuntimeException(cce);
349 } catch (HL7Exception he) {
350 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
351 throw new RuntimeException(he);
352 }
353 return ret;
354 }
355
356
357
358 /**
359 * Returns
360 * AIL-8: "Start Date/Time Offset Units" - creates it if necessary
361 */
362 public CE getStartDateTimeOffsetUnits() {
363 CE ret = null;
364 try {
365 Type t = this.getField(8, 0);
366 ret = (CE)t;
367 } catch (ClassCastException cce) {
368 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
369 throw new RuntimeException(cce);
370 } catch (HL7Exception he) {
371 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
372 throw new RuntimeException(he);
373 }
374 return ret;
375 }
376
377
378 /**
379 * Returns
380 * AIL-8: "Start Date/Time Offset Units" - creates it if necessary
381 */
382 public CE getAil8_StartDateTimeOffsetUnits() {
383 CE ret = null;
384 try {
385 Type t = this.getField(8, 0);
386 ret = (CE)t;
387 } catch (ClassCastException cce) {
388 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
389 throw new RuntimeException(cce);
390 } catch (HL7Exception he) {
391 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
392 throw new RuntimeException(he);
393 }
394 return ret;
395 }
396
397
398
399 /**
400 * Returns
401 * AIL-9: "Duration" - creates it if necessary
402 */
403 public NM getDuration() {
404 NM ret = null;
405 try {
406 Type t = this.getField(9, 0);
407 ret = (NM)t;
408 } catch (ClassCastException cce) {
409 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
410 throw new RuntimeException(cce);
411 } catch (HL7Exception he) {
412 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
413 throw new RuntimeException(he);
414 }
415 return ret;
416 }
417
418
419 /**
420 * Returns
421 * AIL-9: "Duration" - creates it if necessary
422 */
423 public NM getAil9_Duration() {
424 NM ret = null;
425 try {
426 Type t = this.getField(9, 0);
427 ret = (NM)t;
428 } catch (ClassCastException cce) {
429 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
430 throw new RuntimeException(cce);
431 } catch (HL7Exception he) {
432 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
433 throw new RuntimeException(he);
434 }
435 return ret;
436 }
437
438
439
440 /**
441 * Returns
442 * AIL-10: "Duration Units" - creates it if necessary
443 */
444 public CE getDurationUnits() {
445 CE ret = null;
446 try {
447 Type t = this.getField(10, 0);
448 ret = (CE)t;
449 } catch (ClassCastException cce) {
450 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
451 throw new RuntimeException(cce);
452 } catch (HL7Exception he) {
453 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
454 throw new RuntimeException(he);
455 }
456 return ret;
457 }
458
459
460 /**
461 * Returns
462 * AIL-10: "Duration Units" - creates it if necessary
463 */
464 public CE getAil10_DurationUnits() {
465 CE ret = null;
466 try {
467 Type t = this.getField(10, 0);
468 ret = (CE)t;
469 } catch (ClassCastException cce) {
470 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
471 throw new RuntimeException(cce);
472 } catch (HL7Exception he) {
473 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
474 throw new RuntimeException(he);
475 }
476 return ret;
477 }
478
479
480
481 /**
482 * Returns
483 * AIL-11: "Allow Substitution Code" - creates it if necessary
484 */
485 public IS getAllowSubstitutionCode() {
486 IS ret = null;
487 try {
488 Type t = this.getField(11, 0);
489 ret = (IS)t;
490 } catch (ClassCastException cce) {
491 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
492 throw new RuntimeException(cce);
493 } catch (HL7Exception he) {
494 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
495 throw new RuntimeException(he);
496 }
497 return ret;
498 }
499
500
501 /**
502 * Returns
503 * AIL-11: "Allow Substitution Code" - creates it if necessary
504 */
505 public IS getAil11_AllowSubstitutionCode() {
506 IS ret = null;
507 try {
508 Type t = this.getField(11, 0);
509 ret = (IS)t;
510 } catch (ClassCastException cce) {
511 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
512 throw new RuntimeException(cce);
513 } catch (HL7Exception he) {
514 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
515 throw new RuntimeException(he);
516 }
517 return ret;
518 }
519
520
521
522 /**
523 * Returns
524 * AIL-12: "Filler Status Code" - creates it if necessary
525 */
526 public CE getFillerStatusCode() {
527 CE ret = null;
528 try {
529 Type t = this.getField(12, 0);
530 ret = (CE)t;
531 } catch (ClassCastException cce) {
532 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
533 throw new RuntimeException(cce);
534 } catch (HL7Exception he) {
535 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
536 throw new RuntimeException(he);
537 }
538 return ret;
539 }
540
541
542 /**
543 * Returns
544 * AIL-12: "Filler Status Code" - creates it if necessary
545 */
546 public CE getAil12_FillerStatusCode() {
547 CE ret = null;
548 try {
549 Type t = this.getField(12, 0);
550 ret = (CE)t;
551 } catch (ClassCastException cce) {
552 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
553 throw new RuntimeException(cce);
554 } catch (HL7Exception he) {
555 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
556 throw new RuntimeException(he);
557 }
558 return ret;
559 }
560
561
562
563
564
565 /** {@inheritDoc} */
566 protected Type createNewTypeWithoutReflection(int field) {
567 switch (field) {
568 case 0: return new SI(getMessage());
569 case 1: return new ID(getMessage(), new Integer( 206 ));
570 case 2: return new PL(getMessage());
571 case 3: return new CE(getMessage());
572 case 4: return new CE(getMessage());
573 case 5: return new TS(getMessage());
574 case 6: return new NM(getMessage());
575 case 7: return new CE(getMessage());
576 case 8: return new NM(getMessage());
577 case 9: return new CE(getMessage());
578 case 10: return new IS(getMessage(), new Integer( 279 ));
579 case 11: return new CE(getMessage());
580 default: return null;
581 }
582 }
583
584
585 }
586