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