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.message;
035
036import ca.uhn.hl7v2.model.v251.group.*;
037import ca.uhn.hl7v2.model.v251.segment.*;
038
039import java.util.List;
040
041import ca.uhn.hl7v2.HL7Exception;
042import ca.uhn.hl7v2.parser.ModelClassFactory;
043import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
044import ca.uhn.hl7v2.model.AbstractMessage;
045
046/**
047 * <p>Represents a ADT_A02 message structure (see chapter 3.3.2). This structure contains the 
048 * following elements: </p>
049 * <ul>
050                 * <li>1: MSH (Message Header) <b> </b></li>
051                 * <li>2: SFT (Software Segment) <b>optional repeating</b></li>
052                 * <li>3: EVN (Event Type) <b> </b></li>
053                 * <li>4: PID (Patient Identification) <b> </b></li>
054                 * <li>5: PD1 (Patient Additional Demographic) <b>optional </b></li>
055                 * <li>6: ROL (Role) <b>optional repeating</b></li>
056                 * <li>7: PV1 (Patient Visit) <b> </b></li>
057                 * <li>8: PV2 (Patient Visit - Additional Information) <b>optional </b></li>
058                 * <li>9: ROL (Role) <b>optional repeating</b></li>
059                 * <li>10: DB1 (Disability) <b>optional repeating</b></li>
060                 * <li>11: OBX (Observation/Result) <b>optional repeating</b></li>
061                 * <li>12: PDA (Patient Death and Autopsy) <b>optional </b></li>
062 * </ul>
063 */
064@SuppressWarnings("unused")
065public class ADT_A02 extends AbstractMessage  {
066
067    /**
068     * Creates a new ADT_A02 message with DefaultModelClassFactory. 
069     */ 
070    public ADT_A02() { 
071       this(new DefaultModelClassFactory());
072    }
073
074    /** 
075     * Creates a new ADT_A02 message with custom ModelClassFactory.
076     */
077    public ADT_A02(ModelClassFactory factory) {
078       super(factory);
079       init(factory);
080    }
081
082    private void init(ModelClassFactory factory) {
083       try {
084                          this.add(MSH.class, true, false);
085                          this.add(SFT.class, false, true);
086                          this.add(EVN.class, true, false);
087                          this.add(PID.class, true, false);
088                          this.add(PD1.class, false, false);
089                          this.add(ROL.class, false, true);
090                          this.add(PV1.class, true, false);
091                          this.add(PV2.class, false, false);
092                          this.add(ROL.class, false, true);
093                          this.add(DB1.class, false, true);
094                          this.add(OBX.class, false, true);
095                          this.add(PDA.class, false, false);
096       } catch(HL7Exception e) {
097          log.error("Unexpected error creating ADT_A02 - this is probably a bug in the source code generator.", e);
098       }
099    }
100
101    /** 
102     * Returns "2.5.1"
103     */
104    public String getVersion() {
105       return "2.5.1";
106    }
107
108
109
110    /**
111     * Returns
112     * MSH (Message Header) - creates it if necessary
113     */
114    public MSH getMSH() { 
115       return getTyped("MSH", MSH.class);
116    }
117
118
119
120
121    /**
122     * Returns
123     * the first repetition of 
124     * SFT (Software Segment) - creates it if necessary
125     */
126    public SFT getSFT() { 
127       return getTyped("SFT", SFT.class);
128    }
129
130
131    /**
132     * Returns a specific repetition of
133     * SFT (Software Segment) - creates it if necessary
134     *
135     * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
136     * @throws HL7Exception if the repetition requested is more than one 
137     *     greater than the number of existing repetitions.
138     */
139    public SFT getSFT(int rep) { 
140       return getTyped("SFT", rep, SFT.class);
141    }
142
143    /** 
144     * Returns the number of existing repetitions of SFT 
145     */ 
146    public int getSFTReps() { 
147        return getReps("SFT");
148    } 
149
150    /** 
151     * <p>
152     * Returns a non-modifiable List containing all current existing repetitions of SFT.
153     * <p>
154     * <p>
155     * Note that unlike {@link #getSFT()}, this method will not create any reps
156     * if none are already present, so an empty list may be returned.
157     * </p>
158     */ 
159    public List<SFT> getSFTAll() throws HL7Exception {
160        return getAllAsList("SFT", SFT.class);
161    } 
162
163    /**
164     * Inserts a specific repetition of SFT (Software Segment)
165     * @see AbstractGroup#insertRepetition(Structure, int) 
166     */
167    public void insertSFT(SFT structure, int rep) throws HL7Exception { 
168       super.insertRepetition( "SFT", structure, rep);
169    }
170
171
172    /**
173     * Inserts a specific repetition of SFT (Software Segment)
174     * @see AbstractGroup#insertRepetition(Structure, int) 
175     */
176    public SFT insertSFT(int rep) throws HL7Exception { 
177       return (SFT)super.insertRepetition("SFT", rep);
178    }
179
180
181    /**
182     * Removes a specific repetition of SFT (Software Segment)
183     * @see AbstractGroup#removeRepetition(String, int) 
184     */
185    public SFT removeSFT(int rep) throws HL7Exception { 
186       return (SFT)super.removeRepetition("SFT", rep);
187    }
188
189
190
191    /**
192     * Returns
193     * EVN (Event Type) - creates it if necessary
194     */
195    public EVN getEVN() { 
196       return getTyped("EVN", EVN.class);
197    }
198
199
200
201
202    /**
203     * Returns
204     * PID (Patient Identification) - creates it if necessary
205     */
206    public PID getPID() { 
207       return getTyped("PID", PID.class);
208    }
209
210
211
212
213    /**
214     * Returns
215     * PD1 (Patient Additional Demographic) - creates it if necessary
216     */
217    public PD1 getPD1() { 
218       return getTyped("PD1", PD1.class);
219    }
220
221
222
223
224    /**
225     * Returns
226     * the first repetition of 
227     * ROL (Role) - creates it if necessary
228     */
229    public ROL getROL() { 
230       return getTyped("ROL", ROL.class);
231    }
232
233
234    /**
235     * Returns a specific repetition of
236     * ROL (Role) - creates it if necessary
237     *
238     * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
239     * @throws HL7Exception if the repetition requested is more than one 
240     *     greater than the number of existing repetitions.
241     */
242    public ROL getROL(int rep) { 
243       return getTyped("ROL", rep, ROL.class);
244    }
245
246    /** 
247     * Returns the number of existing repetitions of ROL 
248     */ 
249    public int getROLReps() { 
250        return getReps("ROL");
251    } 
252
253    /** 
254     * <p>
255     * Returns a non-modifiable List containing all current existing repetitions of ROL.
256     * <p>
257     * <p>
258     * Note that unlike {@link #getROL()}, this method will not create any reps
259     * if none are already present, so an empty list may be returned.
260     * </p>
261     */ 
262    public List<ROL> getROLAll() throws HL7Exception {
263        return getAllAsList("ROL", ROL.class);
264    } 
265
266    /**
267     * Inserts a specific repetition of ROL (Role)
268     * @see AbstractGroup#insertRepetition(Structure, int) 
269     */
270    public void insertROL(ROL structure, int rep) throws HL7Exception { 
271       super.insertRepetition( "ROL", structure, rep);
272    }
273
274
275    /**
276     * Inserts a specific repetition of ROL (Role)
277     * @see AbstractGroup#insertRepetition(Structure, int) 
278     */
279    public ROL insertROL(int rep) throws HL7Exception { 
280       return (ROL)super.insertRepetition("ROL", rep);
281    }
282
283
284    /**
285     * Removes a specific repetition of ROL (Role)
286     * @see AbstractGroup#removeRepetition(String, int) 
287     */
288    public ROL removeROL(int rep) throws HL7Exception { 
289       return (ROL)super.removeRepetition("ROL", rep);
290    }
291
292
293
294    /**
295     * Returns
296     * PV1 (Patient Visit) - creates it if necessary
297     */
298    public PV1 getPV1() { 
299       return getTyped("PV1", PV1.class);
300    }
301
302
303
304
305    /**
306     * Returns
307     * PV2 (Patient Visit - Additional Information) - creates it if necessary
308     */
309    public PV2 getPV2() { 
310       return getTyped("PV2", PV2.class);
311    }
312
313
314
315
316    /**
317     * Returns
318     * the first repetition of 
319     * ROL2 (Role) - creates it if necessary
320     */
321    public ROL getROL2() { 
322       return getTyped("ROL2", ROL.class);
323    }
324
325
326    /**
327     * Returns a specific repetition of
328     * ROL2 (Role) - creates it if necessary
329     *
330     * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
331     * @throws HL7Exception if the repetition requested is more than one 
332     *     greater than the number of existing repetitions.
333     */
334    public ROL getROL2(int rep) { 
335       return getTyped("ROL2", rep, ROL.class);
336    }
337
338    /** 
339     * Returns the number of existing repetitions of ROL2 
340     */ 
341    public int getROL2Reps() { 
342        return getReps("ROL2");
343    } 
344
345    /** 
346     * <p>
347     * Returns a non-modifiable List containing all current existing repetitions of ROL2.
348     * <p>
349     * <p>
350     * Note that unlike {@link #getROL2()}, this method will not create any reps
351     * if none are already present, so an empty list may be returned.
352     * </p>
353     */ 
354    public List<ROL> getROL2All() throws HL7Exception {
355        return getAllAsList("ROL2", ROL.class);
356    } 
357
358    /**
359     * Inserts a specific repetition of ROL2 (Role)
360     * @see AbstractGroup#insertRepetition(Structure, int) 
361     */
362    public void insertROL2(ROL structure, int rep) throws HL7Exception { 
363       super.insertRepetition( "ROL2", structure, rep);
364    }
365
366
367    /**
368     * Inserts a specific repetition of ROL2 (Role)
369     * @see AbstractGroup#insertRepetition(Structure, int) 
370     */
371    public ROL insertROL2(int rep) throws HL7Exception { 
372       return (ROL)super.insertRepetition("ROL2", rep);
373    }
374
375
376    /**
377     * Removes a specific repetition of ROL2 (Role)
378     * @see AbstractGroup#removeRepetition(String, int) 
379     */
380    public ROL removeROL2(int rep) throws HL7Exception { 
381       return (ROL)super.removeRepetition("ROL2", rep);
382    }
383
384
385
386    /**
387     * Returns
388     * the first repetition of 
389     * DB1 (Disability) - creates it if necessary
390     */
391    public DB1 getDB1() { 
392       return getTyped("DB1", DB1.class);
393    }
394
395
396    /**
397     * Returns a specific repetition of
398     * DB1 (Disability) - creates it if necessary
399     *
400     * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
401     * @throws HL7Exception if the repetition requested is more than one 
402     *     greater than the number of existing repetitions.
403     */
404    public DB1 getDB1(int rep) { 
405       return getTyped("DB1", rep, DB1.class);
406    }
407
408    /** 
409     * Returns the number of existing repetitions of DB1 
410     */ 
411    public int getDB1Reps() { 
412        return getReps("DB1");
413    } 
414
415    /** 
416     * <p>
417     * Returns a non-modifiable List containing all current existing repetitions of DB1.
418     * <p>
419     * <p>
420     * Note that unlike {@link #getDB1()}, this method will not create any reps
421     * if none are already present, so an empty list may be returned.
422     * </p>
423     */ 
424    public List<DB1> getDB1All() throws HL7Exception {
425        return getAllAsList("DB1", DB1.class);
426    } 
427
428    /**
429     * Inserts a specific repetition of DB1 (Disability)
430     * @see AbstractGroup#insertRepetition(Structure, int) 
431     */
432    public void insertDB1(DB1 structure, int rep) throws HL7Exception { 
433       super.insertRepetition( "DB1", structure, rep);
434    }
435
436
437    /**
438     * Inserts a specific repetition of DB1 (Disability)
439     * @see AbstractGroup#insertRepetition(Structure, int) 
440     */
441    public DB1 insertDB1(int rep) throws HL7Exception { 
442       return (DB1)super.insertRepetition("DB1", rep);
443    }
444
445
446    /**
447     * Removes a specific repetition of DB1 (Disability)
448     * @see AbstractGroup#removeRepetition(String, int) 
449     */
450    public DB1 removeDB1(int rep) throws HL7Exception { 
451       return (DB1)super.removeRepetition("DB1", rep);
452    }
453
454
455
456    /**
457     * Returns
458     * the first repetition of 
459     * OBX (Observation/Result) - creates it if necessary
460     */
461    public OBX getOBX() { 
462       return getTyped("OBX", OBX.class);
463    }
464
465
466    /**
467     * Returns a specific repetition of
468     * OBX (Observation/Result) - creates it if necessary
469     *
470     * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
471     * @throws HL7Exception if the repetition requested is more than one 
472     *     greater than the number of existing repetitions.
473     */
474    public OBX getOBX(int rep) { 
475       return getTyped("OBX", rep, OBX.class);
476    }
477
478    /** 
479     * Returns the number of existing repetitions of OBX 
480     */ 
481    public int getOBXReps() { 
482        return getReps("OBX");
483    } 
484
485    /** 
486     * <p>
487     * Returns a non-modifiable List containing all current existing repetitions of OBX.
488     * <p>
489     * <p>
490     * Note that unlike {@link #getOBX()}, this method will not create any reps
491     * if none are already present, so an empty list may be returned.
492     * </p>
493     */ 
494    public List<OBX> getOBXAll() throws HL7Exception {
495        return getAllAsList("OBX", OBX.class);
496    } 
497
498    /**
499     * Inserts a specific repetition of OBX (Observation/Result)
500     * @see AbstractGroup#insertRepetition(Structure, int) 
501     */
502    public void insertOBX(OBX structure, int rep) throws HL7Exception { 
503       super.insertRepetition( "OBX", structure, rep);
504    }
505
506
507    /**
508     * Inserts a specific repetition of OBX (Observation/Result)
509     * @see AbstractGroup#insertRepetition(Structure, int) 
510     */
511    public OBX insertOBX(int rep) throws HL7Exception { 
512       return (OBX)super.insertRepetition("OBX", rep);
513    }
514
515
516    /**
517     * Removes a specific repetition of OBX (Observation/Result)
518     * @see AbstractGroup#removeRepetition(String, int) 
519     */
520    public OBX removeOBX(int rep) throws HL7Exception { 
521       return (OBX)super.removeRepetition("OBX", rep);
522    }
523
524
525
526    /**
527     * Returns
528     * PDA (Patient Death and Autopsy) - creates it if necessary
529     */
530    public PDA getPDA() { 
531       return getTyped("PDA", PDA.class);
532    }
533
534
535
536
537}
538