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.v231.segment;
35  
36  // import ca.uhn.hl7v2.model.v231.group.*;
37  import ca.uhn.hl7v2.model.v231.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 ROL message segment (Role). 
50   * This segment has the following fields:</p>
51   * <ul>
52       * <li>ROL-1: Role Instance ID (EI) <b> </b>
53       * <li>ROL-2: Action Code (ID) <b> </b>
54       * <li>ROL-3: Role-ROL (CE) <b> </b>
55       * <li>ROL-4: Role Person (XCN) <b> repeating</b>
56       * <li>ROL-5: Role Begin Date/Time (TS) <b>optional </b>
57       * <li>ROL-6: Role End Date/Time (TS) <b>optional </b>
58       * <li>ROL-7: Role Duration (CE) <b>optional </b>
59       * <li>ROL-8: Role Action Reason (CE) <b>optional </b>
60   * </ul>
61   */
62  @SuppressWarnings("unused")
63  public class ROL extends AbstractSegment {
64  
65      /** 
66       * Creates a new ROL segment
67       */
68      public ROL(Group parent, ModelClassFactory factory) {
69         super(parent, factory);
70         init(factory);
71      }
72  
73      private void init(ModelClassFactory factory) {
74         try {
75                                    this.add(EI.class, true, 1, 60, new Object[]{ getMessage() }, "Role Instance ID");
76                                                this.add(ID.class, true, 1, 2, new Object[]{ getMessage(), new Integer(287) }, "Action Code");
77                                    this.add(CE.class, true, 1, 80, new Object[]{ getMessage() }, "Role-ROL");
78                                    this.add(XCN.class, true, 0, 80, new Object[]{ getMessage() }, "Role Person");
79                                    this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Role Begin Date/Time");
80                                    this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Role End Date/Time");
81                                    this.add(CE.class, false, 1, 80, new Object[]{ getMessage() }, "Role Duration");
82                                    this.add(CE.class, false, 1, 80, new Object[]{ getMessage() }, "Role Action Reason");
83         } catch(HL7Exception e) {
84            log.error("Unexpected error creating ROL - this is probably a bug in the source code generator.", e);
85         }
86      }
87  
88  
89  
90      /**
91       * Returns
92       * ROL-1: "Role Instance ID" - creates it if necessary
93       */
94      public EI getRoleInstanceID() { 
95  		EI retVal = this.getTypedField(1, 0);
96  		return retVal;
97      }
98      
99      /**
100      * Returns
101      * ROL-1: "Role Instance ID" - creates it if necessary
102      */
103     public EI getRol1_RoleInstanceID() { 
104 		EI retVal = this.getTypedField(1, 0);
105 		return retVal;
106     }
107 
108 
109 
110     /**
111      * Returns
112      * ROL-2: "Action Code" - creates it if necessary
113      */
114     public ID getActionCode() { 
115 		ID retVal = this.getTypedField(2, 0);
116 		return retVal;
117     }
118     
119     /**
120      * Returns
121      * ROL-2: "Action Code" - creates it if necessary
122      */
123     public ID getRol2_ActionCode() { 
124 		ID retVal = this.getTypedField(2, 0);
125 		return retVal;
126     }
127 
128 
129 
130     /**
131      * Returns
132      * ROL-3: "Role-ROL" - creates it if necessary
133      */
134     public CE getRoleROL() { 
135 		CE retVal = this.getTypedField(3, 0);
136 		return retVal;
137     }
138     
139     /**
140      * Returns
141      * ROL-3: "Role-ROL" - creates it if necessary
142      */
143     public CE getRol3_RoleROL() { 
144 		CE retVal = this.getTypedField(3, 0);
145 		return retVal;
146     }
147 
148 
149     /**
150      * Returns all repetitions of Role Person (ROL-4).
151      */
152     public XCN[] getRolePerson() {
153     	XCN[] retVal = this.getTypedField(4, new XCN[0]);
154     	return retVal;
155     }
156 
157 
158     /**
159      * Returns all repetitions of Role Person (ROL-4).
160      */
161     public XCN[] getRol4_RolePerson() {
162     	XCN[] retVal = this.getTypedField(4, new XCN[0]);
163     	return retVal;
164     }
165 
166 
167     /**
168      * Returns a count of the current number of repetitions of Role Person (ROL-4).
169      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
170      * it will return zero.
171      */
172     public int getRolePersonReps() {
173     	return this.getReps(4);
174     }
175 
176 
177     /**
178      * Returns a specific repetition of
179      * ROL-4: "Role Person" - creates it if necessary
180      *
181      * @param rep The repetition index (0-indexed)
182      */
183     public XCN getRolePerson(int rep) { 
184 		XCN retVal = this.getTypedField(4, rep);
185 		return retVal;
186     }
187 
188     /**
189      * Returns a specific repetition of
190      * ROL-4: "Role Person" - creates it if necessary
191      *
192      * @param rep The repetition index (0-indexed)
193      */
194     public XCN getRol4_RolePerson(int rep) { 
195 		XCN retVal = this.getTypedField(4, rep);
196 		return retVal;
197     }
198 
199     /**
200      * Returns a count of the current number of repetitions of Role Person (ROL-4).
201      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
202      * it will return zero.
203      */
204     public int getRol4_RolePersonReps() {
205     	return this.getReps(4);
206     }
207 
208 
209     /**
210      * Inserts a repetition of
211      * ROL-4: "Role Person" at a specific index
212      *
213      * @param rep The repetition index (0-indexed)
214      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
215      */
216     public XCN insertRolePerson(int rep) throws HL7Exception { 
217         return (XCN) super.insertRepetition(4, rep);
218     }
219 
220 
221     /**
222      * Inserts a repetition of
223      * ROL-4: "Role Person" at a specific index
224      *
225      * @param rep The repetition index (0-indexed)
226      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
227      */
228     public XCN insertRol4_RolePerson(int rep) throws HL7Exception { 
229         return (XCN) super.insertRepetition(4, rep);
230     }
231 
232 
233     /**
234      * Removes a repetition of
235      * ROL-4: "Role Person" at a specific index
236      *
237      * @param rep The repetition index (0-indexed)
238      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
239      */
240     public XCN removeRolePerson(int rep) throws HL7Exception { 
241         return (XCN) super.removeRepetition(4, rep);
242     }
243 
244 
245     /**
246      * Removes a repetition of
247      * ROL-4: "Role Person" at a specific index
248      *
249      * @param rep The repetition index (0-indexed)
250      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
251      */
252     public XCN removeRol4_RolePerson(int rep) throws HL7Exception { 
253         return (XCN) super.removeRepetition(4, rep);
254     }
255 
256 
257 
258 
259     /**
260      * Returns
261      * ROL-5: "Role Begin Date/Time" - creates it if necessary
262      */
263     public TS getRoleBeginDateTime() { 
264 		TS retVal = this.getTypedField(5, 0);
265 		return retVal;
266     }
267     
268     /**
269      * Returns
270      * ROL-5: "Role Begin Date/Time" - creates it if necessary
271      */
272     public TS getRol5_RoleBeginDateTime() { 
273 		TS retVal = this.getTypedField(5, 0);
274 		return retVal;
275     }
276 
277 
278 
279     /**
280      * Returns
281      * ROL-6: "Role End Date/Time" - creates it if necessary
282      */
283     public TS getRoleEndDateTime() { 
284 		TS retVal = this.getTypedField(6, 0);
285 		return retVal;
286     }
287     
288     /**
289      * Returns
290      * ROL-6: "Role End Date/Time" - creates it if necessary
291      */
292     public TS getRol6_RoleEndDateTime() { 
293 		TS retVal = this.getTypedField(6, 0);
294 		return retVal;
295     }
296 
297 
298 
299     /**
300      * Returns
301      * ROL-7: "Role Duration" - creates it if necessary
302      */
303     public CE getRoleDuration() { 
304 		CE retVal = this.getTypedField(7, 0);
305 		return retVal;
306     }
307     
308     /**
309      * Returns
310      * ROL-7: "Role Duration" - creates it if necessary
311      */
312     public CE getRol7_RoleDuration() { 
313 		CE retVal = this.getTypedField(7, 0);
314 		return retVal;
315     }
316 
317 
318 
319     /**
320      * Returns
321      * ROL-8: "Role Action Reason" - creates it if necessary
322      */
323     public CE getRoleActionReason() { 
324 		CE retVal = this.getTypedField(8, 0);
325 		return retVal;
326     }
327     
328     /**
329      * Returns
330      * ROL-8: "Role Action Reason" - creates it if necessary
331      */
332     public CE getRol8_RoleActionReason() { 
333 		CE retVal = this.getTypedField(8, 0);
334 		return retVal;
335     }
336 
337 
338 
339 
340 
341     /** {@inheritDoc} */   
342     protected Type createNewTypeWithoutReflection(int field) {
343        switch (field) {
344           case 0: return new EI(getMessage());
345           case 1: return new ID(getMessage(), new Integer( 287 ));
346           case 2: return new CE(getMessage());
347           case 3: return new XCN(getMessage());
348           case 4: return new TS(getMessage());
349           case 5: return new TS(getMessage());
350           case 6: return new CE(getMessage());
351           case 7: return new CE(getMessage());
352           default: return null;
353        }
354    }
355 
356 
357 }
358