View Javadoc
1   /*
2    * This class is an auto-generated source file for a HAPI
3    * HL7 v2.x standard structure class.
4    *
5    * For more information, visit: http://hl7api.sourceforge.net/
6    * 
7    * The contents of this file are subject to the Mozilla Public License Version 1.1 
8    * (the "License"); you may not use this file except in compliance with the License. 
9    * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
10   * Software distributed under the License is distributed on an "AS IS" basis, 
11   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
12   * specific language governing rights and limitations under the License. 
13   * 
14   * The Original Code is "[file_name]".  Description: 
15   * "[one_line_description]" 
16   * 
17   * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
18   * 2012.  All Rights Reserved. 
19   * 
20   * Contributor(s): ______________________________________. 
21   * 
22   * Alternatively, the contents of this file may be used under the terms of the 
23   * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
24   * applicable instead of those above.  If you wish to allow use of your version of this 
25   * file only under the terms of the GPL and not to allow others to use your version 
26   * of this file under the MPL, indicate your decision by deleting  the provisions above 
27   * and replace  them with the notice and other provisions required by the GPL License.  
28   * If you do not delete the provisions above, a recipient may use your version of 
29   * this file under either the MPL or the GPL. 
30   * 
31   */
32  
33  
34  package ca.uhn.hl7v2.model.v24.segment;
35  
36  // import ca.uhn.hl7v2.model.v24.group.*;
37  import ca.uhn.hl7v2.model.v24.datatype.*;
38  import ca.uhn.hl7v2.HL7Exception;
39  import ca.uhn.hl7v2.parser.ModelClassFactory;
40  import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
41  import ca.uhn.hl7v2.model.AbstractMessage;
42  import ca.uhn.hl7v2.model.Group;
43  import ca.uhn.hl7v2.model.Type;
44  import ca.uhn.hl7v2.model.AbstractSegment;
45  import ca.uhn.hl7v2.model.Varies;
46  
47  
48  /**
49   *<p>Represents an HL7 CM0 message segment (Clinical Study Master). 
50   * This segment has the following fields:</p>
51   * <ul>
52       * <li>CM0-1: Set ID - CM0 (SI) <b>optional </b>
53       * <li>CM0-2: Sponsor Study ID (EI) <b> </b>
54       * <li>CM0-3: Alternate Study ID (EI) <b>optional repeating</b>
55       * <li>CM0-4: Title of Study (ST) <b> </b>
56       * <li>CM0-5: Chairman of Study (XCN) <b>optional repeating</b>
57       * <li>CM0-6: Last IRB Approval Date (DT) <b>optional </b>
58       * <li>CM0-7: Total Accrual to Date (NM) <b>optional </b>
59       * <li>CM0-8: Last Accrual Date (DT) <b>optional </b>
60       * <li>CM0-9: Contact for Study (XCN) <b>optional repeating</b>
61       * <li>CM0-10: Contact's Telephone Number (XTN) <b>optional </b>
62       * <li>CM0-11: Contact's Address (XAD) <b>optional repeating</b>
63   * </ul>
64   */
65  @SuppressWarnings("unused")
66  public class CM0 extends AbstractSegment {
67  
68      /** 
69       * Creates a new CM0 segment
70       */
71      public CM0(Group parent, ModelClassFactory factory) {
72         super(parent, factory);
73         init(factory);
74      }
75  
76      private void init(ModelClassFactory factory) {
77         try {
78                                    this.add(SI.class, false, 1, 4, new Object[]{ getMessage() }, "Set ID - CM0");
79                                    this.add(EI.class, true, 1, 60, new Object[]{ getMessage() }, "Sponsor Study ID");
80                                    this.add(EI.class, false, 3, 60, new Object[]{ getMessage() }, "Alternate Study ID");
81                                    this.add(ST.class, true, 1, 300, new Object[]{ getMessage() }, "Title of Study");
82                                    this.add(XCN.class, false, 0, 250, new Object[]{ getMessage() }, "Chairman of Study");
83                                    this.add(DT.class, false, 1, 8, new Object[]{ getMessage() }, "Last IRB Approval Date");
84                                    this.add(NM.class, false, 1, 8, new Object[]{ getMessage() }, "Total Accrual to Date");
85                                    this.add(DT.class, false, 1, 8, new Object[]{ getMessage() }, "Last Accrual Date");
86                                    this.add(XCN.class, false, 0, 250, new Object[]{ getMessage() }, "Contact for Study");
87                                    this.add(XTN.class, false, 1, 250, new Object[]{ getMessage() }, "Contact's Telephone Number");
88                                    this.add(XAD.class, false, 0, 250, new Object[]{ getMessage() }, "Contact's Address");
89         } catch(HL7Exception e) {
90            log.error("Unexpected error creating CM0 - this is probably a bug in the source code generator.", e);
91         }
92      }
93  
94  
95  
96      /**
97       * Returns
98       * CM0-1: "Set ID - CM0" - creates it if necessary
99       */
100     public SI getSetIDCM0() { 
101 		SI retVal = this.getTypedField(1, 0);
102 		return retVal;
103     }
104     
105     /**
106      * Returns
107      * CM0-1: "Set ID - CM0" - creates it if necessary
108      */
109     public SI getCm01_SetIDCM0() { 
110 		SI retVal = this.getTypedField(1, 0);
111 		return retVal;
112     }
113 
114 
115 
116     /**
117      * Returns
118      * CM0-2: "Sponsor Study ID" - creates it if necessary
119      */
120     public EI getSponsorStudyID() { 
121 		EI retVal = this.getTypedField(2, 0);
122 		return retVal;
123     }
124     
125     /**
126      * Returns
127      * CM0-2: "Sponsor Study ID" - creates it if necessary
128      */
129     public EI getCm02_SponsorStudyID() { 
130 		EI retVal = this.getTypedField(2, 0);
131 		return retVal;
132     }
133 
134 
135     /**
136      * Returns all repetitions of Alternate Study ID (CM0-3).
137      */
138     public EI[] getAlternateStudyID() {
139     	EI[] retVal = this.getTypedField(3, new EI[0]);
140     	return retVal;
141     }
142 
143 
144     /**
145      * Returns all repetitions of Alternate Study ID (CM0-3).
146      */
147     public EI[] getCm03_AlternateStudyID() {
148     	EI[] retVal = this.getTypedField(3, new EI[0]);
149     	return retVal;
150     }
151 
152 
153     /**
154      * Returns a count of the current number of repetitions of Alternate Study ID (CM0-3).
155      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
156      * it will return zero.
157      */
158     public int getAlternateStudyIDReps() {
159     	return this.getReps(3);
160     }
161 
162 
163     /**
164      * Returns a specific repetition of
165      * CM0-3: "Alternate Study ID" - creates it if necessary
166      *
167      * @param rep The repetition index (0-indexed)
168      */
169     public EI getAlternateStudyID(int rep) { 
170 		EI retVal = this.getTypedField(3, rep);
171 		return retVal;
172     }
173 
174     /**
175      * Returns a specific repetition of
176      * CM0-3: "Alternate Study ID" - creates it if necessary
177      *
178      * @param rep The repetition index (0-indexed)
179      */
180     public EI getCm03_AlternateStudyID(int rep) { 
181 		EI retVal = this.getTypedField(3, rep);
182 		return retVal;
183     }
184 
185     /**
186      * Returns a count of the current number of repetitions of Alternate Study ID (CM0-3).
187      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
188      * it will return zero.
189      */
190     public int getCm03_AlternateStudyIDReps() {
191     	return this.getReps(3);
192     }
193 
194 
195     /**
196      * Inserts a repetition of
197      * CM0-3: "Alternate Study ID" at a specific index
198      *
199      * @param rep The repetition index (0-indexed)
200      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
201      */
202     public EI insertAlternateStudyID(int rep) throws HL7Exception { 
203         return (EI) super.insertRepetition(3, rep);
204     }
205 
206 
207     /**
208      * Inserts a repetition of
209      * CM0-3: "Alternate Study ID" at a specific index
210      *
211      * @param rep The repetition index (0-indexed)
212      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
213      */
214     public EI insertCm03_AlternateStudyID(int rep) throws HL7Exception { 
215         return (EI) super.insertRepetition(3, rep);
216     }
217 
218 
219     /**
220      * Removes a repetition of
221      * CM0-3: "Alternate Study ID" at a specific index
222      *
223      * @param rep The repetition index (0-indexed)
224      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
225      */
226     public EI removeAlternateStudyID(int rep) throws HL7Exception { 
227         return (EI) super.removeRepetition(3, rep);
228     }
229 
230 
231     /**
232      * Removes a repetition of
233      * CM0-3: "Alternate Study ID" at a specific index
234      *
235      * @param rep The repetition index (0-indexed)
236      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
237      */
238     public EI removeCm03_AlternateStudyID(int rep) throws HL7Exception { 
239         return (EI) super.removeRepetition(3, rep);
240     }
241 
242 
243 
244 
245     /**
246      * Returns
247      * CM0-4: "Title of Study" - creates it if necessary
248      */
249     public ST getTitleOfStudy() { 
250 		ST retVal = this.getTypedField(4, 0);
251 		return retVal;
252     }
253     
254     /**
255      * Returns
256      * CM0-4: "Title of Study" - creates it if necessary
257      */
258     public ST getCm04_TitleOfStudy() { 
259 		ST retVal = this.getTypedField(4, 0);
260 		return retVal;
261     }
262 
263 
264     /**
265      * Returns all repetitions of Chairman of Study (CM0-5).
266      */
267     public XCN[] getChairmanOfStudy() {
268     	XCN[] retVal = this.getTypedField(5, new XCN[0]);
269     	return retVal;
270     }
271 
272 
273     /**
274      * Returns all repetitions of Chairman of Study (CM0-5).
275      */
276     public XCN[] getCm05_ChairmanOfStudy() {
277     	XCN[] retVal = this.getTypedField(5, new XCN[0]);
278     	return retVal;
279     }
280 
281 
282     /**
283      * Returns a count of the current number of repetitions of Chairman of Study (CM0-5).
284      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
285      * it will return zero.
286      */
287     public int getChairmanOfStudyReps() {
288     	return this.getReps(5);
289     }
290 
291 
292     /**
293      * Returns a specific repetition of
294      * CM0-5: "Chairman of Study" - creates it if necessary
295      *
296      * @param rep The repetition index (0-indexed)
297      */
298     public XCN getChairmanOfStudy(int rep) { 
299 		XCN retVal = this.getTypedField(5, rep);
300 		return retVal;
301     }
302 
303     /**
304      * Returns a specific repetition of
305      * CM0-5: "Chairman of Study" - creates it if necessary
306      *
307      * @param rep The repetition index (0-indexed)
308      */
309     public XCN getCm05_ChairmanOfStudy(int rep) { 
310 		XCN retVal = this.getTypedField(5, rep);
311 		return retVal;
312     }
313 
314     /**
315      * Returns a count of the current number of repetitions of Chairman of Study (CM0-5).
316      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
317      * it will return zero.
318      */
319     public int getCm05_ChairmanOfStudyReps() {
320     	return this.getReps(5);
321     }
322 
323 
324     /**
325      * Inserts a repetition of
326      * CM0-5: "Chairman of Study" at a specific index
327      *
328      * @param rep The repetition index (0-indexed)
329      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
330      */
331     public XCN insertChairmanOfStudy(int rep) throws HL7Exception { 
332         return (XCN) super.insertRepetition(5, rep);
333     }
334 
335 
336     /**
337      * Inserts a repetition of
338      * CM0-5: "Chairman of Study" at a specific index
339      *
340      * @param rep The repetition index (0-indexed)
341      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
342      */
343     public XCN insertCm05_ChairmanOfStudy(int rep) throws HL7Exception { 
344         return (XCN) super.insertRepetition(5, rep);
345     }
346 
347 
348     /**
349      * Removes a repetition of
350      * CM0-5: "Chairman of Study" at a specific index
351      *
352      * @param rep The repetition index (0-indexed)
353      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
354      */
355     public XCN removeChairmanOfStudy(int rep) throws HL7Exception { 
356         return (XCN) super.removeRepetition(5, rep);
357     }
358 
359 
360     /**
361      * Removes a repetition of
362      * CM0-5: "Chairman of Study" at a specific index
363      *
364      * @param rep The repetition index (0-indexed)
365      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
366      */
367     public XCN removeCm05_ChairmanOfStudy(int rep) throws HL7Exception { 
368         return (XCN) super.removeRepetition(5, rep);
369     }
370 
371 
372 
373 
374     /**
375      * Returns
376      * CM0-6: "Last IRB Approval Date" - creates it if necessary
377      */
378     public DT getLastIRBApprovalDate() { 
379 		DT retVal = this.getTypedField(6, 0);
380 		return retVal;
381     }
382     
383     /**
384      * Returns
385      * CM0-6: "Last IRB Approval Date" - creates it if necessary
386      */
387     public DT getCm06_LastIRBApprovalDate() { 
388 		DT retVal = this.getTypedField(6, 0);
389 		return retVal;
390     }
391 
392 
393 
394     /**
395      * Returns
396      * CM0-7: "Total Accrual to Date" - creates it if necessary
397      */
398     public NM getTotalAccrualToDate() { 
399 		NM retVal = this.getTypedField(7, 0);
400 		return retVal;
401     }
402     
403     /**
404      * Returns
405      * CM0-7: "Total Accrual to Date" - creates it if necessary
406      */
407     public NM getCm07_TotalAccrualToDate() { 
408 		NM retVal = this.getTypedField(7, 0);
409 		return retVal;
410     }
411 
412 
413 
414     /**
415      * Returns
416      * CM0-8: "Last Accrual Date" - creates it if necessary
417      */
418     public DT getLastAccrualDate() { 
419 		DT retVal = this.getTypedField(8, 0);
420 		return retVal;
421     }
422     
423     /**
424      * Returns
425      * CM0-8: "Last Accrual Date" - creates it if necessary
426      */
427     public DT getCm08_LastAccrualDate() { 
428 		DT retVal = this.getTypedField(8, 0);
429 		return retVal;
430     }
431 
432 
433     /**
434      * Returns all repetitions of Contact for Study (CM0-9).
435      */
436     public XCN[] getContactForStudy() {
437     	XCN[] retVal = this.getTypedField(9, new XCN[0]);
438     	return retVal;
439     }
440 
441 
442     /**
443      * Returns all repetitions of Contact for Study (CM0-9).
444      */
445     public XCN[] getCm09_ContactForStudy() {
446     	XCN[] retVal = this.getTypedField(9, new XCN[0]);
447     	return retVal;
448     }
449 
450 
451     /**
452      * Returns a count of the current number of repetitions of Contact for Study (CM0-9).
453      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
454      * it will return zero.
455      */
456     public int getContactForStudyReps() {
457     	return this.getReps(9);
458     }
459 
460 
461     /**
462      * Returns a specific repetition of
463      * CM0-9: "Contact for Study" - creates it if necessary
464      *
465      * @param rep The repetition index (0-indexed)
466      */
467     public XCN getContactForStudy(int rep) { 
468 		XCN retVal = this.getTypedField(9, rep);
469 		return retVal;
470     }
471 
472     /**
473      * Returns a specific repetition of
474      * CM0-9: "Contact for Study" - creates it if necessary
475      *
476      * @param rep The repetition index (0-indexed)
477      */
478     public XCN getCm09_ContactForStudy(int rep) { 
479 		XCN retVal = this.getTypedField(9, rep);
480 		return retVal;
481     }
482 
483     /**
484      * Returns a count of the current number of repetitions of Contact for Study (CM0-9).
485      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
486      * it will return zero.
487      */
488     public int getCm09_ContactForStudyReps() {
489     	return this.getReps(9);
490     }
491 
492 
493     /**
494      * Inserts a repetition of
495      * CM0-9: "Contact for Study" at a specific index
496      *
497      * @param rep The repetition index (0-indexed)
498      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
499      */
500     public XCN insertContactForStudy(int rep) throws HL7Exception { 
501         return (XCN) super.insertRepetition(9, rep);
502     }
503 
504 
505     /**
506      * Inserts a repetition of
507      * CM0-9: "Contact for Study" at a specific index
508      *
509      * @param rep The repetition index (0-indexed)
510      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
511      */
512     public XCN insertCm09_ContactForStudy(int rep) throws HL7Exception { 
513         return (XCN) super.insertRepetition(9, rep);
514     }
515 
516 
517     /**
518      * Removes a repetition of
519      * CM0-9: "Contact for Study" at a specific index
520      *
521      * @param rep The repetition index (0-indexed)
522      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
523      */
524     public XCN removeContactForStudy(int rep) throws HL7Exception { 
525         return (XCN) super.removeRepetition(9, rep);
526     }
527 
528 
529     /**
530      * Removes a repetition of
531      * CM0-9: "Contact for Study" at a specific index
532      *
533      * @param rep The repetition index (0-indexed)
534      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
535      */
536     public XCN removeCm09_ContactForStudy(int rep) throws HL7Exception { 
537         return (XCN) super.removeRepetition(9, rep);
538     }
539 
540 
541 
542 
543     /**
544      * Returns
545      * CM0-10: "Contact's Telephone Number" - creates it if necessary
546      */
547     public XTN getContactSTelephoneNumber() { 
548 		XTN retVal = this.getTypedField(10, 0);
549 		return retVal;
550     }
551     
552     /**
553      * Returns
554      * CM0-10: "Contact's Telephone Number" - creates it if necessary
555      */
556     public XTN getCm010_ContactSTelephoneNumber() { 
557 		XTN retVal = this.getTypedField(10, 0);
558 		return retVal;
559     }
560 
561 
562     /**
563      * Returns all repetitions of Contact's Address (CM0-11).
564      */
565     public XAD[] getContactSAddress() {
566     	XAD[] retVal = this.getTypedField(11, new XAD[0]);
567     	return retVal;
568     }
569 
570 
571     /**
572      * Returns all repetitions of Contact's Address (CM0-11).
573      */
574     public XAD[] getCm011_ContactSAddress() {
575     	XAD[] retVal = this.getTypedField(11, new XAD[0]);
576     	return retVal;
577     }
578 
579 
580     /**
581      * Returns a count of the current number of repetitions of Contact's Address (CM0-11).
582      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
583      * it will return zero.
584      */
585     public int getContactSAddressReps() {
586     	return this.getReps(11);
587     }
588 
589 
590     /**
591      * Returns a specific repetition of
592      * CM0-11: "Contact's Address" - creates it if necessary
593      *
594      * @param rep The repetition index (0-indexed)
595      */
596     public XAD getContactSAddress(int rep) { 
597 		XAD retVal = this.getTypedField(11, rep);
598 		return retVal;
599     }
600 
601     /**
602      * Returns a specific repetition of
603      * CM0-11: "Contact's Address" - creates it if necessary
604      *
605      * @param rep The repetition index (0-indexed)
606      */
607     public XAD getCm011_ContactSAddress(int rep) { 
608 		XAD retVal = this.getTypedField(11, rep);
609 		return retVal;
610     }
611 
612     /**
613      * Returns a count of the current number of repetitions of Contact's Address (CM0-11).
614      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
615      * it will return zero.
616      */
617     public int getCm011_ContactSAddressReps() {
618     	return this.getReps(11);
619     }
620 
621 
622     /**
623      * Inserts a repetition of
624      * CM0-11: "Contact's Address" at a specific index
625      *
626      * @param rep The repetition index (0-indexed)
627      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
628      */
629     public XAD insertContactSAddress(int rep) throws HL7Exception { 
630         return (XAD) super.insertRepetition(11, rep);
631     }
632 
633 
634     /**
635      * Inserts a repetition of
636      * CM0-11: "Contact's Address" at a specific index
637      *
638      * @param rep The repetition index (0-indexed)
639      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
640      */
641     public XAD insertCm011_ContactSAddress(int rep) throws HL7Exception { 
642         return (XAD) super.insertRepetition(11, rep);
643     }
644 
645 
646     /**
647      * Removes a repetition of
648      * CM0-11: "Contact's Address" at a specific index
649      *
650      * @param rep The repetition index (0-indexed)
651      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
652      */
653     public XAD removeContactSAddress(int rep) throws HL7Exception { 
654         return (XAD) super.removeRepetition(11, rep);
655     }
656 
657 
658     /**
659      * Removes a repetition of
660      * CM0-11: "Contact's Address" at a specific index
661      *
662      * @param rep The repetition index (0-indexed)
663      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
664      */
665     public XAD removeCm011_ContactSAddress(int rep) throws HL7Exception { 
666         return (XAD) super.removeRepetition(11, rep);
667     }
668 
669 
670 
671 
672 
673 
674     /** {@inheritDoc} */   
675     protected Type createNewTypeWithoutReflection(int field) {
676        switch (field) {
677           case 0: return new SI(getMessage());
678           case 1: return new EI(getMessage());
679           case 2: return new EI(getMessage());
680           case 3: return new ST(getMessage());
681           case 4: return new XCN(getMessage());
682           case 5: return new DT(getMessage());
683           case 6: return new NM(getMessage());
684           case 7: return new DT(getMessage());
685           case 8: return new XCN(getMessage());
686           case 9: return new XTN(getMessage());
687           case 10: return new XAD(getMessage());
688           default: return null;
689        }
690    }
691 
692 
693 }
694