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 RSP_Z88_COMMON_ORDER 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: ORC (Common Order) <b> </b></li>
028 * <li>2: RSP_Z88_ORDER_DETAIL (a Group object) <b>optional </b></li>
029 * <li>3: RSP_Z88_ORDER_ENCODED (a Group object) <b>optional </b></li>
030 * <li>4: RXD (Pharmacy/Treatment Dispense) <b> </b></li>
031 * <li>5: RXR (Pharmacy/Treatment Route) <b> repeating</b></li>
032 * <li>6: RXC (Pharmacy/Treatment Component Order) <b>optional repeating</b></li>
033 * <li>7: RSP_Z88_OBSERVATION (a Group object) <b> repeating</b></li>
034 * </ul>
035 */
036 public class RSP_Z88_COMMON_ORDER extends AbstractGroup {
037
038 /**
039 * Creates a new RSP_Z88_COMMON_ORDER group
040 */
041 public RSP_Z88_COMMON_ORDER(Group parent, ModelClassFactory factory) {
042 super(parent, factory);
043 init(factory);
044 }
045
046 private void init(ModelClassFactory factory) {
047 try {
048 this.add(ORC.class, true, false);
049 this.add(RSP_Z88_ORDER_DETAIL.class, false, false);
050 this.add(RSP_Z88_ORDER_ENCODED.class, false, false);
051 this.add(RXD.class, true, false);
052 this.add(RXR.class, true, true);
053 this.add(RXC.class, false, true);
054 this.add(RSP_Z88_OBSERVATION.class, true, true);
055 } catch(HL7Exception e) {
056 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating RSP_Z88_COMMON_ORDER - 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 * ORC (Common Order) - creates it if necessary
072 */
073 public ORC getORC() {
074 ORC ret = null;
075 try {
076 ret = (ORC)this.get("ORC");
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 * ORDER_DETAIL (a Group object) - creates it if necessary
090 */
091 public RSP_Z88_ORDER_DETAIL getORDER_DETAIL() {
092 RSP_Z88_ORDER_DETAIL ret = null;
093 try {
094 ret = (RSP_Z88_ORDER_DETAIL)this.get("ORDER_DETAIL");
095 } catch(HL7Exception e) {
096 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
097 throw new RuntimeException(e);
098 }
099 return ret;
100 }
101
102
103
104
105 /**
106 * Returns
107 * ORDER_ENCODED (a Group object) - creates it if necessary
108 */
109 public RSP_Z88_ORDER_ENCODED getORDER_ENCODED() {
110 RSP_Z88_ORDER_ENCODED ret = null;
111 try {
112 ret = (RSP_Z88_ORDER_ENCODED)this.get("ORDER_ENCODED");
113 } catch(HL7Exception e) {
114 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
115 throw new RuntimeException(e);
116 }
117 return ret;
118 }
119
120
121
122
123 /**
124 * Returns
125 * RXD (Pharmacy/Treatment Dispense) - creates it if necessary
126 */
127 public RXD getRXD() {
128 RXD ret = null;
129 try {
130 ret = (RXD)this.get("RXD");
131 } catch(HL7Exception e) {
132 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
133 throw new RuntimeException(e);
134 }
135 return ret;
136 }
137
138
139
140
141 /**
142 * Returns
143 * the first repetition of
144 * RXR (Pharmacy/Treatment Route) - creates it if necessary
145 */
146 public RXR getRXR() {
147 RXR ret = null;
148 try {
149 ret = (RXR)this.get("RXR");
150 } catch(HL7Exception e) {
151 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
152 throw new RuntimeException(e);
153 }
154 return ret;
155 }
156
157
158 /**
159 * Returns a specific repetition of
160 * RXR (Pharmacy/Treatment Route) - creates it if necessary
161 *
162 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
163 * @throws HL7Exception if the repetition requested is more than one
164 * greater than the number of existing repetitions.
165 */
166 public RXR getRXR(int rep) {
167 RXR ret = null;
168 try {
169 ret = (RXR)this.get("RXR", rep);
170 } catch(HL7Exception e) {
171 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
172 throw new RuntimeException(e);
173 }
174 return ret;
175 }
176
177 /**
178 * Returns the number of existing repetitions of RXR
179 */
180 public int getRXRReps() {
181 int reps = -1;
182 try {
183 reps = this.getAll("RXR").length;
184 } catch (HL7Exception e) {
185 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
186 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
187 throw new RuntimeException(message);
188 }
189 return reps;
190 }
191
192 /**
193 * Inserts a specific repetition of RXR (Pharmacy/Treatment Route)
194 * @see AbstractGroup#insertRepetition(Structure, int)
195 */
196 public void insertRXR(RXR structure, int rep) throws HL7Exception {
197 super.insertRepetition("RXR", structure, rep);
198 }
199
200
201 /**
202 * Inserts a specific repetition of RXR (Pharmacy/Treatment Route)
203 * @see AbstractGroup#insertRepetition(Structure, int)
204 */
205 public RXR insertRXR(int rep) throws HL7Exception {
206 return (RXR)super.insertRepetition("RXR", rep);
207 }
208
209
210 /**
211 * Removes a specific repetition of RXR (Pharmacy/Treatment Route)
212 * @see AbstractGroup#removeRepetition(String, int)
213 */
214 public RXR removeRXR(int rep) throws HL7Exception {
215 return (RXR)super.removeRepetition("RXR", rep);
216 }
217
218
219
220 /**
221 * Returns
222 * the first repetition of
223 * RXC (Pharmacy/Treatment Component Order) - creates it if necessary
224 */
225 public RXC getRXC() {
226 RXC ret = null;
227 try {
228 ret = (RXC)this.get("RXC");
229 } catch(HL7Exception e) {
230 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
231 throw new RuntimeException(e);
232 }
233 return ret;
234 }
235
236
237 /**
238 * Returns a specific repetition of
239 * RXC (Pharmacy/Treatment Component Order) - creates it if necessary
240 *
241 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
242 * @throws HL7Exception if the repetition requested is more than one
243 * greater than the number of existing repetitions.
244 */
245 public RXC getRXC(int rep) {
246 RXC ret = null;
247 try {
248 ret = (RXC)this.get("RXC", rep);
249 } catch(HL7Exception e) {
250 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
251 throw new RuntimeException(e);
252 }
253 return ret;
254 }
255
256 /**
257 * Returns the number of existing repetitions of RXC
258 */
259 public int getRXCReps() {
260 int reps = -1;
261 try {
262 reps = this.getAll("RXC").length;
263 } catch (HL7Exception e) {
264 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
265 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
266 throw new RuntimeException(message);
267 }
268 return reps;
269 }
270
271 /**
272 * Inserts a specific repetition of RXC (Pharmacy/Treatment Component Order)
273 * @see AbstractGroup#insertRepetition(Structure, int)
274 */
275 public void insertRXC(RXC structure, int rep) throws HL7Exception {
276 super.insertRepetition("RXC", structure, rep);
277 }
278
279
280 /**
281 * Inserts a specific repetition of RXC (Pharmacy/Treatment Component Order)
282 * @see AbstractGroup#insertRepetition(Structure, int)
283 */
284 public RXC insertRXC(int rep) throws HL7Exception {
285 return (RXC)super.insertRepetition("RXC", rep);
286 }
287
288
289 /**
290 * Removes a specific repetition of RXC (Pharmacy/Treatment Component Order)
291 * @see AbstractGroup#removeRepetition(String, int)
292 */
293 public RXC removeRXC(int rep) throws HL7Exception {
294 return (RXC)super.removeRepetition("RXC", rep);
295 }
296
297
298
299 /**
300 * Returns
301 * the first repetition of
302 * OBSERVATION (a Group object) - creates it if necessary
303 */
304 public RSP_Z88_OBSERVATION getOBSERVATION() {
305 RSP_Z88_OBSERVATION ret = null;
306 try {
307 ret = (RSP_Z88_OBSERVATION)this.get("OBSERVATION");
308 } catch(HL7Exception e) {
309 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
310 throw new RuntimeException(e);
311 }
312 return ret;
313 }
314
315
316 /**
317 * Returns a specific repetition of
318 * OBSERVATION (a Group object) - creates it if necessary
319 *
320 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
321 * @throws HL7Exception if the repetition requested is more than one
322 * greater than the number of existing repetitions.
323 */
324 public RSP_Z88_OBSERVATION getOBSERVATION(int rep) {
325 RSP_Z88_OBSERVATION ret = null;
326 try {
327 ret = (RSP_Z88_OBSERVATION)this.get("OBSERVATION", rep);
328 } catch(HL7Exception e) {
329 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
330 throw new RuntimeException(e);
331 }
332 return ret;
333 }
334
335 /**
336 * Returns the number of existing repetitions of OBSERVATION
337 */
338 public int getOBSERVATIONReps() {
339 int reps = -1;
340 try {
341 reps = this.getAll("OBSERVATION").length;
342 } catch (HL7Exception e) {
343 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
344 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
345 throw new RuntimeException(message);
346 }
347 return reps;
348 }
349
350 /**
351 * Inserts a specific repetition of OBSERVATION (a Group object)
352 * @see AbstractGroup#insertRepetition(Structure, int)
353 */
354 public void insertOBSERVATION(RSP_Z88_OBSERVATION structure, int rep) throws HL7Exception {
355 super.insertRepetition("OBSERVATION", structure, rep);
356 }
357
358
359 /**
360 * Inserts a specific repetition of OBSERVATION (a Group object)
361 * @see AbstractGroup#insertRepetition(Structure, int)
362 */
363 public RSP_Z88_OBSERVATION insertOBSERVATION(int rep) throws HL7Exception {
364 return (RSP_Z88_OBSERVATION)super.insertRepetition("OBSERVATION", rep);
365 }
366
367
368 /**
369 * Removes a specific repetition of OBSERVATION (a Group object)
370 * @see AbstractGroup#removeRepetition(String, int)
371 */
372 public RSP_Z88_OBSERVATION removeOBSERVATION(int rep) throws HL7Exception {
373 return (RSP_Z88_OBSERVATION)super.removeRepetition("OBSERVATION", rep);
374 }
375
376
377
378 }
379