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.v25.segment;
35  
36  // import ca.uhn.hl7v2.model.v25.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 EVN message segment (Event Type). 
50   * This segment has the following fields:</p>
51   * <ul>
52       * <li>EVN-1: Event Type Code (ID) <b>optional </b>
53       * <li>EVN-2: Recorded Date/Time (TS) <b> </b>
54       * <li>EVN-3: Date/Time Planned Event (TS) <b>optional </b>
55       * <li>EVN-4: Event Reason Code (IS) <b>optional </b>
56       * <li>EVN-5: Operator ID (XCN) <b>optional repeating</b>
57       * <li>EVN-6: Event Occurred (TS) <b>optional </b>
58       * <li>EVN-7: Event Facility (HD) <b>optional </b>
59   * </ul>
60   */
61  @SuppressWarnings("unused")
62  public class EVN extends AbstractSegment {
63  
64      /** 
65       * Creates a new EVN segment
66       */
67      public EVN(Group parent, ModelClassFactory factory) {
68         super(parent, factory);
69         init(factory);
70      }
71  
72      private void init(ModelClassFactory factory) {
73         try {
74                                                this.add(ID.class, false, 1, 3, new Object[]{ getMessage(), new Integer(3) }, "Event Type Code");
75                                    this.add(TS.class, true, 1, 26, new Object[]{ getMessage() }, "Recorded Date/Time");
76                                    this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Date/Time Planned Event");
77                                                this.add(IS.class, false, 1, 3, new Object[]{ getMessage(), new Integer(62) }, "Event Reason Code");
78                                    this.add(XCN.class, false, 0, 250, new Object[]{ getMessage() }, "Operator ID");
79                                    this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Event Occurred");
80                                    this.add(HD.class, false, 1, 241, new Object[]{ getMessage() }, "Event Facility");
81         } catch(HL7Exception e) {
82            log.error("Unexpected error creating EVN - this is probably a bug in the source code generator.", e);
83         }
84      }
85  
86  
87  
88      /**
89       * Returns
90       * EVN-1: "Event Type Code" - creates it if necessary
91       */
92      public ID getEventTypeCode() { 
93  		ID retVal = this.getTypedField(1, 0);
94  		return retVal;
95      }
96      
97      /**
98       * Returns
99       * EVN-1: "Event Type Code" - creates it if necessary
100      */
101     public ID getEvn1_EventTypeCode() { 
102 		ID retVal = this.getTypedField(1, 0);
103 		return retVal;
104     }
105 
106 
107 
108     /**
109      * Returns
110      * EVN-2: "Recorded Date/Time" - creates it if necessary
111      */
112     public TS getRecordedDateTime() { 
113 		TS retVal = this.getTypedField(2, 0);
114 		return retVal;
115     }
116     
117     /**
118      * Returns
119      * EVN-2: "Recorded Date/Time" - creates it if necessary
120      */
121     public TS getEvn2_RecordedDateTime() { 
122 		TS retVal = this.getTypedField(2, 0);
123 		return retVal;
124     }
125 
126 
127 
128     /**
129      * Returns
130      * EVN-3: "Date/Time Planned Event" - creates it if necessary
131      */
132     public TS getDateTimePlannedEvent() { 
133 		TS retVal = this.getTypedField(3, 0);
134 		return retVal;
135     }
136     
137     /**
138      * Returns
139      * EVN-3: "Date/Time Planned Event" - creates it if necessary
140      */
141     public TS getEvn3_DateTimePlannedEvent() { 
142 		TS retVal = this.getTypedField(3, 0);
143 		return retVal;
144     }
145 
146 
147 
148     /**
149      * Returns
150      * EVN-4: "Event Reason Code" - creates it if necessary
151      */
152     public IS getEventReasonCode() { 
153 		IS retVal = this.getTypedField(4, 0);
154 		return retVal;
155     }
156     
157     /**
158      * Returns
159      * EVN-4: "Event Reason Code" - creates it if necessary
160      */
161     public IS getEvn4_EventReasonCode() { 
162 		IS retVal = this.getTypedField(4, 0);
163 		return retVal;
164     }
165 
166 
167     /**
168      * Returns all repetitions of Operator ID (EVN-5).
169      */
170     public XCN[] getOperatorID() {
171     	XCN[] retVal = this.getTypedField(5, new XCN[0]);
172     	return retVal;
173     }
174 
175 
176     /**
177      * Returns all repetitions of Operator ID (EVN-5).
178      */
179     public XCN[] getEvn5_OperatorID() {
180     	XCN[] retVal = this.getTypedField(5, new XCN[0]);
181     	return retVal;
182     }
183 
184 
185     /**
186      * Returns a count of the current number of repetitions of Operator ID (EVN-5).
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 getOperatorIDReps() {
191     	return this.getReps(5);
192     }
193 
194 
195     /**
196      * Returns a specific repetition of
197      * EVN-5: "Operator ID" - creates it if necessary
198      *
199      * @param rep The repetition index (0-indexed)
200      */
201     public XCN getOperatorID(int rep) { 
202 		XCN retVal = this.getTypedField(5, rep);
203 		return retVal;
204     }
205 
206     /**
207      * Returns a specific repetition of
208      * EVN-5: "Operator ID" - creates it if necessary
209      *
210      * @param rep The repetition index (0-indexed)
211      */
212     public XCN getEvn5_OperatorID(int rep) { 
213 		XCN retVal = this.getTypedField(5, rep);
214 		return retVal;
215     }
216 
217     /**
218      * Returns a count of the current number of repetitions of Operator ID (EVN-5).
219      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
220      * it will return zero.
221      */
222     public int getEvn5_OperatorIDReps() {
223     	return this.getReps(5);
224     }
225 
226 
227     /**
228      * Inserts a repetition of
229      * EVN-5: "Operator ID" 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 XCN insertOperatorID(int rep) throws HL7Exception { 
235         return (XCN) super.insertRepetition(5, rep);
236     }
237 
238 
239     /**
240      * Inserts a repetition of
241      * EVN-5: "Operator ID" 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 XCN insertEvn5_OperatorID(int rep) throws HL7Exception { 
247         return (XCN) super.insertRepetition(5, rep);
248     }
249 
250 
251     /**
252      * Removes a repetition of
253      * EVN-5: "Operator ID" 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 XCN removeOperatorID(int rep) throws HL7Exception { 
259         return (XCN) super.removeRepetition(5, rep);
260     }
261 
262 
263     /**
264      * Removes a repetition of
265      * EVN-5: "Operator ID" at a specific index
266      *
267      * @param rep The repetition index (0-indexed)
268      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
269      */
270     public XCN removeEvn5_OperatorID(int rep) throws HL7Exception { 
271         return (XCN) super.removeRepetition(5, rep);
272     }
273 
274 
275 
276 
277     /**
278      * Returns
279      * EVN-6: "Event Occurred" - creates it if necessary
280      */
281     public TS getEventOccurred() { 
282 		TS retVal = this.getTypedField(6, 0);
283 		return retVal;
284     }
285     
286     /**
287      * Returns
288      * EVN-6: "Event Occurred" - creates it if necessary
289      */
290     public TS getEvn6_EventOccurred() { 
291 		TS retVal = this.getTypedField(6, 0);
292 		return retVal;
293     }
294 
295 
296 
297     /**
298      * Returns
299      * EVN-7: "Event Facility" - creates it if necessary
300      */
301     public HD getEventFacility() { 
302 		HD retVal = this.getTypedField(7, 0);
303 		return retVal;
304     }
305     
306     /**
307      * Returns
308      * EVN-7: "Event Facility" - creates it if necessary
309      */
310     public HD getEvn7_EventFacility() { 
311 		HD retVal = this.getTypedField(7, 0);
312 		return retVal;
313     }
314 
315 
316 
317 
318 
319     /** {@inheritDoc} */   
320     protected Type createNewTypeWithoutReflection(int field) {
321        switch (field) {
322           case 0: return new ID(getMessage(), new Integer( 3 ));
323           case 1: return new TS(getMessage());
324           case 2: return new TS(getMessage());
325           case 3: return new IS(getMessage(), new Integer( 62 ));
326           case 4: return new XCN(getMessage());
327           case 5: return new TS(getMessage());
328           case 6: return new HD(getMessage());
329           default: return null;
330        }
331    }
332 
333 
334 }
335