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.test.singledt.conf.segment;
35  
36  // import ca.uhn.hl7v2.test.singledt.conf.group.*;
37  import ca.uhn.hl7v2.model.v25.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 ACC message segment (Accident). 
50   * This segment has the following fields:</p>
51   * <ul>
52       * <li>ACC-1: Accident Date/Time (TS) <b>optional </b>
53       * <li>ACC-2: Accident Code (CE) <b>optional </b>
54       * <li>ACC-3: Accident Location (ST) <b>optional </b>
55       * <li>ACC-4: Auto Accident State (CE) <b>optional repeating</b>
56       * <li>ACC-5: Accident Job Related Indicator (ID) <b>optional </b>
57       * <li>ACC-6: Accident Death Indicator (ID) <b>optional </b>
58       * <li>ACC-7: Entered By (XCN) <b>optional </b>
59       * <li>ACC-8: Accident Description (ST) <b>optional </b>
60       * <li>ACC-9: Brought In By (ST) <b>optional </b>
61       * <li>ACC-10: Police Notified Indicator (ID) <b>optional </b>
62       * <li>ACC-11: Accident Address (XAD) <b>optional </b>
63   * </ul>
64   */
65  @SuppressWarnings("unused")
66  public class ACC extends AbstractSegment {
67  
68      /** 
69       * Creates a new ACC segment
70       */
71      public ACC(Group parent, ModelClassFactory factory) {
72         super(parent, factory);
73         init(factory);
74      }
75  
76      private void init(ModelClassFactory factory) {
77         try {
78                                    this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Accident Date/Time");
79                                    this.add(CE.class, false, 1, 478, new Object[]{ getMessage() }, "Accident Code");
80                                    this.add(ST.class, false, 1, 25, new Object[]{ getMessage() }, "Accident Location");
81                                    this.add(CE.class, false, -1, 478, new Object[]{ getMessage() }, "Auto Accident State");
82                                                this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(136) }, "Accident Job Related Indicator");
83                                                this.add(ID.class, false, 1, 12, new Object[]{ getMessage(), new Integer(136) }, "Accident Death Indicator");
84                                    this.add(XCN.class, false, 1, 309, new Object[]{ getMessage() }, "Entered By");
85                                    this.add(ST.class, false, 1, 25, new Object[]{ getMessage() }, "Accident Description");
86                                    this.add(ST.class, false, 1, 80, new Object[]{ getMessage() }, "Brought In By");
87                                                this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(136) }, "Police Notified Indicator");
88                                    this.add(XAD.class, false, 1, 513, new Object[]{ getMessage() }, "Accident Address");
89         } catch(HL7Exception e) {
90            log.error("Unexpected error creating ACC - this is probably a bug in the source code generator.", e);
91         }
92      }
93  
94  
95  
96      /**
97       * Returns
98       * ACC-1: "Accident Date/Time" - creates it if necessary
99       */
100     public TS getAccidentDateTime() { 
101 		TS retVal = this.getTypedField(1, 0);
102 		return retVal;
103     }
104     
105     /**
106      * Returns
107      * ACC-1: "Accident Date/Time" - creates it if necessary
108      */
109     public TS getAcc1_AccidentDateTime() { 
110 		TS retVal = this.getTypedField(1, 0);
111 		return retVal;
112     }
113 
114 
115 
116     /**
117      * Returns
118      * ACC-2: "Accident Code" - creates it if necessary
119      */
120     public CE getAccidentCode() { 
121 		CE retVal = this.getTypedField(2, 0);
122 		return retVal;
123     }
124     
125     /**
126      * Returns
127      * ACC-2: "Accident Code" - creates it if necessary
128      */
129     public CE getAcc2_AccidentCode() { 
130 		CE retVal = this.getTypedField(2, 0);
131 		return retVal;
132     }
133 
134 
135 
136     /**
137      * Returns
138      * ACC-3: "Accident Location" - creates it if necessary
139      */
140     public ST getAccidentLocation() { 
141 		ST retVal = this.getTypedField(3, 0);
142 		return retVal;
143     }
144     
145     /**
146      * Returns
147      * ACC-3: "Accident Location" - creates it if necessary
148      */
149     public ST getAcc3_AccidentLocation() { 
150 		ST retVal = this.getTypedField(3, 0);
151 		return retVal;
152     }
153 
154 
155     /**
156      * Returns all repetitions of Auto Accident State (ACC-4).
157      */
158     public CE[] getAutoAccidentState() {
159     	CE[] retVal = this.getTypedField(4, new CE[0]);
160     	return retVal;
161     }
162 
163 
164     /**
165      * Returns all repetitions of Auto Accident State (ACC-4).
166      */
167     public CE[] getAcc4_AutoAccidentState() {
168     	CE[] retVal = this.getTypedField(4, new CE[0]);
169     	return retVal;
170     }
171 
172 
173     /**
174      * Returns a count of the current number of repetitions of Auto Accident State (ACC-4).
175      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
176      * it will return zero.
177      */
178     public int getAutoAccidentStateReps() {
179     	return this.getReps(4);
180     }
181 
182 
183     /**
184      * Returns a specific repetition of
185      * ACC-4: "Auto Accident State" - creates it if necessary
186      *
187      * @param rep The repetition index (0-indexed)
188      */
189     public CE getAutoAccidentState(int rep) { 
190 		CE retVal = this.getTypedField(4, rep);
191 		return retVal;
192     }
193 
194     /**
195      * Returns a specific repetition of
196      * ACC-4: "Auto Accident State" - creates it if necessary
197      *
198      * @param rep The repetition index (0-indexed)
199      */
200     public CE getAcc4_AutoAccidentState(int rep) { 
201 		CE retVal = this.getTypedField(4, rep);
202 		return retVal;
203     }
204 
205     /**
206      * Returns a count of the current number of repetitions of Auto Accident State (ACC-4).
207      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
208      * it will return zero.
209      */
210     public int getAcc4_AutoAccidentStateReps() {
211     	return this.getReps(4);
212     }
213 
214 
215     /**
216      * Inserts a repetition of
217      * ACC-4: "Auto Accident State" at a specific index
218      *
219      * @param rep The repetition index (0-indexed)
220      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
221      */
222     public CE insertAutoAccidentState(int rep) throws HL7Exception { 
223         return (CE) super.insertRepetition(4, rep);
224     }
225 
226 
227     /**
228      * Inserts a repetition of
229      * ACC-4: "Auto Accident State" at a specific index
230      *
231      * @param rep The repetition index (0-indexed)
232      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
233      */
234     public CE insertAcc4_AutoAccidentState(int rep) throws HL7Exception { 
235         return (CE) super.insertRepetition(4, rep);
236     }
237 
238 
239     /**
240      * Removes a repetition of
241      * ACC-4: "Auto Accident State" at a specific index
242      *
243      * @param rep The repetition index (0-indexed)
244      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
245      */
246     public CE removeAutoAccidentState(int rep) throws HL7Exception { 
247         return (CE) super.removeRepetition(4, rep);
248     }
249 
250 
251     /**
252      * Removes a repetition of
253      * ACC-4: "Auto Accident State" at a specific index
254      *
255      * @param rep The repetition index (0-indexed)
256      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
257      */
258     public CE removeAcc4_AutoAccidentState(int rep) throws HL7Exception { 
259         return (CE) super.removeRepetition(4, rep);
260     }
261 
262 
263 
264 
265     /**
266      * Returns
267      * ACC-5: "Accident Job Related Indicator" - creates it if necessary
268      */
269     public ID getAccidentJobRelatedIndicator() { 
270 		ID retVal = this.getTypedField(5, 0);
271 		return retVal;
272     }
273     
274     /**
275      * Returns
276      * ACC-5: "Accident Job Related Indicator" - creates it if necessary
277      */
278     public ID getAcc5_AccidentJobRelatedIndicator() { 
279 		ID retVal = this.getTypedField(5, 0);
280 		return retVal;
281     }
282 
283 
284 
285     /**
286      * Returns
287      * ACC-6: "Accident Death Indicator" - creates it if necessary
288      */
289     public ID getAccidentDeathIndicator() { 
290 		ID retVal = this.getTypedField(6, 0);
291 		return retVal;
292     }
293     
294     /**
295      * Returns
296      * ACC-6: "Accident Death Indicator" - creates it if necessary
297      */
298     public ID getAcc6_AccidentDeathIndicator() { 
299 		ID retVal = this.getTypedField(6, 0);
300 		return retVal;
301     }
302 
303 
304 
305     /**
306      * Returns
307      * ACC-7: "Entered By" - creates it if necessary
308      */
309     public XCN getEnteredBy() { 
310 		XCN retVal = this.getTypedField(7, 0);
311 		return retVal;
312     }
313     
314     /**
315      * Returns
316      * ACC-7: "Entered By" - creates it if necessary
317      */
318     public XCN getAcc7_EnteredBy() { 
319 		XCN retVal = this.getTypedField(7, 0);
320 		return retVal;
321     }
322 
323 
324 
325     /**
326      * Returns
327      * ACC-8: "Accident Description" - creates it if necessary
328      */
329     public ST getAccidentDescription() { 
330 		ST retVal = this.getTypedField(8, 0);
331 		return retVal;
332     }
333     
334     /**
335      * Returns
336      * ACC-8: "Accident Description" - creates it if necessary
337      */
338     public ST getAcc8_AccidentDescription() { 
339 		ST retVal = this.getTypedField(8, 0);
340 		return retVal;
341     }
342 
343 
344 
345     /**
346      * Returns
347      * ACC-9: "Brought In By" - creates it if necessary
348      */
349     public ST getBroughtInBy() { 
350 		ST retVal = this.getTypedField(9, 0);
351 		return retVal;
352     }
353     
354     /**
355      * Returns
356      * ACC-9: "Brought In By" - creates it if necessary
357      */
358     public ST getAcc9_BroughtInBy() { 
359 		ST retVal = this.getTypedField(9, 0);
360 		return retVal;
361     }
362 
363 
364 
365     /**
366      * Returns
367      * ACC-10: "Police Notified Indicator" - creates it if necessary
368      */
369     public ID getPoliceNotifiedIndicator() { 
370 		ID retVal = this.getTypedField(10, 0);
371 		return retVal;
372     }
373     
374     /**
375      * Returns
376      * ACC-10: "Police Notified Indicator" - creates it if necessary
377      */
378     public ID getAcc10_PoliceNotifiedIndicator() { 
379 		ID retVal = this.getTypedField(10, 0);
380 		return retVal;
381     }
382 
383 
384 
385     /**
386      * Returns
387      * ACC-11: "Accident Address" - creates it if necessary
388      */
389     public XAD getAccidentAddress() { 
390 		XAD retVal = this.getTypedField(11, 0);
391 		return retVal;
392     }
393     
394     /**
395      * Returns
396      * ACC-11: "Accident Address" - creates it if necessary
397      */
398     public XAD getAcc11_AccidentAddress() { 
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 TS(getMessage());
411           case 1: return new CE(getMessage());
412           case 2: return new ST(getMessage());
413           case 3: return new CE(getMessage());
414           case 4: return new ID(getMessage(), new Integer( 136 ));
415           case 5: return new ID(getMessage(), new Integer( 136 ));
416           case 6: return new XCN(getMessage());
417           case 7: return new ST(getMessage());
418           case 8: return new ST(getMessage());
419           case 9: return new ID(getMessage(), new Integer( 136 ));
420           case 10: return new XAD(getMessage());
421           default: return null;
422        }
423    }
424 
425 
426 }
427