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.v23.segment;
035
036// import ca.uhn.hl7v2.model.v23.group.*;
037import ca.uhn.hl7v2.model.v23.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: CM0 - Set ID (SI) <b>optional </b>
052     * <li>CM0-2: Sponsor Study ID (EI) <b> </b>
053     * <li>CM0-3: Alternate Study ID (CE) <b>optional repeating</b>
054     * <li>CM0-4: Title of Study (ST) <b> </b>
055     * <li>CM0-5: Chairman of Study (XCN) <b>optional </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 </b>
060     * <li>CM0-10: Contact's Tel. Number (XTN) <b>optional </b>
061     * <li>CM0-11: Contact's Address (XAD) <b>optional </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() }, "CM0 - Set ID");
078                                  this.add(EI.class, true, 1, 60, new Object[]{ getMessage() }, "Sponsor Study ID");
079                                  this.add(CE.class, false, 3, 60, 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, 1, 60, 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, 1, 60, new Object[]{ getMessage() }, "Contact for Study");
086                                  this.add(XTN.class, false, 1, 40, new Object[]{ getMessage() }, "Contact's Tel. Number");
087                                  this.add(XAD.class, false, 1, 100, 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: "CM0 - Set ID" - creates it if necessary
098     */
099    public SI getCM0SetID() { 
100                SI retVal = this.getTypedField(1, 0);
101                return retVal;
102    }
103    
104    /**
105     * Returns
106     * CM0-1: "CM0 - Set ID" - creates it if necessary
107     */
108    public SI getCm01_CM0SetID() { 
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 CE[] getAlternateStudyID() {
138        CE[] retVal = this.getTypedField(3, new CE[0]);
139        return retVal;
140    }
141
142
143    /**
144     * Returns all repetitions of Alternate Study ID (CM0-3).
145     */
146    public CE[] getCm03_AlternateStudyID() {
147        CE[] retVal = this.getTypedField(3, new CE[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 CE getAlternateStudyID(int rep) { 
169                CE 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 CE getCm03_AlternateStudyID(int rep) { 
180                CE 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 CE insertAlternateStudyID(int rep) throws HL7Exception { 
202        return (CE) 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 CE insertCm03_AlternateStudyID(int rep) throws HL7Exception { 
214        return (CE) 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 CE removeAlternateStudyID(int rep) throws HL7Exception { 
226        return (CE) 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 CE removeCm03_AlternateStudyID(int rep) throws HL7Exception { 
238        return (CE) 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    /**
265     * Returns
266     * CM0-5: "Chairman of Study" - creates it if necessary
267     */
268    public XCN getChairmanOfStudy() { 
269                XCN retVal = this.getTypedField(5, 0);
270                return retVal;
271    }
272    
273    /**
274     * Returns
275     * CM0-5: "Chairman of Study" - creates it if necessary
276     */
277    public XCN getCm05_ChairmanOfStudy() { 
278                XCN retVal = this.getTypedField(5, 0);
279                return retVal;
280    }
281
282
283
284    /**
285     * Returns
286     * CM0-6: "Last IRB Approval Date" - creates it if necessary
287     */
288    public DT getLastIRBApprovalDate() { 
289                DT retVal = this.getTypedField(6, 0);
290                return retVal;
291    }
292    
293    /**
294     * Returns
295     * CM0-6: "Last IRB Approval Date" - creates it if necessary
296     */
297    public DT getCm06_LastIRBApprovalDate() { 
298                DT retVal = this.getTypedField(6, 0);
299                return retVal;
300    }
301
302
303
304    /**
305     * Returns
306     * CM0-7: "Total Accrual to Date" - creates it if necessary
307     */
308    public NM getTotalAccrualToDate() { 
309                NM retVal = this.getTypedField(7, 0);
310                return retVal;
311    }
312    
313    /**
314     * Returns
315     * CM0-7: "Total Accrual to Date" - creates it if necessary
316     */
317    public NM getCm07_TotalAccrualToDate() { 
318                NM retVal = this.getTypedField(7, 0);
319                return retVal;
320    }
321
322
323
324    /**
325     * Returns
326     * CM0-8: "Last Accrual Date" - creates it if necessary
327     */
328    public DT getLastAccrualDate() { 
329                DT retVal = this.getTypedField(8, 0);
330                return retVal;
331    }
332    
333    /**
334     * Returns
335     * CM0-8: "Last Accrual Date" - creates it if necessary
336     */
337    public DT getCm08_LastAccrualDate() { 
338                DT retVal = this.getTypedField(8, 0);
339                return retVal;
340    }
341
342
343
344    /**
345     * Returns
346     * CM0-9: "Contact for Study" - creates it if necessary
347     */
348    public XCN getContactForStudy() { 
349                XCN retVal = this.getTypedField(9, 0);
350                return retVal;
351    }
352    
353    /**
354     * Returns
355     * CM0-9: "Contact for Study" - creates it if necessary
356     */
357    public XCN getCm09_ContactForStudy() { 
358                XCN retVal = this.getTypedField(9, 0);
359                return retVal;
360    }
361
362
363
364    /**
365     * Returns
366     * CM0-10: "Contact's Tel. Number" - creates it if necessary
367     */
368    public XTN getContactSTelNumber() { 
369                XTN retVal = this.getTypedField(10, 0);
370                return retVal;
371    }
372    
373    /**
374     * Returns
375     * CM0-10: "Contact's Tel. Number" - creates it if necessary
376     */
377    public XTN getCm010_ContactSTelNumber() { 
378                XTN retVal = this.getTypedField(10, 0);
379                return retVal;
380    }
381
382
383
384    /**
385     * Returns
386     * CM0-11: "Contact's Address" - creates it if necessary
387     */
388    public XAD getContactSAddress() { 
389                XAD retVal = this.getTypedField(11, 0);
390                return retVal;
391    }
392    
393    /**
394     * Returns
395     * CM0-11: "Contact's Address" - creates it if necessary
396     */
397    public XAD getCm011_ContactSAddress() { 
398                XAD retVal = this.getTypedField(11, 0);
399                return retVal;
400    }
401
402
403
404
405
406    /** {@inheritDoc} */   
407    protected Type createNewTypeWithoutReflection(int field) {
408       switch (field) {
409          case 0: return new SI(getMessage());
410          case 1: return new EI(getMessage());
411          case 2: return new CE(getMessage());
412          case 3: return new ST(getMessage());
413          case 4: return new XCN(getMessage());
414          case 5: return new DT(getMessage());
415          case 6: return new NM(getMessage());
416          case 7: return new DT(getMessage());
417          case 8: return new XCN(getMessage());
418          case 9: return new XTN(getMessage());
419          case 10: return new XAD(getMessage());
420          default: return null;
421       }
422   }
423
424
425}
426