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