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 * The contents of this file are subject to the Mozilla Public License Version 1.1 
008 * (the "License"); you may not use this file except in compliance with the License. 
009 * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
010 * Software distributed under the License is distributed on an "AS IS" basis, 
011 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
012 * specific language governing rights and limitations under the License. 
013 * 
014 * The Original Code is "[file_name]".  Description: 
015 * "[one_line_description]" 
016 * 
017 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
018 * 2012.  All Rights Reserved. 
019 * 
020 * Contributor(s): ______________________________________. 
021 * 
022 * Alternatively, the contents of this file may be used under the terms of the 
023 * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
024 * applicable instead of those above.  If you wish to allow use of your version of this 
025 * file only under the terms of the GPL and not to allow others to use your version 
026 * of this file under the MPL, indicate your decision by deleting  the provisions above 
027 * and replace  them with the notice and other provisions required by the GPL License.  
028 * If you do not delete the provisions above, a recipient may use your version of 
029 * this file under either the MPL or the GPL. 
030 * 
031 */
032
033
034package ca.uhn.hl7v2.model.v251.segment;
035
036// import ca.uhn.hl7v2.model.v251.group.*;
037import ca.uhn.hl7v2.model.v251.datatype.*;
038import ca.uhn.hl7v2.HL7Exception;
039import ca.uhn.hl7v2.parser.ModelClassFactory;
040import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
041import ca.uhn.hl7v2.model.AbstractMessage;
042import ca.uhn.hl7v2.model.Group;
043import ca.uhn.hl7v2.model.Type;
044import ca.uhn.hl7v2.model.AbstractSegment;
045import ca.uhn.hl7v2.model.Varies;
046
047
048/**
049 *<p>Represents an HL7 EDU message segment (Educational Detail). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>EDU-1: Set ID - EDU (SI) <b> </b>
053     * <li>EDU-2: Academic Degree (IS) <b>optional </b>
054     * <li>EDU-3: Academic Degree Program Date Range (DR) <b>optional </b>
055     * <li>EDU-4: Academic Degree Program Participation Date Range (DR) <b>optional </b>
056     * <li>EDU-5: Academic Degree Granted Date (DT) <b>optional </b>
057     * <li>EDU-6: School (XON) <b>optional </b>
058     * <li>EDU-7: School Type Code (CE) <b>optional </b>
059     * <li>EDU-8: School Address (XAD) <b>optional </b>
060     * <li>EDU-9: Major Field of Study (CWE) <b>optional repeating</b>
061 * </ul>
062 */
063@SuppressWarnings("unused")
064public class EDU extends AbstractSegment {
065
066    /** 
067     * Creates a new EDU segment
068     */
069    public EDU(Group parent, ModelClassFactory factory) {
070       super(parent, factory);
071       init(factory);
072    }
073
074    private void init(ModelClassFactory factory) {
075       try {
076                                  this.add(SI.class, true, 1, 60, new Object[]{ getMessage() }, "Set ID - EDU");
077                                              this.add(IS.class, false, 1, 10, new Object[]{ getMessage(), new Integer(360) }, "Academic Degree");
078                                  this.add(DR.class, false, 1, 52, new Object[]{ getMessage() }, "Academic Degree Program Date Range");
079                                  this.add(DR.class, false, 1, 52, new Object[]{ getMessage() }, "Academic Degree Program Participation Date Range");
080                                  this.add(DT.class, false, 1, 8, new Object[]{ getMessage() }, "Academic Degree Granted Date");
081                                  this.add(XON.class, false, 1, 250, new Object[]{ getMessage() }, "School");
082                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "School Type Code");
083                                  this.add(XAD.class, false, 1, 250, new Object[]{ getMessage() }, "School Address");
084                                  this.add(CWE.class, false, 0, 250, new Object[]{ getMessage() }, "Major Field of Study");
085       } catch(HL7Exception e) {
086          log.error("Unexpected error creating EDU - this is probably a bug in the source code generator.", e);
087       }
088    }
089
090
091
092    /**
093     * Returns
094     * EDU-1: "Set ID - EDU" - creates it if necessary
095     */
096    public SI getSetIDEDU() { 
097                SI retVal = this.getTypedField(1, 0);
098                return retVal;
099    }
100    
101    /**
102     * Returns
103     * EDU-1: "Set ID - EDU" - creates it if necessary
104     */
105    public SI getEdu1_SetIDEDU() { 
106                SI retVal = this.getTypedField(1, 0);
107                return retVal;
108    }
109
110
111
112    /**
113     * Returns
114     * EDU-2: "Academic Degree" - creates it if necessary
115     */
116    public IS getAcademicDegree() { 
117                IS retVal = this.getTypedField(2, 0);
118                return retVal;
119    }
120    
121    /**
122     * Returns
123     * EDU-2: "Academic Degree" - creates it if necessary
124     */
125    public IS getEdu2_AcademicDegree() { 
126                IS retVal = this.getTypedField(2, 0);
127                return retVal;
128    }
129
130
131
132    /**
133     * Returns
134     * EDU-3: "Academic Degree Program Date Range" - creates it if necessary
135     */
136    public DR getAcademicDegreeProgramDateRange() { 
137                DR retVal = this.getTypedField(3, 0);
138                return retVal;
139    }
140    
141    /**
142     * Returns
143     * EDU-3: "Academic Degree Program Date Range" - creates it if necessary
144     */
145    public DR getEdu3_AcademicDegreeProgramDateRange() { 
146                DR retVal = this.getTypedField(3, 0);
147                return retVal;
148    }
149
150
151
152    /**
153     * Returns
154     * EDU-4: "Academic Degree Program Participation Date Range" - creates it if necessary
155     */
156    public DR getAcademicDegreeProgramParticipationDateRange() { 
157                DR retVal = this.getTypedField(4, 0);
158                return retVal;
159    }
160    
161    /**
162     * Returns
163     * EDU-4: "Academic Degree Program Participation Date Range" - creates it if necessary
164     */
165    public DR getEdu4_AcademicDegreeProgramParticipationDateRange() { 
166                DR retVal = this.getTypedField(4, 0);
167                return retVal;
168    }
169
170
171
172    /**
173     * Returns
174     * EDU-5: "Academic Degree Granted Date" - creates it if necessary
175     */
176    public DT getAcademicDegreeGrantedDate() { 
177                DT retVal = this.getTypedField(5, 0);
178                return retVal;
179    }
180    
181    /**
182     * Returns
183     * EDU-5: "Academic Degree Granted Date" - creates it if necessary
184     */
185    public DT getEdu5_AcademicDegreeGrantedDate() { 
186                DT retVal = this.getTypedField(5, 0);
187                return retVal;
188    }
189
190
191
192    /**
193     * Returns
194     * EDU-6: "School" - creates it if necessary
195     */
196    public XON getSchool() { 
197                XON retVal = this.getTypedField(6, 0);
198                return retVal;
199    }
200    
201    /**
202     * Returns
203     * EDU-6: "School" - creates it if necessary
204     */
205    public XON getEdu6_School() { 
206                XON retVal = this.getTypedField(6, 0);
207                return retVal;
208    }
209
210
211
212    /**
213     * Returns
214     * EDU-7: "School Type Code" - creates it if necessary
215     */
216    public CE getSchoolTypeCode() { 
217                CE retVal = this.getTypedField(7, 0);
218                return retVal;
219    }
220    
221    /**
222     * Returns
223     * EDU-7: "School Type Code" - creates it if necessary
224     */
225    public CE getEdu7_SchoolTypeCode() { 
226                CE retVal = this.getTypedField(7, 0);
227                return retVal;
228    }
229
230
231
232    /**
233     * Returns
234     * EDU-8: "School Address" - creates it if necessary
235     */
236    public XAD getSchoolAddress() { 
237                XAD retVal = this.getTypedField(8, 0);
238                return retVal;
239    }
240    
241    /**
242     * Returns
243     * EDU-8: "School Address" - creates it if necessary
244     */
245    public XAD getEdu8_SchoolAddress() { 
246                XAD retVal = this.getTypedField(8, 0);
247                return retVal;
248    }
249
250
251    /**
252     * Returns all repetitions of Major Field of Study (EDU-9).
253     */
254    public CWE[] getMajorFieldOfStudy() {
255        CWE[] retVal = this.getTypedField(9, new CWE[0]);
256        return retVal;
257    }
258
259
260    /**
261     * Returns all repetitions of Major Field of Study (EDU-9).
262     */
263    public CWE[] getEdu9_MajorFieldOfStudy() {
264        CWE[] retVal = this.getTypedField(9, new CWE[0]);
265        return retVal;
266    }
267
268
269    /**
270     * Returns a count of the current number of repetitions of Major Field of Study (EDU-9).
271     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
272     * it will return zero.
273     */
274    public int getMajorFieldOfStudyReps() {
275        return this.getReps(9);
276    }
277
278
279    /**
280     * Returns a specific repetition of
281     * EDU-9: "Major Field of Study" - creates it if necessary
282     *
283     * @param rep The repetition index (0-indexed)
284     */
285    public CWE getMajorFieldOfStudy(int rep) { 
286                CWE retVal = this.getTypedField(9, rep);
287                return retVal;
288    }
289
290    /**
291     * Returns a specific repetition of
292     * EDU-9: "Major Field of Study" - creates it if necessary
293     *
294     * @param rep The repetition index (0-indexed)
295     */
296    public CWE getEdu9_MajorFieldOfStudy(int rep) { 
297                CWE retVal = this.getTypedField(9, rep);
298                return retVal;
299    }
300
301    /**
302     * Returns a count of the current number of repetitions of Major Field of Study (EDU-9).
303     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
304     * it will return zero.
305     */
306    public int getEdu9_MajorFieldOfStudyReps() {
307        return this.getReps(9);
308    }
309
310
311    /**
312     * Inserts a repetition of
313     * EDU-9: "Major Field of Study" at a specific index
314     *
315     * @param rep The repetition index (0-indexed)
316     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
317     */
318    public CWE insertMajorFieldOfStudy(int rep) throws HL7Exception { 
319        return (CWE) super.insertRepetition(9, rep);
320    }
321
322
323    /**
324     * Inserts a repetition of
325     * EDU-9: "Major Field of Study" at a specific index
326     *
327     * @param rep The repetition index (0-indexed)
328     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
329     */
330    public CWE insertEdu9_MajorFieldOfStudy(int rep) throws HL7Exception { 
331        return (CWE) super.insertRepetition(9, rep);
332    }
333
334
335    /**
336     * Removes a repetition of
337     * EDU-9: "Major Field of Study" at a specific index
338     *
339     * @param rep The repetition index (0-indexed)
340     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
341     */
342    public CWE removeMajorFieldOfStudy(int rep) throws HL7Exception { 
343        return (CWE) super.removeRepetition(9, rep);
344    }
345
346
347    /**
348     * Removes a repetition of
349     * EDU-9: "Major Field of Study" at a specific index
350     *
351     * @param rep The repetition index (0-indexed)
352     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
353     */
354    public CWE removeEdu9_MajorFieldOfStudy(int rep) throws HL7Exception { 
355        return (CWE) super.removeRepetition(9, rep);
356    }
357
358
359
360
361
362
363    /** {@inheritDoc} */   
364    protected Type createNewTypeWithoutReflection(int field) {
365       switch (field) {
366          case 0: return new SI(getMessage());
367          case 1: return new IS(getMessage(), new Integer( 360 ));
368          case 2: return new DR(getMessage());
369          case 3: return new DR(getMessage());
370          case 4: return new DT(getMessage());
371          case 5: return new XON(getMessage());
372          case 6: return new CE(getMessage());
373          case 7: return new XAD(getMessage());
374          case 8: return new CWE(getMessage());
375          default: return null;
376       }
377   }
378
379
380}
381