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
008 package ca.uhn.hl7v2.model.v24.message;
009
010 import ca.uhn.hl7v2.model.v24.group.*;
011 import ca.uhn.hl7v2.model.v24.segment.*;
012
013 import ca.uhn.log.HapiLogFactory;
014 import ca.uhn.hl7v2.HL7Exception;
015 import ca.uhn.hl7v2.parser.ModelClassFactory;
016 import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
017 import ca.uhn.hl7v2.model.AbstractMessage;
018
019 /**
020 * <p>Represents a RQC_I05 message structure (see chapter 11). This structure contains the
021 * following elements: </p>
022 * <ul>
023 * <li>1: MSH (Message Header) <b> </b></li>
024 * <li>2: QRD (Original-Style Query Definition) <b> </b></li>
025 * <li>3: QRF (Original Style Query Filter) <b>optional </b></li>
026 * <li>4: RQC_I05_PROVIDER (a Group object) <b> repeating</b></li>
027 * <li>5: PID (Patient identification) <b> </b></li>
028 * <li>6: NK1 (Next of kin / associated parties) <b>optional repeating</b></li>
029 * <li>7: GT1 (Guarantor) <b>optional repeating</b></li>
030 * <li>8: NTE (Notes and Comments) <b>optional repeating</b></li>
031 * </ul>
032 */
033 public class RQC_I05 extends AbstractMessage {
034
035 /**
036 * Creates a new RQC_I05 message with DefaultModelClassFactory.
037 */
038 public RQC_I05() {
039 this(new DefaultModelClassFactory());
040 }
041
042 /**
043 * Creates a new RQC_I05 message with custom ModelClassFactory.
044 */
045 public RQC_I05(ModelClassFactory factory) {
046 super(factory);
047 init(factory);
048 }
049
050 private void init(ModelClassFactory factory) {
051 try {
052 this.add(MSH.class, true, false);
053 this.add(QRD.class, true, false);
054 this.add(QRF.class, false, false);
055 this.add(RQC_I05_PROVIDER.class, true, true);
056 this.add(PID.class, true, false);
057 this.add(NK1.class, false, true);
058 this.add(GT1.class, false, true);
059 this.add(NTE.class, false, true);
060 } catch(HL7Exception e) {
061 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating RQC_I05 - this is probably a bug in the source code generator.", e);
062 }
063 }
064
065 /**
066 * Returns "2.4"
067 */
068 public String getVersion() {
069 return "2.4";
070 }
071
072
073
074 /**
075 * Returns
076 * MSH (Message Header) - creates it if necessary
077 */
078 public MSH getMSH() {
079 MSH ret = null;
080 try {
081 ret = (MSH)this.get("MSH");
082 } catch(HL7Exception e) {
083 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
084 throw new RuntimeException(e);
085 }
086 return ret;
087 }
088
089
090
091
092 /**
093 * Returns
094 * QRD (Original-Style Query Definition) - creates it if necessary
095 */
096 public QRD getQRD() {
097 QRD ret = null;
098 try {
099 ret = (QRD)this.get("QRD");
100 } catch(HL7Exception e) {
101 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
102 throw new RuntimeException(e);
103 }
104 return ret;
105 }
106
107
108
109
110 /**
111 * Returns
112 * QRF (Original Style Query Filter) - creates it if necessary
113 */
114 public QRF getQRF() {
115 QRF ret = null;
116 try {
117 ret = (QRF)this.get("QRF");
118 } catch(HL7Exception e) {
119 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
120 throw new RuntimeException(e);
121 }
122 return ret;
123 }
124
125
126
127
128 /**
129 * Returns
130 * the first repetition of
131 * PROVIDER (a Group object) - creates it if necessary
132 */
133 public RQC_I05_PROVIDER getPROVIDER() {
134 RQC_I05_PROVIDER ret = null;
135 try {
136 ret = (RQC_I05_PROVIDER)this.get("PROVIDER");
137 } catch(HL7Exception e) {
138 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
139 throw new RuntimeException(e);
140 }
141 return ret;
142 }
143
144
145 /**
146 * Returns a specific repetition of
147 * PROVIDER (a Group object) - creates it if necessary
148 *
149 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
150 * @throws HL7Exception if the repetition requested is more than one
151 * greater than the number of existing repetitions.
152 */
153 public RQC_I05_PROVIDER getPROVIDER(int rep) {
154 RQC_I05_PROVIDER ret = null;
155 try {
156 ret = (RQC_I05_PROVIDER)this.get("PROVIDER", rep);
157 } catch(HL7Exception e) {
158 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
159 throw new RuntimeException(e);
160 }
161 return ret;
162 }
163
164 /**
165 * Returns the number of existing repetitions of PROVIDER
166 */
167 public int getPROVIDERReps() {
168 int reps = -1;
169 try {
170 reps = this.getAll("PROVIDER").length;
171 } catch (HL7Exception e) {
172 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
173 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
174 throw new RuntimeException(message);
175 }
176 return reps;
177 }
178
179 /**
180 * Inserts a specific repetition of PROVIDER (a Group object)
181 * @see AbstractGroup\#insertRepetition(Structure, int)
182 */
183 public void insertPROVIDER(RQC_I05_PROVIDER structure, int rep) throws HL7Exception {
184 super.insertRepetition( "PROVIDER", structure, rep);
185 }
186
187
188 /**
189 * Inserts a specific repetition of PROVIDER (a Group object)
190 * @see AbstractGroup\#insertRepetition(Structure, int)
191 */
192 public RQC_I05_PROVIDER insertPROVIDER(int rep) throws HL7Exception {
193 return (RQC_I05_PROVIDER)super.insertRepetition("PROVIDER", rep);
194 }
195
196
197 /**
198 * Removes a specific repetition of PROVIDER (a Group object)
199 * @see AbstractGroup\#removeRepetition(String, int)
200 */
201 public RQC_I05_PROVIDER removePROVIDER(int rep) throws HL7Exception {
202 return (RQC_I05_PROVIDER)super.removeRepetition("PROVIDER", rep);
203 }
204
205
206
207 /**
208 * Returns
209 * PID (Patient identification) - creates it if necessary
210 */
211 public PID getPID() {
212 PID ret = null;
213 try {
214 ret = (PID)this.get("PID");
215 } catch(HL7Exception e) {
216 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
217 throw new RuntimeException(e);
218 }
219 return ret;
220 }
221
222
223
224
225 /**
226 * Returns
227 * the first repetition of
228 * NK1 (Next of kin / associated parties) - creates it if necessary
229 */
230 public NK1 getNK1() {
231 NK1 ret = null;
232 try {
233 ret = (NK1)this.get("NK1");
234 } catch(HL7Exception e) {
235 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
236 throw new RuntimeException(e);
237 }
238 return ret;
239 }
240
241
242 /**
243 * Returns a specific repetition of
244 * NK1 (Next of kin / associated parties) - creates it if necessary
245 *
246 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
247 * @throws HL7Exception if the repetition requested is more than one
248 * greater than the number of existing repetitions.
249 */
250 public NK1 getNK1(int rep) {
251 NK1 ret = null;
252 try {
253 ret = (NK1)this.get("NK1", rep);
254 } catch(HL7Exception e) {
255 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
256 throw new RuntimeException(e);
257 }
258 return ret;
259 }
260
261 /**
262 * Returns the number of existing repetitions of NK1
263 */
264 public int getNK1Reps() {
265 int reps = -1;
266 try {
267 reps = this.getAll("NK1").length;
268 } catch (HL7Exception e) {
269 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
270 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
271 throw new RuntimeException(message);
272 }
273 return reps;
274 }
275
276 /**
277 * Inserts a specific repetition of NK1 (Next of kin / associated parties)
278 * @see AbstractGroup\#insertRepetition(Structure, int)
279 */
280 public void insertNK1(NK1 structure, int rep) throws HL7Exception {
281 super.insertRepetition( "NK1", structure, rep);
282 }
283
284
285 /**
286 * Inserts a specific repetition of NK1 (Next of kin / associated parties)
287 * @see AbstractGroup\#insertRepetition(Structure, int)
288 */
289 public NK1 insertNK1(int rep) throws HL7Exception {
290 return (NK1)super.insertRepetition("NK1", rep);
291 }
292
293
294 /**
295 * Removes a specific repetition of NK1 (Next of kin / associated parties)
296 * @see AbstractGroup\#removeRepetition(String, int)
297 */
298 public NK1 removeNK1(int rep) throws HL7Exception {
299 return (NK1)super.removeRepetition("NK1", rep);
300 }
301
302
303
304 /**
305 * Returns
306 * the first repetition of
307 * GT1 (Guarantor) - creates it if necessary
308 */
309 public GT1 getGT1() {
310 GT1 ret = null;
311 try {
312 ret = (GT1)this.get("GT1");
313 } catch(HL7Exception e) {
314 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
315 throw new RuntimeException(e);
316 }
317 return ret;
318 }
319
320
321 /**
322 * Returns a specific repetition of
323 * GT1 (Guarantor) - creates it if necessary
324 *
325 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
326 * @throws HL7Exception if the repetition requested is more than one
327 * greater than the number of existing repetitions.
328 */
329 public GT1 getGT1(int rep) {
330 GT1 ret = null;
331 try {
332 ret = (GT1)this.get("GT1", rep);
333 } catch(HL7Exception e) {
334 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
335 throw new RuntimeException(e);
336 }
337 return ret;
338 }
339
340 /**
341 * Returns the number of existing repetitions of GT1
342 */
343 public int getGT1Reps() {
344 int reps = -1;
345 try {
346 reps = this.getAll("GT1").length;
347 } catch (HL7Exception e) {
348 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
349 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
350 throw new RuntimeException(message);
351 }
352 return reps;
353 }
354
355 /**
356 * Inserts a specific repetition of GT1 (Guarantor)
357 * @see AbstractGroup\#insertRepetition(Structure, int)
358 */
359 public void insertGT1(GT1 structure, int rep) throws HL7Exception {
360 super.insertRepetition( "GT1", structure, rep);
361 }
362
363
364 /**
365 * Inserts a specific repetition of GT1 (Guarantor)
366 * @see AbstractGroup\#insertRepetition(Structure, int)
367 */
368 public GT1 insertGT1(int rep) throws HL7Exception {
369 return (GT1)super.insertRepetition("GT1", rep);
370 }
371
372
373 /**
374 * Removes a specific repetition of GT1 (Guarantor)
375 * @see AbstractGroup\#removeRepetition(String, int)
376 */
377 public GT1 removeGT1(int rep) throws HL7Exception {
378 return (GT1)super.removeRepetition("GT1", rep);
379 }
380
381
382
383 /**
384 * Returns
385 * the first repetition of
386 * NTE (Notes and Comments) - creates it if necessary
387 */
388 public NTE getNTE() {
389 NTE ret = null;
390 try {
391 ret = (NTE)this.get("NTE");
392 } catch(HL7Exception e) {
393 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
394 throw new RuntimeException(e);
395 }
396 return ret;
397 }
398
399
400 /**
401 * Returns a specific repetition of
402 * NTE (Notes and Comments) - creates it if necessary
403 *
404 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
405 * @throws HL7Exception if the repetition requested is more than one
406 * greater than the number of existing repetitions.
407 */
408 public NTE getNTE(int rep) {
409 NTE ret = null;
410 try {
411 ret = (NTE)this.get("NTE", rep);
412 } catch(HL7Exception e) {
413 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
414 throw new RuntimeException(e);
415 }
416 return ret;
417 }
418
419 /**
420 * Returns the number of existing repetitions of NTE
421 */
422 public int getNTEReps() {
423 int reps = -1;
424 try {
425 reps = this.getAll("NTE").length;
426 } catch (HL7Exception e) {
427 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
428 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
429 throw new RuntimeException(message);
430 }
431 return reps;
432 }
433
434 /**
435 * Inserts a specific repetition of NTE (Notes and Comments)
436 * @see AbstractGroup\#insertRepetition(Structure, int)
437 */
438 public void insertNTE(NTE structure, int rep) throws HL7Exception {
439 super.insertRepetition( "NTE", structure, rep);
440 }
441
442
443 /**
444 * Inserts a specific repetition of NTE (Notes and Comments)
445 * @see AbstractGroup\#insertRepetition(Structure, int)
446 */
447 public NTE insertNTE(int rep) throws HL7Exception {
448 return (NTE)super.insertRepetition("NTE", rep);
449 }
450
451
452 /**
453 * Removes a specific repetition of NTE (Notes and Comments)
454 * @see AbstractGroup\#removeRepetition(String, int)
455 */
456 public NTE removeNTE(int rep) throws HL7Exception {
457 return (NTE)super.removeRepetition("NTE", rep);
458 }
459
460
461
462 }
463