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