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