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 CM0 message segment (Clinical Study Master).
024 * This segment has the following fields:</p>
025 * <ul>
026 * <li>CM0-1: Set ID - CM0 (SI) <b>optional </b>
027 * <li>CM0-2: Sponsor Study ID (EI) <b> </b>
028 * <li>CM0-3: Alternate Study ID (EI) <b>optional repeating</b>
029 * <li>CM0-4: Title of Study (ST) <b> </b>
030 * <li>CM0-5: Chairman of Study (XCN) <b>optional repeating</b>
031 * <li>CM0-6: Last IRB Approval Date (DT) <b>optional </b>
032 * <li>CM0-7: Total Accrual to Date (NM) <b>optional </b>
033 * <li>CM0-8: Last Accrual Date (DT) <b>optional </b>
034 * <li>CM0-9: Contact for Study (XCN) <b>optional repeating</b>
035 * <li>CM0-10: Contact's Telephone Number (XTN) <b>optional </b>
036 * <li>CM0-11: Contact's Address (XAD) <b>optional repeating</b>
037 * </ul>
038 */
039 public class CM0 extends AbstractSegment {
040
041 /**
042 * Creates a new CM0 segment
043 */
044 public CM0(Group parent, ModelClassFactory factory) {
045 super(parent, factory);
046 init(factory);
047 }
048
049 private void init(ModelClassFactory factory) {
050 try {
051 this.add(SI.class, false, 1, 4, new Object[]{ getMessage(), new Integer(0) }, "Set ID - CM0");
052 this.add(EI.class, true, 1, 60, new Object[]{ getMessage(), new Integer(0) }, "Sponsor Study ID");
053 this.add(EI.class, false, 3, 60, new Object[]{ getMessage(), new Integer(0) }, "Alternate Study ID");
054 this.add(ST.class, true, 1, 300, new Object[]{ getMessage(), new Integer(0) }, "Title of Study");
055 this.add(XCN.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Chairman of Study");
056 this.add(DT.class, false, 1, 8, new Object[]{ getMessage(), new Integer(0) }, "Last IRB Approval Date");
057 this.add(NM.class, false, 1, 8, new Object[]{ getMessage(), new Integer(0) }, "Total Accrual to Date");
058 this.add(DT.class, false, 1, 8, new Object[]{ getMessage(), new Integer(0) }, "Last Accrual Date");
059 this.add(XCN.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Contact for Study");
060 this.add(XTN.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Contact's Telephone Number");
061 this.add(XAD.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Contact's Address");
062 } catch(HL7Exception e) {
063 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating CM0 - this is probably a bug in the source code generator.", e);
064 }
065 }
066
067
068
069 /**
070 * Returns
071 * CM0-1: "Set ID - CM0" - creates it if necessary
072 */
073 public SI getSetIDCM0() {
074 SI ret = null;
075 try {
076 Type t = this.getField(1, 0);
077 ret = (SI)t;
078 } catch (ClassCastException cce) {
079 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
080 throw new RuntimeException(cce);
081 } catch (HL7Exception he) {
082 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
083 throw new RuntimeException(he);
084 }
085 return ret;
086 }
087
088
089 /**
090 * Returns
091 * CM0-1: "Set ID - CM0" - creates it if necessary
092 */
093 public SI getCm01_SetIDCM0() {
094 SI ret = null;
095 try {
096 Type t = this.getField(1, 0);
097 ret = (SI)t;
098 } catch (ClassCastException cce) {
099 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
100 throw new RuntimeException(cce);
101 } catch (HL7Exception he) {
102 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
103 throw new RuntimeException(he);
104 }
105 return ret;
106 }
107
108
109
110 /**
111 * Returns
112 * CM0-2: "Sponsor Study ID" - creates it if necessary
113 */
114 public EI getSponsorStudyID() {
115 EI ret = null;
116 try {
117 Type t = this.getField(2, 0);
118 ret = (EI)t;
119 } catch (ClassCastException cce) {
120 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
121 throw new RuntimeException(cce);
122 } catch (HL7Exception he) {
123 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
124 throw new RuntimeException(he);
125 }
126 return ret;
127 }
128
129
130 /**
131 * Returns
132 * CM0-2: "Sponsor Study ID" - creates it if necessary
133 */
134 public EI getCm02_SponsorStudyID() {
135 EI ret = null;
136 try {
137 Type t = this.getField(2, 0);
138 ret = (EI)t;
139 } catch (ClassCastException cce) {
140 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
141 throw new RuntimeException(cce);
142 } catch (HL7Exception he) {
143 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
144 throw new RuntimeException(he);
145 }
146 return ret;
147 }
148
149
150 /**
151 * Returns all repetitions of Alternate Study ID (CM0-3).
152 */
153 public EI[] getAlternateStudyID() {
154 EI[] ret = null;
155 try {
156 Type[] t = this.getField(3);
157 ret = new EI[t.length];
158 for (int i = 0; i < ret.length; i++) {
159 ret[i] = (EI)t[i];
160 }
161 } catch (ClassCastException cce) {
162 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
163 throw new RuntimeException(cce);
164 } catch (HL7Exception he) {
165 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
166 throw new RuntimeException(he);
167 }
168 return ret;
169 }
170
171
172 /**
173 * Returns a count of the current number of repetitions of Alternate Study ID (CM0-3).
174 * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
175 * it will return zero.
176 */
177 public int getAlternateStudyIDReps() {
178 EI[] ret = null;
179 try {
180 Type[] t = this.getField(3);
181 return t.length;
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 }
190
191
192 /**
193 * Returns a specific repetition of
194 * CM0-3: "Alternate Study ID" - creates it if necessary
195 *
196 * @param rep The repetition index (0-indexed)
197 */
198 public EI getAlternateStudyID(int rep) {
199 EI ret = null;
200 try {
201 Type t = this.getField(3, rep);
202 ret = (EI)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 * Returns a specific repetition of
215 * CM0-3: "Alternate Study ID" - creates it if necessary
216 *
217 * @param rep The repetition index (0-indexed)
218 */
219 public EI getCm03_AlternateStudyID(int rep) {
220 EI ret = null;
221 try {
222 Type t = this.getField(3, rep);
223 ret = (EI)t;
224 } catch (ClassCastException cce) {
225 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
226 throw new RuntimeException(cce);
227 } catch (HL7Exception he) {
228 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
229 throw new RuntimeException(he);
230 }
231 return ret;
232 }
233
234
235 /**
236 * Returns a count of the current number of repetitions of Alternate Study ID (CM0-3).
237 * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
238 * it will return zero.
239 */
240 public int getCm03_AlternateStudyIDReps() {
241 EI[] ret = null;
242 try {
243 Type[] t = this.getField(3);
244 return t.length;
245 } catch (ClassCastException cce) {
246 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
247 throw new RuntimeException(cce);
248 } catch (HL7Exception he) {
249 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
250 throw new RuntimeException(he);
251 }
252 }
253
254
255
256 /**
257 * Inserts a repetition of
258 * CM0-3: "Alternate Study ID" at a specific index
259 *
260 * @param rep The repetition index (0-indexed)
261 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
262 */
263 public EI insertAlternateStudyID(int rep) throws HL7Exception {
264 return (EI) super.insertRepetition(3, rep);
265 }
266
267
268
269 /**
270 * Inserts a repetition of
271 * CM0-3: "Alternate Study ID" at a specific index
272 *
273 * @param rep The repetition index (0-indexed)
274 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
275 */
276 public EI insertCm03_AlternateStudyID(int rep) throws HL7Exception {
277 return (EI) super.insertRepetition(3, rep);
278 }
279
280
281 /**
282 * Removes a repetition of
283 * CM0-3: "Alternate Study ID" at a specific index
284 *
285 * @param rep The repetition index (0-indexed)
286 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
287 */
288 public EI removeAlternateStudyID(int rep) throws HL7Exception {
289 return (EI) super.removeRepetition(3, rep);
290 }
291
292
293 /**
294 * Removes a repetition of
295 * CM0-3: "Alternate Study ID" at a specific index
296 *
297 * @param rep The repetition index (0-indexed)
298 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
299 */
300 public EI removeCm03_AlternateStudyID(int rep) throws HL7Exception {
301 return (EI) super.removeRepetition(3, rep);
302 }
303
304
305
306
307 /**
308 * Returns
309 * CM0-4: "Title of Study" - creates it if necessary
310 */
311 public ST getTitleOfStudy() {
312 ST ret = null;
313 try {
314 Type t = this.getField(4, 0);
315 ret = (ST)t;
316 } catch (ClassCastException cce) {
317 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
318 throw new RuntimeException(cce);
319 } catch (HL7Exception he) {
320 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
321 throw new RuntimeException(he);
322 }
323 return ret;
324 }
325
326
327 /**
328 * Returns
329 * CM0-4: "Title of Study" - creates it if necessary
330 */
331 public ST getCm04_TitleOfStudy() {
332 ST ret = null;
333 try {
334 Type t = this.getField(4, 0);
335 ret = (ST)t;
336 } catch (ClassCastException cce) {
337 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
338 throw new RuntimeException(cce);
339 } catch (HL7Exception he) {
340 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
341 throw new RuntimeException(he);
342 }
343 return ret;
344 }
345
346
347 /**
348 * Returns all repetitions of Chairman of Study (CM0-5).
349 */
350 public XCN[] getChairmanOfStudy() {
351 XCN[] ret = null;
352 try {
353 Type[] t = this.getField(5);
354 ret = new XCN[t.length];
355 for (int i = 0; i < ret.length; i++) {
356 ret[i] = (XCN)t[i];
357 }
358 } catch (ClassCastException cce) {
359 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
360 throw new RuntimeException(cce);
361 } catch (HL7Exception he) {
362 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
363 throw new RuntimeException(he);
364 }
365 return ret;
366 }
367
368
369 /**
370 * Returns a count of the current number of repetitions of Chairman of Study (CM0-5).
371 * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
372 * it will return zero.
373 */
374 public int getChairmanOfStudyReps() {
375 XCN[] ret = null;
376 try {
377 Type[] t = this.getField(5);
378 return t.length;
379 } catch (ClassCastException cce) {
380 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
381 throw new RuntimeException(cce);
382 } catch (HL7Exception he) {
383 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
384 throw new RuntimeException(he);
385 }
386 }
387
388
389 /**
390 * Returns a specific repetition of
391 * CM0-5: "Chairman of Study" - creates it if necessary
392 *
393 * @param rep The repetition index (0-indexed)
394 */
395 public XCN getChairmanOfStudy(int rep) {
396 XCN ret = null;
397 try {
398 Type t = this.getField(5, rep);
399 ret = (XCN)t;
400 } catch (ClassCastException cce) {
401 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
402 throw new RuntimeException(cce);
403 } catch (HL7Exception he) {
404 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
405 throw new RuntimeException(he);
406 }
407 return ret;
408 }
409
410 /**
411 * Returns a specific repetition of
412 * CM0-5: "Chairman of Study" - creates it if necessary
413 *
414 * @param rep The repetition index (0-indexed)
415 */
416 public XCN getCm05_ChairmanOfStudy(int rep) {
417 XCN ret = null;
418 try {
419 Type t = this.getField(5, rep);
420 ret = (XCN)t;
421 } catch (ClassCastException cce) {
422 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
423 throw new RuntimeException(cce);
424 } catch (HL7Exception he) {
425 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
426 throw new RuntimeException(he);
427 }
428 return ret;
429 }
430
431
432 /**
433 * Returns a count of the current number of repetitions of Chairman of Study (CM0-5).
434 * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
435 * it will return zero.
436 */
437 public int getCm05_ChairmanOfStudyReps() {
438 XCN[] ret = null;
439 try {
440 Type[] t = this.getField(5);
441 return t.length;
442 } catch (ClassCastException cce) {
443 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
444 throw new RuntimeException(cce);
445 } catch (HL7Exception he) {
446 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
447 throw new RuntimeException(he);
448 }
449 }
450
451
452
453 /**
454 * Inserts a repetition of
455 * CM0-5: "Chairman of Study" at a specific index
456 *
457 * @param rep The repetition index (0-indexed)
458 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
459 */
460 public XCN insertChairmanOfStudy(int rep) throws HL7Exception {
461 return (XCN) super.insertRepetition(5, rep);
462 }
463
464
465
466 /**
467 * Inserts a repetition of
468 * CM0-5: "Chairman of Study" at a specific index
469 *
470 * @param rep The repetition index (0-indexed)
471 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
472 */
473 public XCN insertCm05_ChairmanOfStudy(int rep) throws HL7Exception {
474 return (XCN) super.insertRepetition(5, rep);
475 }
476
477
478 /**
479 * Removes a repetition of
480 * CM0-5: "Chairman of Study" at a specific index
481 *
482 * @param rep The repetition index (0-indexed)
483 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
484 */
485 public XCN removeChairmanOfStudy(int rep) throws HL7Exception {
486 return (XCN) super.removeRepetition(5, rep);
487 }
488
489
490 /**
491 * Removes a repetition of
492 * CM0-5: "Chairman of Study" at a specific index
493 *
494 * @param rep The repetition index (0-indexed)
495 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
496 */
497 public XCN removeCm05_ChairmanOfStudy(int rep) throws HL7Exception {
498 return (XCN) super.removeRepetition(5, rep);
499 }
500
501
502
503
504 /**
505 * Returns
506 * CM0-6: "Last IRB Approval Date" - creates it if necessary
507 */
508 public DT getLastIRBApprovalDate() {
509 DT ret = null;
510 try {
511 Type t = this.getField(6, 0);
512 ret = (DT)t;
513 } catch (ClassCastException cce) {
514 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
515 throw new RuntimeException(cce);
516 } catch (HL7Exception he) {
517 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
518 throw new RuntimeException(he);
519 }
520 return ret;
521 }
522
523
524 /**
525 * Returns
526 * CM0-6: "Last IRB Approval Date" - creates it if necessary
527 */
528 public DT getCm06_LastIRBApprovalDate() {
529 DT ret = null;
530 try {
531 Type t = this.getField(6, 0);
532 ret = (DT)t;
533 } catch (ClassCastException cce) {
534 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
535 throw new RuntimeException(cce);
536 } catch (HL7Exception he) {
537 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
538 throw new RuntimeException(he);
539 }
540 return ret;
541 }
542
543
544
545 /**
546 * Returns
547 * CM0-7: "Total Accrual to Date" - creates it if necessary
548 */
549 public NM getTotalAccrualToDate() {
550 NM ret = null;
551 try {
552 Type t = this.getField(7, 0);
553 ret = (NM)t;
554 } catch (ClassCastException cce) {
555 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
556 throw new RuntimeException(cce);
557 } catch (HL7Exception he) {
558 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
559 throw new RuntimeException(he);
560 }
561 return ret;
562 }
563
564
565 /**
566 * Returns
567 * CM0-7: "Total Accrual to Date" - creates it if necessary
568 */
569 public NM getCm07_TotalAccrualToDate() {
570 NM ret = null;
571 try {
572 Type t = this.getField(7, 0);
573 ret = (NM)t;
574 } catch (ClassCastException cce) {
575 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
576 throw new RuntimeException(cce);
577 } catch (HL7Exception he) {
578 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
579 throw new RuntimeException(he);
580 }
581 return ret;
582 }
583
584
585
586 /**
587 * Returns
588 * CM0-8: "Last Accrual Date" - creates it if necessary
589 */
590 public DT getLastAccrualDate() {
591 DT ret = null;
592 try {
593 Type t = this.getField(8, 0);
594 ret = (DT)t;
595 } catch (ClassCastException cce) {
596 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
597 throw new RuntimeException(cce);
598 } catch (HL7Exception he) {
599 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
600 throw new RuntimeException(he);
601 }
602 return ret;
603 }
604
605
606 /**
607 * Returns
608 * CM0-8: "Last Accrual Date" - creates it if necessary
609 */
610 public DT getCm08_LastAccrualDate() {
611 DT ret = null;
612 try {
613 Type t = this.getField(8, 0);
614 ret = (DT)t;
615 } catch (ClassCastException cce) {
616 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
617 throw new RuntimeException(cce);
618 } catch (HL7Exception he) {
619 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
620 throw new RuntimeException(he);
621 }
622 return ret;
623 }
624
625
626 /**
627 * Returns all repetitions of Contact for Study (CM0-9).
628 */
629 public XCN[] getContactForStudy() {
630 XCN[] ret = null;
631 try {
632 Type[] t = this.getField(9);
633 ret = new XCN[t.length];
634 for (int i = 0; i < ret.length; i++) {
635 ret[i] = (XCN)t[i];
636 }
637 } catch (ClassCastException cce) {
638 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
639 throw new RuntimeException(cce);
640 } catch (HL7Exception he) {
641 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
642 throw new RuntimeException(he);
643 }
644 return ret;
645 }
646
647
648 /**
649 * Returns a count of the current number of repetitions of Contact for Study (CM0-9).
650 * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
651 * it will return zero.
652 */
653 public int getContactForStudyReps() {
654 XCN[] ret = null;
655 try {
656 Type[] t = this.getField(9);
657 return t.length;
658 } catch (ClassCastException cce) {
659 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
660 throw new RuntimeException(cce);
661 } catch (HL7Exception he) {
662 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
663 throw new RuntimeException(he);
664 }
665 }
666
667
668 /**
669 * Returns a specific repetition of
670 * CM0-9: "Contact for Study" - creates it if necessary
671 *
672 * @param rep The repetition index (0-indexed)
673 */
674 public XCN getContactForStudy(int rep) {
675 XCN ret = null;
676 try {
677 Type t = this.getField(9, rep);
678 ret = (XCN)t;
679 } catch (ClassCastException cce) {
680 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
681 throw new RuntimeException(cce);
682 } catch (HL7Exception he) {
683 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
684 throw new RuntimeException(he);
685 }
686 return ret;
687 }
688
689 /**
690 * Returns a specific repetition of
691 * CM0-9: "Contact for Study" - creates it if necessary
692 *
693 * @param rep The repetition index (0-indexed)
694 */
695 public XCN getCm09_ContactForStudy(int rep) {
696 XCN ret = null;
697 try {
698 Type t = this.getField(9, rep);
699 ret = (XCN)t;
700 } catch (ClassCastException cce) {
701 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
702 throw new RuntimeException(cce);
703 } catch (HL7Exception he) {
704 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
705 throw new RuntimeException(he);
706 }
707 return ret;
708 }
709
710
711 /**
712 * Returns a count of the current number of repetitions of Contact for Study (CM0-9).
713 * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
714 * it will return zero.
715 */
716 public int getCm09_ContactForStudyReps() {
717 XCN[] ret = null;
718 try {
719 Type[] t = this.getField(9);
720 return t.length;
721 } catch (ClassCastException cce) {
722 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
723 throw new RuntimeException(cce);
724 } catch (HL7Exception he) {
725 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
726 throw new RuntimeException(he);
727 }
728 }
729
730
731
732 /**
733 * Inserts a repetition of
734 * CM0-9: "Contact for Study" at a specific index
735 *
736 * @param rep The repetition index (0-indexed)
737 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
738 */
739 public XCN insertContactForStudy(int rep) throws HL7Exception {
740 return (XCN) super.insertRepetition(9, rep);
741 }
742
743
744
745 /**
746 * Inserts a repetition of
747 * CM0-9: "Contact for Study" at a specific index
748 *
749 * @param rep The repetition index (0-indexed)
750 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
751 */
752 public XCN insertCm09_ContactForStudy(int rep) throws HL7Exception {
753 return (XCN) super.insertRepetition(9, rep);
754 }
755
756
757 /**
758 * Removes a repetition of
759 * CM0-9: "Contact for Study" at a specific index
760 *
761 * @param rep The repetition index (0-indexed)
762 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
763 */
764 public XCN removeContactForStudy(int rep) throws HL7Exception {
765 return (XCN) super.removeRepetition(9, rep);
766 }
767
768
769 /**
770 * Removes a repetition of
771 * CM0-9: "Contact for Study" at a specific index
772 *
773 * @param rep The repetition index (0-indexed)
774 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
775 */
776 public XCN removeCm09_ContactForStudy(int rep) throws HL7Exception {
777 return (XCN) super.removeRepetition(9, rep);
778 }
779
780
781
782
783 /**
784 * Returns
785 * CM0-10: "Contact's Telephone Number" - creates it if necessary
786 */
787 public XTN getContactSTelephoneNumber() {
788 XTN ret = null;
789 try {
790 Type t = this.getField(10, 0);
791 ret = (XTN)t;
792 } catch (ClassCastException cce) {
793 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
794 throw new RuntimeException(cce);
795 } catch (HL7Exception he) {
796 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
797 throw new RuntimeException(he);
798 }
799 return ret;
800 }
801
802
803 /**
804 * Returns
805 * CM0-10: "Contact's Telephone Number" - creates it if necessary
806 */
807 public XTN getCm010_ContactSTelephoneNumber() {
808 XTN ret = null;
809 try {
810 Type t = this.getField(10, 0);
811 ret = (XTN)t;
812 } catch (ClassCastException cce) {
813 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
814 throw new RuntimeException(cce);
815 } catch (HL7Exception he) {
816 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
817 throw new RuntimeException(he);
818 }
819 return ret;
820 }
821
822
823 /**
824 * Returns all repetitions of Contact's Address (CM0-11).
825 */
826 public XAD[] getContactSAddress() {
827 XAD[] ret = null;
828 try {
829 Type[] t = this.getField(11);
830 ret = new XAD[t.length];
831 for (int i = 0; i < ret.length; i++) {
832 ret[i] = (XAD)t[i];
833 }
834 } catch (ClassCastException cce) {
835 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
836 throw new RuntimeException(cce);
837 } catch (HL7Exception he) {
838 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
839 throw new RuntimeException(he);
840 }
841 return ret;
842 }
843
844
845 /**
846 * Returns a count of the current number of repetitions of Contact's Address (CM0-11).
847 * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
848 * it will return zero.
849 */
850 public int getContactSAddressReps() {
851 XAD[] ret = null;
852 try {
853 Type[] t = this.getField(11);
854 return t.length;
855 } catch (ClassCastException cce) {
856 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
857 throw new RuntimeException(cce);
858 } catch (HL7Exception he) {
859 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
860 throw new RuntimeException(he);
861 }
862 }
863
864
865 /**
866 * Returns a specific repetition of
867 * CM0-11: "Contact's Address" - creates it if necessary
868 *
869 * @param rep The repetition index (0-indexed)
870 */
871 public XAD getContactSAddress(int rep) {
872 XAD ret = null;
873 try {
874 Type t = this.getField(11, rep);
875 ret = (XAD)t;
876 } catch (ClassCastException cce) {
877 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
878 throw new RuntimeException(cce);
879 } catch (HL7Exception he) {
880 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
881 throw new RuntimeException(he);
882 }
883 return ret;
884 }
885
886 /**
887 * Returns a specific repetition of
888 * CM0-11: "Contact's Address" - creates it if necessary
889 *
890 * @param rep The repetition index (0-indexed)
891 */
892 public XAD getCm011_ContactSAddress(int rep) {
893 XAD ret = null;
894 try {
895 Type t = this.getField(11, rep);
896 ret = (XAD)t;
897 } catch (ClassCastException cce) {
898 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
899 throw new RuntimeException(cce);
900 } catch (HL7Exception he) {
901 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
902 throw new RuntimeException(he);
903 }
904 return ret;
905 }
906
907
908 /**
909 * Returns a count of the current number of repetitions of Contact's Address (CM0-11).
910 * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
911 * it will return zero.
912 */
913 public int getCm011_ContactSAddressReps() {
914 XAD[] ret = null;
915 try {
916 Type[] t = this.getField(11);
917 return t.length;
918 } catch (ClassCastException cce) {
919 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
920 throw new RuntimeException(cce);
921 } catch (HL7Exception he) {
922 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
923 throw new RuntimeException(he);
924 }
925 }
926
927
928
929 /**
930 * Inserts a repetition of
931 * CM0-11: "Contact's Address" at a specific index
932 *
933 * @param rep The repetition index (0-indexed)
934 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
935 */
936 public XAD insertContactSAddress(int rep) throws HL7Exception {
937 return (XAD) super.insertRepetition(11, rep);
938 }
939
940
941
942 /**
943 * Inserts a repetition of
944 * CM0-11: "Contact's Address" at a specific index
945 *
946 * @param rep The repetition index (0-indexed)
947 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
948 */
949 public XAD insertCm011_ContactSAddress(int rep) throws HL7Exception {
950 return (XAD) super.insertRepetition(11, rep);
951 }
952
953
954 /**
955 * Removes a repetition of
956 * CM0-11: "Contact's Address" at a specific index
957 *
958 * @param rep The repetition index (0-indexed)
959 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
960 */
961 public XAD removeContactSAddress(int rep) throws HL7Exception {
962 return (XAD) super.removeRepetition(11, rep);
963 }
964
965
966 /**
967 * Removes a repetition of
968 * CM0-11: "Contact's Address" at a specific index
969 *
970 * @param rep The repetition index (0-indexed)
971 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
972 */
973 public XAD removeCm011_ContactSAddress(int rep) throws HL7Exception {
974 return (XAD) super.removeRepetition(11, rep);
975 }
976
977
978
979
980
981
982 /** {@inheritDoc} */
983 protected Type createNewTypeWithoutReflection(int field) {
984 switch (field) {
985 case 0: return new SI(getMessage());
986 case 1: return new EI(getMessage());
987 case 2: return new EI(getMessage());
988 case 3: return new ST(getMessage());
989 case 4: return new XCN(getMessage());
990 case 5: return new DT(getMessage());
991 case 6: return new NM(getMessage());
992 case 7: return new DT(getMessage());
993 case 8: return new XCN(getMessage());
994 case 9: return new XTN(getMessage());
995 case 10: return new XAD(getMessage());
996 default: return null;
997 }
998 }
999
1000
1001 }
1002