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