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