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.v24.segment;
035
036// import ca.uhn.hl7v2.model.v24.group.*;
037import ca.uhn.hl7v2.model.v24.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 *<p>Represents an HL7 DB1 message segment (Disability). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>DB1-1: Set ID - DB1 (SI) <b> </b>
052     * <li>DB1-2: Disabled Person Code (IS) <b>optional </b>
053     * <li>DB1-3: Disabled Person Identifier (CX) <b>optional repeating</b>
054     * <li>DB1-4: Disability Indicator (ID) <b>optional </b>
055     * <li>DB1-5: Disability Start Date (DT) <b>optional </b>
056     * <li>DB1-6: Disability End Date (DT) <b>optional </b>
057     * <li>DB1-7: Disability Return to Work Date (DT) <b>optional </b>
058     * <li>DB1-8: Disability Unable to Work Date (DT) <b>optional </b>
059 * </ul>
060 */
061@SuppressWarnings("unused")
062public class DB1 extends AbstractSegment {
063
064    /** 
065     * Creates a new DB1 segment
066     */
067    public DB1(Group parent, ModelClassFactory factory) {
068       super(parent, factory);
069       init(factory);
070    }
071
072    private void init(ModelClassFactory factory) {
073       try {
074                                  this.add(SI.class, true, 1, 4, new Object[]{ getMessage() }, "Set ID - DB1");
075                                              this.add(IS.class, false, 1, 2, new Object[]{ getMessage(), new Integer(334) }, "Disabled Person Code");
076                                  this.add(CX.class, false, 0, 250, new Object[]{ getMessage() }, "Disabled Person Identifier");
077                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(136) }, "Disability Indicator");
078                                  this.add(DT.class, false, 1, 8, new Object[]{ getMessage() }, "Disability Start Date");
079                                  this.add(DT.class, false, 1, 8, new Object[]{ getMessage() }, "Disability End Date");
080                                  this.add(DT.class, false, 1, 8, new Object[]{ getMessage() }, "Disability Return to Work Date");
081                                  this.add(DT.class, false, 1, 8, new Object[]{ getMessage() }, "Disability Unable to Work Date");
082       } catch(HL7Exception e) {
083          log.error("Unexpected error creating DB1 - this is probably a bug in the source code generator.", e);
084       }
085    }
086
087
088
089    /**
090     * Returns
091     * DB1-1: "Set ID - DB1" - creates it if necessary
092     */
093    public SI getSetIDDB1() { 
094                SI retVal = this.getTypedField(1, 0);
095                return retVal;
096    }
097    
098    /**
099     * Returns
100     * DB1-1: "Set ID - DB1" - creates it if necessary
101     */
102    public SI getDb11_SetIDDB1() { 
103                SI retVal = this.getTypedField(1, 0);
104                return retVal;
105    }
106
107
108
109    /**
110     * Returns
111     * DB1-2: "Disabled Person Code" - creates it if necessary
112     */
113    public IS getDisabledPersonCode() { 
114                IS retVal = this.getTypedField(2, 0);
115                return retVal;
116    }
117    
118    /**
119     * Returns
120     * DB1-2: "Disabled Person Code" - creates it if necessary
121     */
122    public IS getDb12_DisabledPersonCode() { 
123                IS retVal = this.getTypedField(2, 0);
124                return retVal;
125    }
126
127
128    /**
129     * Returns all repetitions of Disabled Person Identifier (DB1-3).
130     */
131    public CX[] getDisabledPersonIdentifier() {
132        CX[] retVal = this.getTypedField(3, new CX[0]);
133        return retVal;
134    }
135
136
137    /**
138     * Returns all repetitions of Disabled Person Identifier (DB1-3).
139     */
140    public CX[] getDb13_DisabledPersonIdentifier() {
141        CX[] retVal = this.getTypedField(3, new CX[0]);
142        return retVal;
143    }
144
145
146    /**
147     * Returns a count of the current number of repetitions of Disabled Person Identifier (DB1-3).
148     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
149     * it will return zero.
150     */
151    public int getDisabledPersonIdentifierReps() {
152        return this.getReps(3);
153    }
154
155
156    /**
157     * Returns a specific repetition of
158     * DB1-3: "Disabled Person Identifier" - creates it if necessary
159     *
160     * @param rep The repetition index (0-indexed)
161     */
162    public CX getDisabledPersonIdentifier(int rep) { 
163                CX retVal = this.getTypedField(3, rep);
164                return retVal;
165    }
166
167    /**
168     * Returns a specific repetition of
169     * DB1-3: "Disabled Person Identifier" - creates it if necessary
170     *
171     * @param rep The repetition index (0-indexed)
172     */
173    public CX getDb13_DisabledPersonIdentifier(int rep) { 
174                CX retVal = this.getTypedField(3, rep);
175                return retVal;
176    }
177
178    /**
179     * Returns a count of the current number of repetitions of Disabled Person Identifier (DB1-3).
180     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
181     * it will return zero.
182     */
183    public int getDb13_DisabledPersonIdentifierReps() {
184        return this.getReps(3);
185    }
186
187
188    /**
189     * Inserts a repetition of
190     * DB1-3: "Disabled Person Identifier" at a specific index
191     *
192     * @param rep The repetition index (0-indexed)
193     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
194     */
195    public CX insertDisabledPersonIdentifier(int rep) throws HL7Exception { 
196        return (CX) super.insertRepetition(3, rep);
197    }
198
199
200    /**
201     * Inserts a repetition of
202     * DB1-3: "Disabled Person Identifier" at a specific index
203     *
204     * @param rep The repetition index (0-indexed)
205     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
206     */
207    public CX insertDb13_DisabledPersonIdentifier(int rep) throws HL7Exception { 
208        return (CX) super.insertRepetition(3, rep);
209    }
210
211
212    /**
213     * Removes a repetition of
214     * DB1-3: "Disabled Person Identifier" at a specific index
215     *
216     * @param rep The repetition index (0-indexed)
217     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
218     */
219    public CX removeDisabledPersonIdentifier(int rep) throws HL7Exception { 
220        return (CX) super.removeRepetition(3, rep);
221    }
222
223
224    /**
225     * Removes a repetition of
226     * DB1-3: "Disabled Person Identifier" at a specific index
227     *
228     * @param rep The repetition index (0-indexed)
229     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
230     */
231    public CX removeDb13_DisabledPersonIdentifier(int rep) throws HL7Exception { 
232        return (CX) super.removeRepetition(3, rep);
233    }
234
235
236
237
238    /**
239     * Returns
240     * DB1-4: "Disability Indicator" - creates it if necessary
241     */
242    public ID getDisabilityIndicator() { 
243                ID retVal = this.getTypedField(4, 0);
244                return retVal;
245    }
246    
247    /**
248     * Returns
249     * DB1-4: "Disability Indicator" - creates it if necessary
250     */
251    public ID getDb14_DisabilityIndicator() { 
252                ID retVal = this.getTypedField(4, 0);
253                return retVal;
254    }
255
256
257
258    /**
259     * Returns
260     * DB1-5: "Disability Start Date" - creates it if necessary
261     */
262    public DT getDisabilityStartDate() { 
263                DT retVal = this.getTypedField(5, 0);
264                return retVal;
265    }
266    
267    /**
268     * Returns
269     * DB1-5: "Disability Start Date" - creates it if necessary
270     */
271    public DT getDb15_DisabilityStartDate() { 
272                DT retVal = this.getTypedField(5, 0);
273                return retVal;
274    }
275
276
277
278    /**
279     * Returns
280     * DB1-6: "Disability End Date" - creates it if necessary
281     */
282    public DT getDisabilityEndDate() { 
283                DT retVal = this.getTypedField(6, 0);
284                return retVal;
285    }
286    
287    /**
288     * Returns
289     * DB1-6: "Disability End Date" - creates it if necessary
290     */
291    public DT getDb16_DisabilityEndDate() { 
292                DT retVal = this.getTypedField(6, 0);
293                return retVal;
294    }
295
296
297
298    /**
299     * Returns
300     * DB1-7: "Disability Return to Work Date" - creates it if necessary
301     */
302    public DT getDisabilityReturnToWorkDate() { 
303                DT retVal = this.getTypedField(7, 0);
304                return retVal;
305    }
306    
307    /**
308     * Returns
309     * DB1-7: "Disability Return to Work Date" - creates it if necessary
310     */
311    public DT getDb17_DisabilityReturnToWorkDate() { 
312                DT retVal = this.getTypedField(7, 0);
313                return retVal;
314    }
315
316
317
318    /**
319     * Returns
320     * DB1-8: "Disability Unable to Work Date" - creates it if necessary
321     */
322    public DT getDisabilityUnableToWorkDate() { 
323                DT retVal = this.getTypedField(8, 0);
324                return retVal;
325    }
326    
327    /**
328     * Returns
329     * DB1-8: "Disability Unable to Work Date" - creates it if necessary
330     */
331    public DT getDb18_DisabilityUnableToWorkDate() { 
332                DT retVal = this.getTypedField(8, 0);
333                return retVal;
334    }
335
336
337
338
339
340    /** {@inheritDoc} */   
341    protected Type createNewTypeWithoutReflection(int field) {
342       switch (field) {
343          case 0: return new SI(getMessage());
344          case 1: return new IS(getMessage(), new Integer( 334 ));
345          case 2: return new CX(getMessage());
346          case 3: return new ID(getMessage(), new Integer( 136 ));
347          case 4: return new DT(getMessage());
348          case 5: return new DT(getMessage());
349          case 6: return new DT(getMessage());
350          case 7: return new DT(getMessage());
351          default: return null;
352       }
353   }
354
355
356}
357