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 OM4 message segment (Observations that Require Specimens).
024 * This segment has the following fields:</p>
025 * <ul>
026 * <li>OM4-1: Sequence Number - Test/ Observation Master File (NM) <b>optional </b>
027 * <li>OM4-2: Derived Specimen (ID) <b>optional </b>
028 * <li>OM4-3: Container Description (TX) <b>optional </b>
029 * <li>OM4-4: Container Volume (NM) <b>optional </b>
030 * <li>OM4-5: Container Units (CE) <b>optional </b>
031 * <li>OM4-6: Specimen (CE) <b>optional </b>
032 * <li>OM4-7: Additive (CE) <b>optional </b>
033 * <li>OM4-8: Preparation (TX) <b>optional </b>
034 * <li>OM4-9: Special Handling Requirements (TX) <b>optional </b>
035 * <li>OM4-10: Normal Collection Volume (CQ) <b>optional </b>
036 * <li>OM4-11: Minimum Collection Volume (CQ) <b>optional </b>
037 * <li>OM4-12: Specimen Requirements (TX) <b>optional </b>
038 * <li>OM4-13: Specimen Priorities (ID) <b>optional repeating</b>
039 * <li>OM4-14: Specimen Retention Time (CQ) <b>optional </b>
040 * </ul>
041 */
042 public class OM4 extends AbstractSegment {
043
044 /**
045 * Creates a new OM4 segment
046 */
047 public OM4(Group parent, ModelClassFactory factory) {
048 super(parent, factory);
049 init(factory);
050 }
051
052 private void init(ModelClassFactory factory) {
053 try {
054 this.add(NM.class, false, 1, 4, new Object[]{ getMessage(), new Integer(0) }, "Sequence Number - Test/ Observation Master File");
055 this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Derived Specimen");
056 this.add(TX.class, false, 1, 60, new Object[]{ getMessage(), new Integer(0) }, "Container Description");
057 this.add(NM.class, false, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "Container Volume");
058 this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(9999) }, "Container Units");
059 this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(9999) }, "Specimen");
060 this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(371) }, "Additive");
061 this.add(TX.class, false, 1, 10240, new Object[]{ getMessage(), new Integer(0) }, "Preparation");
062 this.add(TX.class, false, 1, 10240, new Object[]{ getMessage(), new Integer(0) }, "Special Handling Requirements");
063 this.add(CQ.class, false, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "Normal Collection Volume");
064 this.add(CQ.class, false, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "Minimum Collection Volume");
065 this.add(TX.class, false, 1, 10240, new Object[]{ getMessage(), new Integer(0) }, "Specimen Requirements");
066 this.add(ID.class, false, 0, 1, new Object[]{ getMessage() }, "Specimen Priorities");
067 this.add(CQ.class, false, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "Specimen Retention Time");
068 } catch(HL7Exception e) {
069 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating OM4 - this is probably a bug in the source code generator.", e);
070 }
071 }
072
073
074
075 /**
076 * Returns
077 * OM4-1: "Sequence Number - Test/ Observation Master File" - creates it if necessary
078 */
079 public NM getSequenceNumberTestObservationMasterFile() {
080 NM ret = null;
081 try {
082 Type t = this.getField(1, 0);
083 ret = (NM)t;
084 } catch (ClassCastException cce) {
085 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
086 throw new RuntimeException(cce);
087 } catch (HL7Exception he) {
088 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
089 throw new RuntimeException(he);
090 }
091 return ret;
092 }
093
094
095 /**
096 * Returns
097 * OM4-1: "Sequence Number - Test/ Observation Master File" - creates it if necessary
098 */
099 public NM getOm41_SequenceNumberTestObservationMasterFile() {
100 NM ret = null;
101 try {
102 Type t = this.getField(1, 0);
103 ret = (NM)t;
104 } catch (ClassCastException cce) {
105 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
106 throw new RuntimeException(cce);
107 } catch (HL7Exception he) {
108 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
109 throw new RuntimeException(he);
110 }
111 return ret;
112 }
113
114
115
116 /**
117 * Returns
118 * OM4-2: "Derived Specimen" - creates it if necessary
119 */
120 public ID getDerivedSpecimen() {
121 ID ret = null;
122 try {
123 Type t = this.getField(2, 0);
124 ret = (ID)t;
125 } catch (ClassCastException cce) {
126 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
127 throw new RuntimeException(cce);
128 } catch (HL7Exception he) {
129 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
130 throw new RuntimeException(he);
131 }
132 return ret;
133 }
134
135
136 /**
137 * Returns
138 * OM4-2: "Derived Specimen" - creates it if necessary
139 */
140 public ID getOm42_DerivedSpecimen() {
141 ID ret = null;
142 try {
143 Type t = this.getField(2, 0);
144 ret = (ID)t;
145 } catch (ClassCastException cce) {
146 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
147 throw new RuntimeException(cce);
148 } catch (HL7Exception he) {
149 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
150 throw new RuntimeException(he);
151 }
152 return ret;
153 }
154
155
156
157 /**
158 * Returns
159 * OM4-3: "Container Description" - creates it if necessary
160 */
161 public TX getContainerDescription() {
162 TX ret = null;
163 try {
164 Type t = this.getField(3, 0);
165 ret = (TX)t;
166 } catch (ClassCastException cce) {
167 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
168 throw new RuntimeException(cce);
169 } catch (HL7Exception he) {
170 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
171 throw new RuntimeException(he);
172 }
173 return ret;
174 }
175
176
177 /**
178 * Returns
179 * OM4-3: "Container Description" - creates it if necessary
180 */
181 public TX getOm43_ContainerDescription() {
182 TX ret = null;
183 try {
184 Type t = this.getField(3, 0);
185 ret = (TX)t;
186 } catch (ClassCastException cce) {
187 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
188 throw new RuntimeException(cce);
189 } catch (HL7Exception he) {
190 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
191 throw new RuntimeException(he);
192 }
193 return ret;
194 }
195
196
197
198 /**
199 * Returns
200 * OM4-4: "Container Volume" - creates it if necessary
201 */
202 public NM getContainerVolume() {
203 NM ret = null;
204 try {
205 Type t = this.getField(4, 0);
206 ret = (NM)t;
207 } catch (ClassCastException cce) {
208 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
209 throw new RuntimeException(cce);
210 } catch (HL7Exception he) {
211 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
212 throw new RuntimeException(he);
213 }
214 return ret;
215 }
216
217
218 /**
219 * Returns
220 * OM4-4: "Container Volume" - creates it if necessary
221 */
222 public NM getOm44_ContainerVolume() {
223 NM ret = null;
224 try {
225 Type t = this.getField(4, 0);
226 ret = (NM)t;
227 } catch (ClassCastException cce) {
228 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
229 throw new RuntimeException(cce);
230 } catch (HL7Exception he) {
231 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
232 throw new RuntimeException(he);
233 }
234 return ret;
235 }
236
237
238
239 /**
240 * Returns
241 * OM4-5: "Container Units" - creates it if necessary
242 */
243 public CE getContainerUnits() {
244 CE ret = null;
245 try {
246 Type t = this.getField(5, 0);
247 ret = (CE)t;
248 } catch (ClassCastException cce) {
249 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
250 throw new RuntimeException(cce);
251 } catch (HL7Exception he) {
252 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
253 throw new RuntimeException(he);
254 }
255 return ret;
256 }
257
258
259 /**
260 * Returns
261 * OM4-5: "Container Units" - creates it if necessary
262 */
263 public CE getOm45_ContainerUnits() {
264 CE ret = null;
265 try {
266 Type t = this.getField(5, 0);
267 ret = (CE)t;
268 } catch (ClassCastException cce) {
269 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
270 throw new RuntimeException(cce);
271 } catch (HL7Exception he) {
272 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
273 throw new RuntimeException(he);
274 }
275 return ret;
276 }
277
278
279
280 /**
281 * Returns
282 * OM4-6: "Specimen" - creates it if necessary
283 */
284 public CE getSpecimen() {
285 CE ret = null;
286 try {
287 Type t = this.getField(6, 0);
288 ret = (CE)t;
289 } catch (ClassCastException cce) {
290 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
291 throw new RuntimeException(cce);
292 } catch (HL7Exception he) {
293 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
294 throw new RuntimeException(he);
295 }
296 return ret;
297 }
298
299
300 /**
301 * Returns
302 * OM4-6: "Specimen" - creates it if necessary
303 */
304 public CE getOm46_Specimen() {
305 CE ret = null;
306 try {
307 Type t = this.getField(6, 0);
308 ret = (CE)t;
309 } catch (ClassCastException cce) {
310 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
311 throw new RuntimeException(cce);
312 } catch (HL7Exception he) {
313 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
314 throw new RuntimeException(he);
315 }
316 return ret;
317 }
318
319
320
321 /**
322 * Returns
323 * OM4-7: "Additive" - creates it if necessary
324 */
325 public CE getAdditive() {
326 CE ret = null;
327 try {
328 Type t = this.getField(7, 0);
329 ret = (CE)t;
330 } catch (ClassCastException cce) {
331 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
332 throw new RuntimeException(cce);
333 } catch (HL7Exception he) {
334 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
335 throw new RuntimeException(he);
336 }
337 return ret;
338 }
339
340
341 /**
342 * Returns
343 * OM4-7: "Additive" - creates it if necessary
344 */
345 public CE getOm47_Additive() {
346 CE ret = null;
347 try {
348 Type t = this.getField(7, 0);
349 ret = (CE)t;
350 } catch (ClassCastException cce) {
351 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
352 throw new RuntimeException(cce);
353 } catch (HL7Exception he) {
354 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
355 throw new RuntimeException(he);
356 }
357 return ret;
358 }
359
360
361
362 /**
363 * Returns
364 * OM4-8: "Preparation" - creates it if necessary
365 */
366 public TX getPreparation() {
367 TX ret = null;
368 try {
369 Type t = this.getField(8, 0);
370 ret = (TX)t;
371 } catch (ClassCastException cce) {
372 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
373 throw new RuntimeException(cce);
374 } catch (HL7Exception he) {
375 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
376 throw new RuntimeException(he);
377 }
378 return ret;
379 }
380
381
382 /**
383 * Returns
384 * OM4-8: "Preparation" - creates it if necessary
385 */
386 public TX getOm48_Preparation() {
387 TX ret = null;
388 try {
389 Type t = this.getField(8, 0);
390 ret = (TX)t;
391 } catch (ClassCastException cce) {
392 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
393 throw new RuntimeException(cce);
394 } catch (HL7Exception he) {
395 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
396 throw new RuntimeException(he);
397 }
398 return ret;
399 }
400
401
402
403 /**
404 * Returns
405 * OM4-9: "Special Handling Requirements" - creates it if necessary
406 */
407 public TX getSpecialHandlingRequirements() {
408 TX ret = null;
409 try {
410 Type t = this.getField(9, 0);
411 ret = (TX)t;
412 } catch (ClassCastException cce) {
413 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
414 throw new RuntimeException(cce);
415 } catch (HL7Exception he) {
416 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
417 throw new RuntimeException(he);
418 }
419 return ret;
420 }
421
422
423 /**
424 * Returns
425 * OM4-9: "Special Handling Requirements" - creates it if necessary
426 */
427 public TX getOm49_SpecialHandlingRequirements() {
428 TX ret = null;
429 try {
430 Type t = this.getField(9, 0);
431 ret = (TX)t;
432 } catch (ClassCastException cce) {
433 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
434 throw new RuntimeException(cce);
435 } catch (HL7Exception he) {
436 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
437 throw new RuntimeException(he);
438 }
439 return ret;
440 }
441
442
443
444 /**
445 * Returns
446 * OM4-10: "Normal Collection Volume" - creates it if necessary
447 */
448 public CQ getNormalCollectionVolume() {
449 CQ ret = null;
450 try {
451 Type t = this.getField(10, 0);
452 ret = (CQ)t;
453 } catch (ClassCastException cce) {
454 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
455 throw new RuntimeException(cce);
456 } catch (HL7Exception he) {
457 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
458 throw new RuntimeException(he);
459 }
460 return ret;
461 }
462
463
464 /**
465 * Returns
466 * OM4-10: "Normal Collection Volume" - creates it if necessary
467 */
468 public CQ getOm410_NormalCollectionVolume() {
469 CQ ret = null;
470 try {
471 Type t = this.getField(10, 0);
472 ret = (CQ)t;
473 } catch (ClassCastException cce) {
474 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
475 throw new RuntimeException(cce);
476 } catch (HL7Exception he) {
477 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
478 throw new RuntimeException(he);
479 }
480 return ret;
481 }
482
483
484
485 /**
486 * Returns
487 * OM4-11: "Minimum Collection Volume" - creates it if necessary
488 */
489 public CQ getMinimumCollectionVolume() {
490 CQ ret = null;
491 try {
492 Type t = this.getField(11, 0);
493 ret = (CQ)t;
494 } catch (ClassCastException cce) {
495 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
496 throw new RuntimeException(cce);
497 } catch (HL7Exception he) {
498 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
499 throw new RuntimeException(he);
500 }
501 return ret;
502 }
503
504
505 /**
506 * Returns
507 * OM4-11: "Minimum Collection Volume" - creates it if necessary
508 */
509 public CQ getOm411_MinimumCollectionVolume() {
510 CQ ret = null;
511 try {
512 Type t = this.getField(11, 0);
513 ret = (CQ)t;
514 } catch (ClassCastException cce) {
515 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
516 throw new RuntimeException(cce);
517 } catch (HL7Exception he) {
518 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
519 throw new RuntimeException(he);
520 }
521 return ret;
522 }
523
524
525
526 /**
527 * Returns
528 * OM4-12: "Specimen Requirements" - creates it if necessary
529 */
530 public TX getSpecimenRequirements() {
531 TX ret = null;
532 try {
533 Type t = this.getField(12, 0);
534 ret = (TX)t;
535 } catch (ClassCastException cce) {
536 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
537 throw new RuntimeException(cce);
538 } catch (HL7Exception he) {
539 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
540 throw new RuntimeException(he);
541 }
542 return ret;
543 }
544
545
546 /**
547 * Returns
548 * OM4-12: "Specimen Requirements" - creates it if necessary
549 */
550 public TX getOm412_SpecimenRequirements() {
551 TX ret = null;
552 try {
553 Type t = this.getField(12, 0);
554 ret = (TX)t;
555 } catch (ClassCastException cce) {
556 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
557 throw new RuntimeException(cce);
558 } catch (HL7Exception he) {
559 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
560 throw new RuntimeException(he);
561 }
562 return ret;
563 }
564
565
566 /**
567 * Returns all repetitions of Specimen Priorities (OM4-13).
568 */
569 public ID[] getSpecimenPriorities() {
570 ID[] ret = null;
571 try {
572 Type[] t = this.getField(13);
573 ret = new ID[t.length];
574 for (int i = 0; i < ret.length; i++) {
575 ret[i] = (ID)t[i];
576 }
577 } catch (ClassCastException cce) {
578 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
579 throw new RuntimeException(cce);
580 } catch (HL7Exception he) {
581 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
582 throw new RuntimeException(he);
583 }
584 return ret;
585 }
586
587
588 /**
589 * Returns a count of the current number of repetitions of Specimen Priorities (OM4-13).
590 * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
591 * it will return zero.
592 */
593 public int getSpecimenPrioritiesReps() {
594 ID[] ret = null;
595 try {
596 Type[] t = this.getField(13);
597 return t.length;
598 } catch (ClassCastException cce) {
599 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
600 throw new RuntimeException(cce);
601 } catch (HL7Exception he) {
602 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
603 throw new RuntimeException(he);
604 }
605 }
606
607
608 /**
609 * Returns a specific repetition of
610 * OM4-13: "Specimen Priorities" - creates it if necessary
611 *
612 * @param rep The repetition index (0-indexed)
613 */
614 public ID getSpecimenPriorities(int rep) {
615 ID ret = null;
616 try {
617 Type t = this.getField(13, rep);
618 ret = (ID)t;
619 } catch (ClassCastException cce) {
620 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
621 throw new RuntimeException(cce);
622 } catch (HL7Exception he) {
623 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
624 throw new RuntimeException(he);
625 }
626 return ret;
627 }
628
629 /**
630 * Returns a specific repetition of
631 * OM4-13: "Specimen Priorities" - creates it if necessary
632 *
633 * @param rep The repetition index (0-indexed)
634 */
635 public ID getOm413_SpecimenPriorities(int rep) {
636 ID ret = null;
637 try {
638 Type t = this.getField(13, rep);
639 ret = (ID)t;
640 } catch (ClassCastException cce) {
641 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
642 throw new RuntimeException(cce);
643 } catch (HL7Exception he) {
644 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
645 throw new RuntimeException(he);
646 }
647 return ret;
648 }
649
650
651 /**
652 * Returns a count of the current number of repetitions of Specimen Priorities (OM4-13).
653 * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
654 * it will return zero.
655 */
656 public int getOm413_SpecimenPrioritiesReps() {
657 ID[] ret = null;
658 try {
659 Type[] t = this.getField(13);
660 return t.length;
661 } catch (ClassCastException cce) {
662 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
663 throw new RuntimeException(cce);
664 } catch (HL7Exception he) {
665 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
666 throw new RuntimeException(he);
667 }
668 }
669
670
671
672 /**
673 * Inserts a repetition of
674 * OM4-13: "Specimen Priorities" at a specific index
675 *
676 * @param rep The repetition index (0-indexed)
677 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
678 */
679 public ID insertSpecimenPriorities(int rep) throws HL7Exception {
680 return (ID) super.insertRepetition(13, rep);
681 }
682
683
684
685 /**
686 * Inserts a repetition of
687 * OM4-13: "Specimen Priorities" at a specific index
688 *
689 * @param rep The repetition index (0-indexed)
690 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
691 */
692 public ID insertOm413_SpecimenPriorities(int rep) throws HL7Exception {
693 return (ID) super.insertRepetition(13, rep);
694 }
695
696
697 /**
698 * Removes a repetition of
699 * OM4-13: "Specimen Priorities" at a specific index
700 *
701 * @param rep The repetition index (0-indexed)
702 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
703 */
704 public ID removeSpecimenPriorities(int rep) throws HL7Exception {
705 return (ID) super.removeRepetition(13, rep);
706 }
707
708
709 /**
710 * Removes a repetition of
711 * OM4-13: "Specimen Priorities" at a specific index
712 *
713 * @param rep The repetition index (0-indexed)
714 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
715 */
716 public ID removeOm413_SpecimenPriorities(int rep) throws HL7Exception {
717 return (ID) super.removeRepetition(13, rep);
718 }
719
720
721
722
723 /**
724 * Returns
725 * OM4-14: "Specimen Retention Time" - creates it if necessary
726 */
727 public CQ getSpecimenRetentionTime() {
728 CQ ret = null;
729 try {
730 Type t = this.getField(14, 0);
731 ret = (CQ)t;
732 } catch (ClassCastException cce) {
733 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
734 throw new RuntimeException(cce);
735 } catch (HL7Exception he) {
736 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
737 throw new RuntimeException(he);
738 }
739 return ret;
740 }
741
742
743 /**
744 * Returns
745 * OM4-14: "Specimen Retention Time" - creates it if necessary
746 */
747 public CQ getOm414_SpecimenRetentionTime() {
748 CQ ret = null;
749 try {
750 Type t = this.getField(14, 0);
751 ret = (CQ)t;
752 } catch (ClassCastException cce) {
753 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
754 throw new RuntimeException(cce);
755 } catch (HL7Exception he) {
756 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
757 throw new RuntimeException(he);
758 }
759 return ret;
760 }
761
762
763
764
765
766 /** {@inheritDoc} */
767 protected Type createNewTypeWithoutReflection(int field) {
768 switch (field) {
769 case 0: return new NM(getMessage());
770 case 1: return new ID(getMessage(), new Integer( 170 ));
771 case 2: return new TX(getMessage());
772 case 3: return new NM(getMessage());
773 case 4: return new CE(getMessage());
774 case 5: return new CE(getMessage());
775 case 6: return new CE(getMessage());
776 case 7: return new TX(getMessage());
777 case 8: return new TX(getMessage());
778 case 9: return new CQ(getMessage());
779 case 10: return new CQ(getMessage());
780 case 11: return new TX(getMessage());
781 case 12: return new ID(getMessage(), new Integer( 27 ));
782 case 13: return new CQ(getMessage());
783 default: return null;
784 }
785 }
786
787
788 }
789