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.v22.message;
035
036import ca.uhn.hl7v2.model.v22.group.*;
037import ca.uhn.hl7v2.model.v22.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_A17 message structure (see chapter ?). 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: PV1 (PATIENT VISIT) <b> </b></li>
054                 * <li>5: PV2 (PATIENT VISIT - additional information) <b>optional </b></li>
055                 * <li>6: OBX (OBSERVATION RESULT) <b>optional repeating</b></li>
056                 * <li>7: PID (PATIENT IDENTIFICATION) <b> </b></li>
057                 * <li>8: PV1 (PATIENT VISIT) <b> </b></li>
058                 * <li>9: PV2 (PATIENT VISIT - additional information) <b>optional </b></li>
059                 * <li>10: OBX (OBSERVATION RESULT) <b>optional repeating</b></li>
060 * </ul>
061 */
062@SuppressWarnings("unused")
063public class ADT_A17 extends AbstractMessage  {
064
065    /**
066     * Creates a new ADT_A17 message with DefaultModelClassFactory. 
067     */ 
068    public ADT_A17() { 
069       this(new DefaultModelClassFactory());
070    }
071
072    /** 
073     * Creates a new ADT_A17 message with custom ModelClassFactory.
074     */
075    public ADT_A17(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, true, false);
085                          this.add(PV1.class, true, false);
086                          this.add(PV2.class, false, false);
087                          this.add(OBX.class, false, true);
088                          this.add(PID.class, true, false);
089                          this.add(PV1.class, true, false);
090                          this.add(PV2.class, false, false);
091                          this.add(OBX.class, false, true);
092       } catch(HL7Exception e) {
093          log.error("Unexpected error creating ADT_A17 - this is probably a bug in the source code generator.", e);
094       }
095    }
096
097    /** 
098     * Returns "2.2"
099     */
100    public String getVersion() {
101       return "2.2";
102    }
103
104
105
106    /**
107     * Returns
108     * MSH (MESSAGE HEADER) - creates it if necessary
109     */
110    public MSH getMSH() { 
111       return getTyped("MSH", MSH.class);
112    }
113
114
115
116
117    /**
118     * Returns
119     * EVN (EVENT TYPE) - creates it if necessary
120     */
121    public EVN getEVN() { 
122       return getTyped("EVN", EVN.class);
123    }
124
125
126
127
128    /**
129     * Returns
130     * PID (PATIENT IDENTIFICATION) - creates it if necessary
131     */
132    public PID getPID() { 
133       return getTyped("PID", PID.class);
134    }
135
136
137
138
139    /**
140     * Returns
141     * PV1 (PATIENT VISIT) - creates it if necessary
142     */
143    public PV1 getPV1() { 
144       return getTyped("PV1", PV1.class);
145    }
146
147
148
149
150    /**
151     * Returns
152     * PV2 (PATIENT VISIT - additional information) - creates it if necessary
153     */
154    public PV2 getPV2() { 
155       return getTyped("PV2", PV2.class);
156    }
157
158
159
160
161    /**
162     * Returns
163     * the first repetition of 
164     * OBX (OBSERVATION RESULT) - creates it if necessary
165     */
166    public OBX getOBX() { 
167       return getTyped("OBX", OBX.class);
168    }
169
170
171    /**
172     * Returns a specific repetition of
173     * OBX (OBSERVATION RESULT) - creates it if necessary
174     *
175     * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
176     * @throws HL7Exception if the repetition requested is more than one 
177     *     greater than the number of existing repetitions.
178     */
179    public OBX getOBX(int rep) { 
180       return getTyped("OBX", rep, OBX.class);
181    }
182
183    /** 
184     * Returns the number of existing repetitions of OBX 
185     */ 
186    public int getOBXReps() { 
187        return getReps("OBX");
188    } 
189
190    /** 
191     * <p>
192     * Returns a non-modifiable List containing all current existing repetitions of OBX.
193     * <p>
194     * <p>
195     * Note that unlike {@link #getOBX()}, this method will not create any reps
196     * if none are already present, so an empty list may be returned.
197     * </p>
198     */ 
199    public List<OBX> getOBXAll() throws HL7Exception {
200        return getAllAsList("OBX", OBX.class);
201    } 
202
203    /**
204     * Inserts a specific repetition of OBX (OBSERVATION RESULT)
205     * @see AbstractGroup#insertRepetition(Structure, int) 
206     */
207    public void insertOBX(OBX structure, int rep) throws HL7Exception { 
208       super.insertRepetition( "OBX", structure, rep);
209    }
210
211
212    /**
213     * Inserts a specific repetition of OBX (OBSERVATION RESULT)
214     * @see AbstractGroup#insertRepetition(Structure, int) 
215     */
216    public OBX insertOBX(int rep) throws HL7Exception { 
217       return (OBX)super.insertRepetition("OBX", rep);
218    }
219
220
221    /**
222     * Removes a specific repetition of OBX (OBSERVATION RESULT)
223     * @see AbstractGroup#removeRepetition(String, int) 
224     */
225    public OBX removeOBX(int rep) throws HL7Exception { 
226       return (OBX)super.removeRepetition("OBX", rep);
227    }
228
229
230
231    /**
232     * Returns
233     * PID2 (PATIENT IDENTIFICATION) - creates it if necessary
234     */
235    public PID getPID2() { 
236       return getTyped("PID2", PID.class);
237    }
238
239
240
241
242    /**
243     * Returns
244     * PV12 (PATIENT VISIT) - creates it if necessary
245     */
246    public PV1 getPV12() { 
247       return getTyped("PV12", PV1.class);
248    }
249
250
251
252
253    /**
254     * Returns
255     * PV22 (PATIENT VISIT - additional information) - creates it if necessary
256     */
257    public PV2 getPV22() { 
258       return getTyped("PV22", PV2.class);
259    }
260
261
262
263
264    /**
265     * Returns
266     * the first repetition of 
267     * OBX2 (OBSERVATION RESULT) - creates it if necessary
268     */
269    public OBX getOBX2() { 
270       return getTyped("OBX2", OBX.class);
271    }
272
273
274    /**
275     * Returns a specific repetition of
276     * OBX2 (OBSERVATION RESULT) - creates it if necessary
277     *
278     * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
279     * @throws HL7Exception if the repetition requested is more than one 
280     *     greater than the number of existing repetitions.
281     */
282    public OBX getOBX2(int rep) { 
283       return getTyped("OBX2", rep, OBX.class);
284    }
285
286    /** 
287     * Returns the number of existing repetitions of OBX2 
288     */ 
289    public int getOBX2Reps() { 
290        return getReps("OBX2");
291    } 
292
293    /** 
294     * <p>
295     * Returns a non-modifiable List containing all current existing repetitions of OBX2.
296     * <p>
297     * <p>
298     * Note that unlike {@link #getOBX2()}, this method will not create any reps
299     * if none are already present, so an empty list may be returned.
300     * </p>
301     */ 
302    public List<OBX> getOBX2All() throws HL7Exception {
303        return getAllAsList("OBX2", OBX.class);
304    } 
305
306    /**
307     * Inserts a specific repetition of OBX2 (OBSERVATION RESULT)
308     * @see AbstractGroup#insertRepetition(Structure, int) 
309     */
310    public void insertOBX2(OBX structure, int rep) throws HL7Exception { 
311       super.insertRepetition( "OBX2", structure, rep);
312    }
313
314
315    /**
316     * Inserts a specific repetition of OBX2 (OBSERVATION RESULT)
317     * @see AbstractGroup#insertRepetition(Structure, int) 
318     */
319    public OBX insertOBX2(int rep) throws HL7Exception { 
320       return (OBX)super.insertRepetition("OBX2", rep);
321    }
322
323
324    /**
325     * Removes a specific repetition of OBX2 (OBSERVATION RESULT)
326     * @see AbstractGroup#removeRepetition(String, int) 
327     */
328    public OBX removeOBX2(int rep) throws HL7Exception { 
329       return (OBX)super.removeRepetition("OBX2", rep);
330    }
331
332
333
334}
335