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 PDA message segment (Patient death and autopsy). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>PDA-1: Death Cause Code (CE) <b>optional repeating</b>
052     * <li>PDA-2: Death Location (PL) <b>optional </b>
053     * <li>PDA-3: Death Certified Indicator (ID) <b>optional </b>
054     * <li>PDA-4: Death Certificate Signed Date/Time (TS) <b>optional </b>
055     * <li>PDA-5: Death Certified By (XCN) <b>optional </b>
056     * <li>PDA-6: Autopsy Indicator (ID) <b>optional </b>
057     * <li>PDA-7: Autopsy Start and End Date/Time (DR) <b>optional </b>
058     * <li>PDA-8: Autopsy Performed By (XCN) <b>optional </b>
059     * <li>PDA-9: Coroner Indicator (ID) <b>optional </b>
060 * </ul>
061 */
062@SuppressWarnings("unused")
063public class PDA extends AbstractSegment {
064
065    /** 
066     * Creates a new PDA segment
067     */
068    public PDA(Group parent, ModelClassFactory factory) {
069       super(parent, factory);
070       init(factory);
071    }
072
073    private void init(ModelClassFactory factory) {
074       try {
075                                  this.add(CE.class, false, 0, 250, new Object[]{ getMessage() }, "Death Cause Code");
076                                  this.add(PL.class, false, 1, 80, new Object[]{ getMessage() }, "Death Location");
077                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(136) }, "Death Certified Indicator");
078                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Death Certificate Signed Date/Time");
079                                  this.add(XCN.class, false, 1, 250, new Object[]{ getMessage() }, "Death Certified By");
080                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(136) }, "Autopsy Indicator");
081                                  this.add(DR.class, false, 1, 53, new Object[]{ getMessage() }, "Autopsy Start and End Date/Time");
082                                  this.add(XCN.class, false, 1, 250, new Object[]{ getMessage() }, "Autopsy Performed By");
083                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(136) }, "Coroner Indicator");
084       } catch(HL7Exception e) {
085          log.error("Unexpected error creating PDA - this is probably a bug in the source code generator.", e);
086       }
087    }
088
089
090    /**
091     * Returns all repetitions of Death Cause Code (PDA-1).
092     */
093    public CE[] getDeathCauseCode() {
094        CE[] retVal = this.getTypedField(1, new CE[0]);
095        return retVal;
096    }
097
098
099    /**
100     * Returns all repetitions of Death Cause Code (PDA-1).
101     */
102    public CE[] getPda1_DeathCauseCode() {
103        CE[] retVal = this.getTypedField(1, new CE[0]);
104        return retVal;
105    }
106
107
108    /**
109     * Returns a count of the current number of repetitions of Death Cause Code (PDA-1).
110     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
111     * it will return zero.
112     */
113    public int getDeathCauseCodeReps() {
114        return this.getReps(1);
115    }
116
117
118    /**
119     * Returns a specific repetition of
120     * PDA-1: "Death Cause Code" - creates it if necessary
121     *
122     * @param rep The repetition index (0-indexed)
123     */
124    public CE getDeathCauseCode(int rep) { 
125                CE retVal = this.getTypedField(1, rep);
126                return retVal;
127    }
128
129    /**
130     * Returns a specific repetition of
131     * PDA-1: "Death Cause Code" - creates it if necessary
132     *
133     * @param rep The repetition index (0-indexed)
134     */
135    public CE getPda1_DeathCauseCode(int rep) { 
136                CE retVal = this.getTypedField(1, rep);
137                return retVal;
138    }
139
140    /**
141     * Returns a count of the current number of repetitions of Death Cause Code (PDA-1).
142     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
143     * it will return zero.
144     */
145    public int getPda1_DeathCauseCodeReps() {
146        return this.getReps(1);
147    }
148
149
150    /**
151     * Inserts a repetition of
152     * PDA-1: "Death Cause Code" at a specific index
153     *
154     * @param rep The repetition index (0-indexed)
155     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
156     */
157    public CE insertDeathCauseCode(int rep) throws HL7Exception { 
158        return (CE) super.insertRepetition(1, rep);
159    }
160
161
162    /**
163     * Inserts a repetition of
164     * PDA-1: "Death Cause Code" at a specific index
165     *
166     * @param rep The repetition index (0-indexed)
167     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
168     */
169    public CE insertPda1_DeathCauseCode(int rep) throws HL7Exception { 
170        return (CE) super.insertRepetition(1, rep);
171    }
172
173
174    /**
175     * Removes a repetition of
176     * PDA-1: "Death Cause Code" at a specific index
177     *
178     * @param rep The repetition index (0-indexed)
179     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
180     */
181    public CE removeDeathCauseCode(int rep) throws HL7Exception { 
182        return (CE) super.removeRepetition(1, rep);
183    }
184
185
186    /**
187     * Removes a repetition of
188     * PDA-1: "Death Cause Code" at a specific index
189     *
190     * @param rep The repetition index (0-indexed)
191     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
192     */
193    public CE removePda1_DeathCauseCode(int rep) throws HL7Exception { 
194        return (CE) super.removeRepetition(1, rep);
195    }
196
197
198
199
200    /**
201     * Returns
202     * PDA-2: "Death Location" - creates it if necessary
203     */
204    public PL getDeathLocation() { 
205                PL retVal = this.getTypedField(2, 0);
206                return retVal;
207    }
208    
209    /**
210     * Returns
211     * PDA-2: "Death Location" - creates it if necessary
212     */
213    public PL getPda2_DeathLocation() { 
214                PL retVal = this.getTypedField(2, 0);
215                return retVal;
216    }
217
218
219
220    /**
221     * Returns
222     * PDA-3: "Death Certified Indicator" - creates it if necessary
223     */
224    public ID getDeathCertifiedIndicator() { 
225                ID retVal = this.getTypedField(3, 0);
226                return retVal;
227    }
228    
229    /**
230     * Returns
231     * PDA-3: "Death Certified Indicator" - creates it if necessary
232     */
233    public ID getPda3_DeathCertifiedIndicator() { 
234                ID retVal = this.getTypedField(3, 0);
235                return retVal;
236    }
237
238
239
240    /**
241     * Returns
242     * PDA-4: "Death Certificate Signed Date/Time" - creates it if necessary
243     */
244    public TS getDeathCertificateSignedDateTime() { 
245                TS retVal = this.getTypedField(4, 0);
246                return retVal;
247    }
248    
249    /**
250     * Returns
251     * PDA-4: "Death Certificate Signed Date/Time" - creates it if necessary
252     */
253    public TS getPda4_DeathCertificateSignedDateTime() { 
254                TS retVal = this.getTypedField(4, 0);
255                return retVal;
256    }
257
258
259
260    /**
261     * Returns
262     * PDA-5: "Death Certified By" - creates it if necessary
263     */
264    public XCN getDeathCertifiedBy() { 
265                XCN retVal = this.getTypedField(5, 0);
266                return retVal;
267    }
268    
269    /**
270     * Returns
271     * PDA-5: "Death Certified By" - creates it if necessary
272     */
273    public XCN getPda5_DeathCertifiedBy() { 
274                XCN retVal = this.getTypedField(5, 0);
275                return retVal;
276    }
277
278
279
280    /**
281     * Returns
282     * PDA-6: "Autopsy Indicator" - creates it if necessary
283     */
284    public ID getAutopsyIndicator() { 
285                ID retVal = this.getTypedField(6, 0);
286                return retVal;
287    }
288    
289    /**
290     * Returns
291     * PDA-6: "Autopsy Indicator" - creates it if necessary
292     */
293    public ID getPda6_AutopsyIndicator() { 
294                ID retVal = this.getTypedField(6, 0);
295                return retVal;
296    }
297
298
299
300    /**
301     * Returns
302     * PDA-7: "Autopsy Start and End Date/Time" - creates it if necessary
303     */
304    public DR getAutopsyStartAndEndDateTime() { 
305                DR retVal = this.getTypedField(7, 0);
306                return retVal;
307    }
308    
309    /**
310     * Returns
311     * PDA-7: "Autopsy Start and End Date/Time" - creates it if necessary
312     */
313    public DR getPda7_AutopsyStartAndEndDateTime() { 
314                DR retVal = this.getTypedField(7, 0);
315                return retVal;
316    }
317
318
319
320    /**
321     * Returns
322     * PDA-8: "Autopsy Performed By" - creates it if necessary
323     */
324    public XCN getAutopsyPerformedBy() { 
325                XCN retVal = this.getTypedField(8, 0);
326                return retVal;
327    }
328    
329    /**
330     * Returns
331     * PDA-8: "Autopsy Performed By" - creates it if necessary
332     */
333    public XCN getPda8_AutopsyPerformedBy() { 
334                XCN retVal = this.getTypedField(8, 0);
335                return retVal;
336    }
337
338
339
340    /**
341     * Returns
342     * PDA-9: "Coroner Indicator" - creates it if necessary
343     */
344    public ID getCoronerIndicator() { 
345                ID retVal = this.getTypedField(9, 0);
346                return retVal;
347    }
348    
349    /**
350     * Returns
351     * PDA-9: "Coroner Indicator" - creates it if necessary
352     */
353    public ID getPda9_CoronerIndicator() { 
354                ID retVal = this.getTypedField(9, 0);
355                return retVal;
356    }
357
358
359
360
361
362    /** {@inheritDoc} */   
363    protected Type createNewTypeWithoutReflection(int field) {
364       switch (field) {
365          case 0: return new CE(getMessage());
366          case 1: return new PL(getMessage());
367          case 2: return new ID(getMessage(), new Integer( 136 ));
368          case 3: return new TS(getMessage());
369          case 4: return new XCN(getMessage());
370          case 5: return new ID(getMessage(), new Integer( 136 ));
371          case 6: return new DR(getMessage());
372          case 7: return new XCN(getMessage());
373          case 8: return new ID(getMessage(), new Integer( 136 ));
374          default: return null;
375       }
376   }
377
378
379}
380