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.v231.message;
035
036import ca.uhn.hl7v2.model.v231.group.*;
037import ca.uhn.hl7v2.model.v231.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_A37 message structure (see chapter ?). This structure contains the 
048 * following elements: </p>
049 * <ul>
050                 * <li>1: MSH (MSH - message header segment) <b> </b></li>
051                 * <li>2: EVN (EVN - event type segment) <b> </b></li>
052                 * <li>3: PID (PID - patient identification segment) <b> </b></li>
053                 * <li>4: PD1 (PD1 - patient additional demographic segment) <b>optional </b></li>
054                 * <li>5: PV1 (PV1 - patient visit segment-) <b>optional </b></li>
055                 * <li>6: DB1 (DB1 - Disability segment) <b>optional repeating</b></li>
056                 * <li>7: PID (PID - patient identification segment) <b> </b></li>
057                 * <li>8: PD1 (PD1 - patient additional demographic segment) <b>optional </b></li>
058                 * <li>9: PV1 (PV1 - patient visit segment-) <b>optional </b></li>
059                 * <li>10: DB1 (DB1 - Disability segment) <b>optional repeating</b></li>
060 * </ul>
061 */
062@SuppressWarnings("unused")
063public class ADT_A37 extends AbstractMessage  {
064
065    /**
066     * Creates a new ADT_A37 message with DefaultModelClassFactory. 
067     */ 
068    public ADT_A37() { 
069       this(new DefaultModelClassFactory());
070    }
071
072    /** 
073     * Creates a new ADT_A37 message with custom ModelClassFactory.
074     */
075    public ADT_A37(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(PD1.class, false, false);
086                          this.add(PV1.class, false, false);
087                          this.add(DB1.class, false, true);
088                          this.add(PID.class, true, false);
089                          this.add(PD1.class, false, false);
090                          this.add(PV1.class, false, false);
091                          this.add(DB1.class, false, true);
092       } catch(HL7Exception e) {
093          log.error("Unexpected error creating ADT_A37 - this is probably a bug in the source code generator.", e);
094       }
095    }
096
097    /** 
098     * Returns "2.3.1"
099     */
100    public String getVersion() {
101       return "2.3.1";
102    }
103
104
105
106    /**
107     * Returns
108     * MSH (MSH - message header segment) - 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 (EVN - event type segment) - 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 (PID - patient identification segment) - creates it if necessary
131     */
132    public PID getPID() { 
133       return getTyped("PID", PID.class);
134    }
135
136
137
138
139    /**
140     * Returns
141     * PD1 (PD1 - patient additional demographic segment) - creates it if necessary
142     */
143    public PD1 getPD1() { 
144       return getTyped("PD1", PD1.class);
145    }
146
147
148
149
150    /**
151     * Returns
152     * PV1 (PV1 - patient visit segment-) - creates it if necessary
153     */
154    public PV1 getPV1() { 
155       return getTyped("PV1", PV1.class);
156    }
157
158
159
160
161    /**
162     * Returns
163     * the first repetition of 
164     * DB1 (DB1 - Disability segment) - creates it if necessary
165     */
166    public DB1 getDB1() { 
167       return getTyped("DB1", DB1.class);
168    }
169
170
171    /**
172     * Returns a specific repetition of
173     * DB1 (DB1 - Disability segment) - 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 DB1 getDB1(int rep) { 
180       return getTyped("DB1", rep, DB1.class);
181    }
182
183    /** 
184     * Returns the number of existing repetitions of DB1 
185     */ 
186    public int getDB1Reps() { 
187        return getReps("DB1");
188    } 
189
190    /** 
191     * <p>
192     * Returns a non-modifiable List containing all current existing repetitions of DB1.
193     * <p>
194     * <p>
195     * Note that unlike {@link #getDB1()}, 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<DB1> getDB1All() throws HL7Exception {
200        return getAllAsList("DB1", DB1.class);
201    } 
202
203    /**
204     * Inserts a specific repetition of DB1 (DB1 - Disability segment)
205     * @see AbstractGroup#insertRepetition(Structure, int) 
206     */
207    public void insertDB1(DB1 structure, int rep) throws HL7Exception { 
208       super.insertRepetition( "DB1", structure, rep);
209    }
210
211
212    /**
213     * Inserts a specific repetition of DB1 (DB1 - Disability segment)
214     * @see AbstractGroup#insertRepetition(Structure, int) 
215     */
216    public DB1 insertDB1(int rep) throws HL7Exception { 
217       return (DB1)super.insertRepetition("DB1", rep);
218    }
219
220
221    /**
222     * Removes a specific repetition of DB1 (DB1 - Disability segment)
223     * @see AbstractGroup#removeRepetition(String, int) 
224     */
225    public DB1 removeDB1(int rep) throws HL7Exception { 
226       return (DB1)super.removeRepetition("DB1", rep);
227    }
228
229
230
231    /**
232     * Returns
233     * PID2 (PID - patient identification segment) - creates it if necessary
234     */
235    public PID getPID2() { 
236       return getTyped("PID2", PID.class);
237    }
238
239
240
241
242    /**
243     * Returns
244     * PD12 (PD1 - patient additional demographic segment) - creates it if necessary
245     */
246    public PD1 getPD12() { 
247       return getTyped("PD12", PD1.class);
248    }
249
250
251
252
253    /**
254     * Returns
255     * PV12 (PV1 - patient visit segment-) - creates it if necessary
256     */
257    public PV1 getPV12() { 
258       return getTyped("PV12", PV1.class);
259    }
260
261
262
263
264    /**
265     * Returns
266     * the first repetition of 
267     * DB12 (DB1 - Disability segment) - creates it if necessary
268     */
269    public DB1 getDB12() { 
270       return getTyped("DB12", DB1.class);
271    }
272
273
274    /**
275     * Returns a specific repetition of
276     * DB12 (DB1 - Disability segment) - 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 DB1 getDB12(int rep) { 
283       return getTyped("DB12", rep, DB1.class);
284    }
285
286    /** 
287     * Returns the number of existing repetitions of DB12 
288     */ 
289    public int getDB12Reps() { 
290        return getReps("DB12");
291    } 
292
293    /** 
294     * <p>
295     * Returns a non-modifiable List containing all current existing repetitions of DB12.
296     * <p>
297     * <p>
298     * Note that unlike {@link #getDB12()}, 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<DB1> getDB12All() throws HL7Exception {
303        return getAllAsList("DB12", DB1.class);
304    } 
305
306    /**
307     * Inserts a specific repetition of DB12 (DB1 - Disability segment)
308     * @see AbstractGroup#insertRepetition(Structure, int) 
309     */
310    public void insertDB12(DB1 structure, int rep) throws HL7Exception { 
311       super.insertRepetition( "DB12", structure, rep);
312    }
313
314
315    /**
316     * Inserts a specific repetition of DB12 (DB1 - Disability segment)
317     * @see AbstractGroup#insertRepetition(Structure, int) 
318     */
319    public DB1 insertDB12(int rep) throws HL7Exception { 
320       return (DB1)super.insertRepetition("DB12", rep);
321    }
322
323
324    /**
325     * Removes a specific repetition of DB12 (DB1 - Disability segment)
326     * @see AbstractGroup#removeRepetition(String, int) 
327     */
328    public DB1 removeDB12(int rep) throws HL7Exception { 
329       return (DB1)super.removeRepetition("DB12", rep);
330    }
331
332
333
334}
335