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 RAS_O17_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: RAS_O17_ORDER_DETAIL (a Group object) <b>optional </b></li>
029 * <li>3: RAS_O17_ENCODING (a Group object) <b>optional </b></li>
030 * <li>4: RXA (Pharmacy/Treatment Administration) <b> repeating</b></li>
031 * <li>5: RXR (Pharmacy/Treatment Route) <b> </b></li>
032 * <li>6: RAS_O17_OBSERVATION (a Group object) <b>optional repeating</b></li>
033 * <li>7: CTI (Clinical Trial Identification) <b>optional repeating</b></li>
034 * </ul>
035 */
036 public class RAS_O17_ORDER extends AbstractGroup {
037
038 /**
039 * Creates a new RAS_O17_ORDER group
040 */
041 public RAS_O17_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(RAS_O17_ORDER_DETAIL.class, false, false);
050 this.add(RAS_O17_ENCODING.class, false, false);
051 this.add(RXA.class, true, true);
052 this.add(RXR.class, true, false);
053 this.add(RAS_O17_OBSERVATION.class, false, true);
054 this.add(CTI.class, false, true);
055 } catch(HL7Exception e) {
056 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating RAS_O17_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 RAS_O17_ORDER_DETAIL getORDER_DETAIL() {
092 RAS_O17_ORDER_DETAIL ret = null;
093 try {
094 ret = (RAS_O17_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 * ENCODING (a Group object) - creates it if necessary
108 */
109 public RAS_O17_ENCODING getENCODING() {
110 RAS_O17_ENCODING ret = null;
111 try {
112 ret = (RAS_O17_ENCODING)this.get("ENCODING");
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 * the first repetition of
126 * RXA (Pharmacy/Treatment Administration) - creates it if necessary
127 */
128 public RXA getRXA() {
129 RXA ret = null;
130 try {
131 ret = (RXA)this.get("RXA");
132 } catch(HL7Exception e) {
133 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
134 throw new RuntimeException(e);
135 }
136 return ret;
137 }
138
139
140 /**
141 * Returns a specific repetition of
142 * RXA (Pharmacy/Treatment Administration) - creates it if necessary
143 *
144 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
145 * @throws HL7Exception if the repetition requested is more than one
146 * greater than the number of existing repetitions.
147 */
148 public RXA getRXA(int rep) {
149 RXA ret = null;
150 try {
151 ret = (RXA)this.get("RXA", rep);
152 } catch(HL7Exception e) {
153 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
154 throw new RuntimeException(e);
155 }
156 return ret;
157 }
158
159 /**
160 * Returns the number of existing repetitions of RXA
161 */
162 public int getRXAReps() {
163 int reps = -1;
164 try {
165 reps = this.getAll("RXA").length;
166 } catch (HL7Exception e) {
167 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
168 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
169 throw new RuntimeException(message);
170 }
171 return reps;
172 }
173
174 /**
175 * Inserts a specific repetition of RXA (Pharmacy/Treatment Administration)
176 * @see AbstractGroup#insertRepetition(Structure, int)
177 */
178 public void insertRXA(RXA structure, int rep) throws HL7Exception {
179 super.insertRepetition("RXA", structure, rep);
180 }
181
182
183 /**
184 * Inserts a specific repetition of RXA (Pharmacy/Treatment Administration)
185 * @see AbstractGroup#insertRepetition(Structure, int)
186 */
187 public RXA insertRXA(int rep) throws HL7Exception {
188 return (RXA)super.insertRepetition("RXA", rep);
189 }
190
191
192 /**
193 * Removes a specific repetition of RXA (Pharmacy/Treatment Administration)
194 * @see AbstractGroup#removeRepetition(String, int)
195 */
196 public RXA removeRXA(int rep) throws HL7Exception {
197 return (RXA)super.removeRepetition("RXA", rep);
198 }
199
200
201
202 /**
203 * Returns
204 * RXR (Pharmacy/Treatment Route) - creates it if necessary
205 */
206 public RXR getRXR() {
207 RXR ret = null;
208 try {
209 ret = (RXR)this.get("RXR");
210 } catch(HL7Exception e) {
211 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
212 throw new RuntimeException(e);
213 }
214 return ret;
215 }
216
217
218
219
220 /**
221 * Returns
222 * the first repetition of
223 * OBSERVATION (a Group object) - creates it if necessary
224 */
225 public RAS_O17_OBSERVATION getOBSERVATION() {
226 RAS_O17_OBSERVATION ret = null;
227 try {
228 ret = (RAS_O17_OBSERVATION)this.get("OBSERVATION");
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 * OBSERVATION (a Group object) - 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 RAS_O17_OBSERVATION getOBSERVATION(int rep) {
246 RAS_O17_OBSERVATION ret = null;
247 try {
248 ret = (RAS_O17_OBSERVATION)this.get("OBSERVATION", 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 OBSERVATION
258 */
259 public int getOBSERVATIONReps() {
260 int reps = -1;
261 try {
262 reps = this.getAll("OBSERVATION").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 OBSERVATION (a Group object)
273 * @see AbstractGroup#insertRepetition(Structure, int)
274 */
275 public void insertOBSERVATION(RAS_O17_OBSERVATION structure, int rep) throws HL7Exception {
276 super.insertRepetition("OBSERVATION", structure, rep);
277 }
278
279
280 /**
281 * Inserts a specific repetition of OBSERVATION (a Group object)
282 * @see AbstractGroup#insertRepetition(Structure, int)
283 */
284 public RAS_O17_OBSERVATION insertOBSERVATION(int rep) throws HL7Exception {
285 return (RAS_O17_OBSERVATION)super.insertRepetition("OBSERVATION", rep);
286 }
287
288
289 /**
290 * Removes a specific repetition of OBSERVATION (a Group object)
291 * @see AbstractGroup#removeRepetition(String, int)
292 */
293 public RAS_O17_OBSERVATION removeOBSERVATION(int rep) throws HL7Exception {
294 return (RAS_O17_OBSERVATION)super.removeRepetition("OBSERVATION", rep);
295 }
296
297
298
299 /**
300 * Returns
301 * the first repetition of
302 * CTI (Clinical Trial Identification) - creates it if necessary
303 */
304 public CTI getCTI() {
305 CTI ret = null;
306 try {
307 ret = (CTI)this.get("CTI");
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 * CTI (Clinical Trial Identification) - 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 CTI getCTI(int rep) {
325 CTI ret = null;
326 try {
327 ret = (CTI)this.get("CTI", 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 CTI
337 */
338 public int getCTIReps() {
339 int reps = -1;
340 try {
341 reps = this.getAll("CTI").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 CTI (Clinical Trial Identification)
352 * @see AbstractGroup#insertRepetition(Structure, int)
353 */
354 public void insertCTI(CTI structure, int rep) throws HL7Exception {
355 super.insertRepetition("CTI", structure, rep);
356 }
357
358
359 /**
360 * Inserts a specific repetition of CTI (Clinical Trial Identification)
361 * @see AbstractGroup#insertRepetition(Structure, int)
362 */
363 public CTI insertCTI(int rep) throws HL7Exception {
364 return (CTI)super.insertRepetition("CTI", rep);
365 }
366
367
368 /**
369 * Removes a specific repetition of CTI (Clinical Trial Identification)
370 * @see AbstractGroup#removeRepetition(String, int)
371 */
372 public CTI removeCTI(int rep) throws HL7Exception {
373 return (CTI)super.removeRepetition("CTI", rep);
374 }
375
376
377
378 }
379