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