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
008 package ca.uhn.hl7v2.model.v24.segment;
009
010 // import ca.uhn.hl7v2.model.v24.group.*;
011 import ca.uhn.hl7v2.model.v24.datatype.*;
012 import ca.uhn.log.HapiLogFactory;
013 import ca.uhn.hl7v2.HL7Exception;
014 import ca.uhn.hl7v2.parser.ModelClassFactory;
015 import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
016 import ca.uhn.hl7v2.model.AbstractMessage;
017 import ca.uhn.hl7v2.model.Group;
018 import ca.uhn.hl7v2.model.Type;
019 import ca.uhn.hl7v2.model.AbstractSegment;
020 import ca.uhn.hl7v2.model.Varies;
021
022 /**
023 *<p>Represents an HL7 EDU message segment (Educational Detail).
024 * This segment has the following fields:</p>
025 * <ul>
026 * <li>EDU-1: Set ID - EDU (SI) <b> </b>
027 * <li>EDU-2: Academic Degree (IS) <b>optional </b>
028 * <li>EDU-3: Academic Degree Program Date Range (DR) <b>optional </b>
029 * <li>EDU-4: Academic Degree Program Participation Date Range (DR) <b>optional </b>
030 * <li>EDU-5: Academic Degree Granted Date (DT) <b>optional </b>
031 * <li>EDU-6: School (XON) <b>optional </b>
032 * <li>EDU-7: School Type Code (CE) <b>optional </b>
033 * <li>EDU-8: School Address (XAD) <b>optional </b>
034 * </ul>
035 */
036 public class EDU extends AbstractSegment {
037
038 /**
039 * Creates a new EDU segment
040 */
041 public EDU(Group parent, ModelClassFactory factory) {
042 super(parent, factory);
043 init(factory);
044 }
045
046 private void init(ModelClassFactory factory) {
047 try {
048 this.add(SI.class, true, 1, 60, new Object[]{ getMessage(), new Integer(0) }, "Set ID - EDU");
049 this.add(IS.class, false, 1, 10, new Object[]{ getMessage() }, "Academic Degree");
050 this.add(DR.class, false, 1, 52, new Object[]{ getMessage(), new Integer(0) }, "Academic Degree Program Date Range");
051 this.add(DR.class, false, 1, 52, new Object[]{ getMessage(), new Integer(0) }, "Academic Degree Program Participation Date Range");
052 this.add(DT.class, false, 1, 8, new Object[]{ getMessage(), new Integer(0) }, "Academic Degree Granted Date");
053 this.add(XON.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "School");
054 this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(402) }, "School Type Code");
055 this.add(XAD.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "School Address");
056 } catch(HL7Exception e) {
057 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating EDU - this is probably a bug in the source code generator.", e);
058 }
059 }
060
061
062
063 /**
064 * Returns
065 * EDU-1: "Set ID - EDU" - creates it if necessary
066 */
067 public SI getSetIDEDU() {
068 SI ret = null;
069 try {
070 Type t = this.getField(1, 0);
071 ret = (SI)t;
072 } catch (ClassCastException cce) {
073 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
074 throw new RuntimeException(cce);
075 } catch (HL7Exception he) {
076 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
077 throw new RuntimeException(he);
078 }
079 return ret;
080 }
081
082
083 /**
084 * Returns
085 * EDU-1: "Set ID - EDU" - creates it if necessary
086 */
087 public SI getEdu1_SetIDEDU() {
088 SI ret = null;
089 try {
090 Type t = this.getField(1, 0);
091 ret = (SI)t;
092 } catch (ClassCastException cce) {
093 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
094 throw new RuntimeException(cce);
095 } catch (HL7Exception he) {
096 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
097 throw new RuntimeException(he);
098 }
099 return ret;
100 }
101
102
103
104 /**
105 * Returns
106 * EDU-2: "Academic Degree" - creates it if necessary
107 */
108 public IS getAcademicDegree() {
109 IS ret = null;
110 try {
111 Type t = this.getField(2, 0);
112 ret = (IS)t;
113 } catch (ClassCastException cce) {
114 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
115 throw new RuntimeException(cce);
116 } catch (HL7Exception he) {
117 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
118 throw new RuntimeException(he);
119 }
120 return ret;
121 }
122
123
124 /**
125 * Returns
126 * EDU-2: "Academic Degree" - creates it if necessary
127 */
128 public IS getEdu2_AcademicDegree() {
129 IS ret = null;
130 try {
131 Type t = this.getField(2, 0);
132 ret = (IS)t;
133 } catch (ClassCastException cce) {
134 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
135 throw new RuntimeException(cce);
136 } catch (HL7Exception he) {
137 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
138 throw new RuntimeException(he);
139 }
140 return ret;
141 }
142
143
144
145 /**
146 * Returns
147 * EDU-3: "Academic Degree Program Date Range" - creates it if necessary
148 */
149 public DR getAcademicDegreeProgramDateRange() {
150 DR ret = null;
151 try {
152 Type t = this.getField(3, 0);
153 ret = (DR)t;
154 } catch (ClassCastException cce) {
155 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
156 throw new RuntimeException(cce);
157 } catch (HL7Exception he) {
158 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
159 throw new RuntimeException(he);
160 }
161 return ret;
162 }
163
164
165 /**
166 * Returns
167 * EDU-3: "Academic Degree Program Date Range" - creates it if necessary
168 */
169 public DR getEdu3_AcademicDegreeProgramDateRange() {
170 DR ret = null;
171 try {
172 Type t = this.getField(3, 0);
173 ret = (DR)t;
174 } catch (ClassCastException cce) {
175 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
176 throw new RuntimeException(cce);
177 } catch (HL7Exception he) {
178 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
179 throw new RuntimeException(he);
180 }
181 return ret;
182 }
183
184
185
186 /**
187 * Returns
188 * EDU-4: "Academic Degree Program Participation Date Range" - creates it if necessary
189 */
190 public DR getAcademicDegreeProgramParticipationDateRange() {
191 DR ret = null;
192 try {
193 Type t = this.getField(4, 0);
194 ret = (DR)t;
195 } catch (ClassCastException cce) {
196 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
197 throw new RuntimeException(cce);
198 } catch (HL7Exception he) {
199 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
200 throw new RuntimeException(he);
201 }
202 return ret;
203 }
204
205
206 /**
207 * Returns
208 * EDU-4: "Academic Degree Program Participation Date Range" - creates it if necessary
209 */
210 public DR getEdu4_AcademicDegreeProgramParticipationDateRange() {
211 DR ret = null;
212 try {
213 Type t = this.getField(4, 0);
214 ret = (DR)t;
215 } catch (ClassCastException cce) {
216 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
217 throw new RuntimeException(cce);
218 } catch (HL7Exception he) {
219 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
220 throw new RuntimeException(he);
221 }
222 return ret;
223 }
224
225
226
227 /**
228 * Returns
229 * EDU-5: "Academic Degree Granted Date" - creates it if necessary
230 */
231 public DT getAcademicDegreeGrantedDate() {
232 DT ret = null;
233 try {
234 Type t = this.getField(5, 0);
235 ret = (DT)t;
236 } catch (ClassCastException cce) {
237 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
238 throw new RuntimeException(cce);
239 } catch (HL7Exception he) {
240 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
241 throw new RuntimeException(he);
242 }
243 return ret;
244 }
245
246
247 /**
248 * Returns
249 * EDU-5: "Academic Degree Granted Date" - creates it if necessary
250 */
251 public DT getEdu5_AcademicDegreeGrantedDate() {
252 DT ret = null;
253 try {
254 Type t = this.getField(5, 0);
255 ret = (DT)t;
256 } catch (ClassCastException cce) {
257 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
258 throw new RuntimeException(cce);
259 } catch (HL7Exception he) {
260 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
261 throw new RuntimeException(he);
262 }
263 return ret;
264 }
265
266
267
268 /**
269 * Returns
270 * EDU-6: "School" - creates it if necessary
271 */
272 public XON getSchool() {
273 XON ret = null;
274 try {
275 Type t = this.getField(6, 0);
276 ret = (XON)t;
277 } catch (ClassCastException cce) {
278 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
279 throw new RuntimeException(cce);
280 } catch (HL7Exception he) {
281 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
282 throw new RuntimeException(he);
283 }
284 return ret;
285 }
286
287
288 /**
289 * Returns
290 * EDU-6: "School" - creates it if necessary
291 */
292 public XON getEdu6_School() {
293 XON ret = null;
294 try {
295 Type t = this.getField(6, 0);
296 ret = (XON)t;
297 } catch (ClassCastException cce) {
298 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
299 throw new RuntimeException(cce);
300 } catch (HL7Exception he) {
301 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
302 throw new RuntimeException(he);
303 }
304 return ret;
305 }
306
307
308
309 /**
310 * Returns
311 * EDU-7: "School Type Code" - creates it if necessary
312 */
313 public CE getSchoolTypeCode() {
314 CE ret = null;
315 try {
316 Type t = this.getField(7, 0);
317 ret = (CE)t;
318 } catch (ClassCastException cce) {
319 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
320 throw new RuntimeException(cce);
321 } catch (HL7Exception he) {
322 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
323 throw new RuntimeException(he);
324 }
325 return ret;
326 }
327
328
329 /**
330 * Returns
331 * EDU-7: "School Type Code" - creates it if necessary
332 */
333 public CE getEdu7_SchoolTypeCode() {
334 CE ret = null;
335 try {
336 Type t = this.getField(7, 0);
337 ret = (CE)t;
338 } catch (ClassCastException cce) {
339 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
340 throw new RuntimeException(cce);
341 } catch (HL7Exception he) {
342 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
343 throw new RuntimeException(he);
344 }
345 return ret;
346 }
347
348
349
350 /**
351 * Returns
352 * EDU-8: "School Address" - creates it if necessary
353 */
354 public XAD getSchoolAddress() {
355 XAD ret = null;
356 try {
357 Type t = this.getField(8, 0);
358 ret = (XAD)t;
359 } catch (ClassCastException cce) {
360 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
361 throw new RuntimeException(cce);
362 } catch (HL7Exception he) {
363 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
364 throw new RuntimeException(he);
365 }
366 return ret;
367 }
368
369
370 /**
371 * Returns
372 * EDU-8: "School Address" - creates it if necessary
373 */
374 public XAD getEdu8_SchoolAddress() {
375 XAD ret = null;
376 try {
377 Type t = this.getField(8, 0);
378 ret = (XAD)t;
379 } catch (ClassCastException cce) {
380 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
381 throw new RuntimeException(cce);
382 } catch (HL7Exception he) {
383 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
384 throw new RuntimeException(he);
385 }
386 return ret;
387 }
388
389
390
391
392
393 /** {@inheritDoc} */
394 protected Type createNewTypeWithoutReflection(int field) {
395 switch (field) {
396 case 0: return new SI(getMessage());
397 case 1: return new IS(getMessage(), new Integer( 360 ));
398 case 2: return new DR(getMessage());
399 case 3: return new DR(getMessage());
400 case 4: return new DT(getMessage());
401 case 5: return new XON(getMessage());
402 case 6: return new CE(getMessage());
403 case 7: return new XAD(getMessage());
404 default: return null;
405 }
406 }
407
408
409 }
410