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.v21.message;
035
036import ca.uhn.hl7v2.model.v21.group.*;
037import ca.uhn.hl7v2.model.v21.segment.*;
038
039import ca.uhn.hl7v2.HL7Exception;
040import ca.uhn.hl7v2.parser.ModelClassFactory;
041import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
042import ca.uhn.hl7v2.model.*;
043
044
045/**
046 * <p>Represents a ADT_AXX message structure (see chapter ). This structure contains the 
047 * following elements: </p>
048 * <ul>
049                                 * <li>1: MSH () <b> </b> </li>
050                                 * <li>2: EVN () <b> </b> </li>
051                                 * <li>3: PID () <b>optional </b> </li>
052                                 * <li>4: MRG () <b>optional </b> </li>
053                                 * <li>5: PD1 () <b>optional </b> </li>
054                                 * <li>6: NK1 () <b>optional </b> </li>
055                                 * <li>7: PV1 () <b>optional </b> </li>
056                                 * <li>8: DG1 () <b>optional </b> </li>
057                                 * <li>9: ADT_AXX_PATIENT () <b>optional repeating</b> </li>
058                                 * <li>10: NPU () <b>optional </b> </li>
059                                 * <li>11: PID () <b>optional </b> </li>
060 * </ul>
061 */
062//@SuppressWarnings("unused")
063public class ADT_AXX extends AbstractMessage  {
064
065    /**
066     * Creates a new ADT_AXX message with DefaultModelClassFactory. 
067     */ 
068    public ADT_AXX() { 
069       this(new DefaultModelClassFactory());
070    }
071
072    /** 
073     * Creates a new ADT_AXX message with custom ModelClassFactory.
074     */
075    public ADT_AXX(ModelClassFactory factory) {
076       super(factory);
077       init(factory);
078    }
079
080    private void init(ModelClassFactory factory) {
081       try {
082                          this.add(MSH.class, true, false);
083                                  this.add(EVN.class, true, false);
084                                  this.add(PID.class, false, false);
085                                  this.add(MRG.class, false, false);
086                                  this.add(PD1.class, false, false);
087                                  this.add(NK1.class, false, false);
088                                  this.add(PV1.class, false, false);
089                                  this.add(DG1.class, false, false);
090                                  this.add(ADT_AXX_PATIENT.class, false, true);
091                                  this.add(NPU.class, false, false);
092                                  this.add(PID.class, false, false);
093               } catch(HL7Exception e) {
094          log.error("Unexpected error creating ADT_AXX - this is probably a bug in the source code generator.", e);
095       }
096    }
097
098
099    /** 
100     * Returns "2.1"
101     */
102    public String getVersion() {
103       return "2.1";
104    }
105
106
107
108
109    /**
110     * <p>
111     * Returns
112     * MSH () - creates it if necessary
113     * </p>
114     * 
115     *
116     */
117    public MSH getMSH() { 
118       return getTyped("MSH", MSH.class);
119    }
120
121
122
123
124
125    /**
126     * <p>
127     * Returns
128     * EVN () - creates it if necessary
129     * </p>
130     * 
131     *
132     */
133    public EVN getEVN() { 
134       return getTyped("EVN", EVN.class);
135    }
136
137
138
139
140
141    /**
142     * <p>
143     * Returns
144     * PID () - creates it if necessary
145     * </p>
146     * 
147     *
148     */
149    public PID getPID() { 
150       return getTyped("PID", PID.class);
151    }
152
153
154
155
156
157    /**
158     * <p>
159     * Returns
160     * MRG () - creates it if necessary
161     * </p>
162     * 
163     *
164     */
165    public MRG getMRG() { 
166       return getTyped("MRG", MRG.class);
167    }
168
169
170
171
172
173    /**
174     * <p>
175     * Returns
176     * PD1 () - creates it if necessary
177     * </p>
178     * 
179     *
180     */
181    public PD1 getPD1() { 
182       return getTyped("PD1", PD1.class);
183    }
184
185
186
187
188
189    /**
190     * <p>
191     * Returns
192     * NK1 () - creates it if necessary
193     * </p>
194     * 
195     *
196     */
197    public NK1 getNK1() { 
198       return getTyped("NK1", NK1.class);
199    }
200
201
202
203
204
205    /**
206     * <p>
207     * Returns
208     * PV1 () - creates it if necessary
209     * </p>
210     * 
211     *
212     */
213    public PV1 getPV1() { 
214       return getTyped("PV1", PV1.class);
215    }
216
217
218
219
220
221    /**
222     * <p>
223     * Returns
224     * DG1 () - creates it if necessary
225     * </p>
226     * 
227     *
228     */
229    public DG1 getDG1() { 
230       return getTyped("DG1", DG1.class);
231    }
232
233
234
235
236
237    /**
238     * <p>
239     * Returns
240     * the first repetition of 
241     * PATIENT () - creates it if necessary
242     * </p>
243     * 
244     *
245     */
246    public ADT_AXX_PATIENT getPATIENT() { 
247       return getTyped("PATIENT", ADT_AXX_PATIENT.class);
248    }
249
250
251    /**
252     * <p>
253     * Returns a specific repetition of
254     * PATIENT () - creates it if necessary
255     * </p>
256     * 
257     *
258     * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
259     * @throws HL7Exception if the repetition requested is more than one 
260     *     greater than the number of existing repetitions.
261     */
262    public ADT_AXX_PATIENT getPATIENT(int rep) { 
263       return getTyped("PATIENT", rep, ADT_AXX_PATIENT.class);
264    }
265
266    /** 
267     * <p>
268     * Returns the number of existing repetitions of PATIENT 
269     * </p>
270     * 
271     */ 
272    public int getPATIENTReps() { 
273        return getReps("PATIENT");
274    } 
275
276    /** 
277     * <p>
278     * Returns a non-modifiable List containing all current existing repetitions of PATIENT.
279     * <p>
280     * <p>
281     * Note that unlike {@link #getPATIENT()}, this method will not create any reps
282     * if none are already present, so an empty list may be returned.
283     * </p>
284     * 
285     */ 
286    public java.util.List<ADT_AXX_PATIENT> getPATIENTAll() throws HL7Exception {
287        return getAllAsList("PATIENT", ADT_AXX_PATIENT.class);
288    } 
289
290    /**
291     * <p>
292     * Inserts a specific repetition of PATIENT ()
293     * </p>
294     * 
295     *
296     * @see AbstractGroup#insertRepetition(Structure, int) 
297     */
298    public void insertPATIENT(ADT_AXX_PATIENT structure, int rep) throws HL7Exception { 
299       super.insertRepetition( "PATIENT", structure, rep);
300    }
301
302
303    /**
304     * <p>
305     * Inserts a specific repetition of PATIENT ()
306     * </p>
307     * 
308     *
309     * @see AbstractGroup#insertRepetition(Structure, int) 
310     */
311    public ADT_AXX_PATIENT insertPATIENT(int rep) throws HL7Exception { 
312       return (ADT_AXX_PATIENT)super.insertRepetition("PATIENT", rep);
313    }
314
315
316    /**
317     * <p>
318     * Removes a specific repetition of PATIENT ()
319     * </p>
320     * 
321     *
322     * @see AbstractGroup#removeRepetition(String, int) 
323     */
324    public ADT_AXX_PATIENT removePATIENT(int rep) throws HL7Exception { 
325       return (ADT_AXX_PATIENT)super.removeRepetition("PATIENT", rep);
326    }
327
328
329
330
331    /**
332     * <p>
333     * Returns
334     * NPU () - creates it if necessary
335     * </p>
336     * 
337     *
338     */
339    public NPU getNPU() { 
340       return getTyped("NPU", NPU.class);
341    }
342
343
344
345
346
347    /**
348     * <p>
349     * Returns
350     * PID2 () - creates it if necessary
351     * </p>
352     * 
353     *
354     */
355    public PID getPID2() { 
356       return getTyped("PID2", PID.class);
357    }
358
359
360
361
362}
363