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 RPL_I02 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: MSA (Message Acknowledgment) <b> </b></li>
025 * <li>3: RPL_I02_PROVIDER (a Group object) <b> repeating</b></li>
026 * <li>4: NTE (Notes and Comments) <b>optional repeating</b></li>
027 * <li>5: DSP (Display Data) <b>optional repeating</b></li>
028 * <li>6: DSC (Continuation Pointer) <b>optional </b></li>
029 * </ul>
030 */
031 public class RPL_I02 extends AbstractMessage {
032
033 /**
034 * Creates a new RPL_I02 message with DefaultModelClassFactory.
035 */
036 public RPL_I02() {
037 this(new DefaultModelClassFactory());
038 }
039
040 /**
041 * Creates a new RPL_I02 message with custom ModelClassFactory.
042 */
043 public RPL_I02(ModelClassFactory factory) {
044 super(factory);
045 init(factory);
046 }
047
048 private void init(ModelClassFactory factory) {
049 try {
050 this.add(MSH.class, true, false);
051 this.add(MSA.class, true, false);
052 this.add(RPL_I02_PROVIDER.class, true, true);
053 this.add(NTE.class, false, true);
054 this.add(DSP.class, false, true);
055 this.add(DSC.class, false, false);
056 } catch(HL7Exception e) {
057 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating RPL_I02 - this is probably a bug in the source code generator.", e);
058 }
059 }
060
061 /**
062 * Returns "2.4"
063 */
064 public String getVersion() {
065 return "2.4";
066 }
067
068
069
070 /**
071 * Returns
072 * MSH (Message Header) - creates it if necessary
073 */
074 public MSH getMSH() {
075 MSH ret = null;
076 try {
077 ret = (MSH)this.get("MSH");
078 } catch(HL7Exception e) {
079 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
080 throw new RuntimeException(e);
081 }
082 return ret;
083 }
084
085
086
087
088 /**
089 * Returns
090 * MSA (Message Acknowledgment) - creates it if necessary
091 */
092 public MSA getMSA() {
093 MSA ret = null;
094 try {
095 ret = (MSA)this.get("MSA");
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
106 /**
107 * Returns
108 * the first repetition of
109 * PROVIDER (a Group object) - creates it if necessary
110 */
111 public RPL_I02_PROVIDER getPROVIDER() {
112 RPL_I02_PROVIDER ret = null;
113 try {
114 ret = (RPL_I02_PROVIDER)this.get("PROVIDER");
115 } catch(HL7Exception e) {
116 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
117 throw new RuntimeException(e);
118 }
119 return ret;
120 }
121
122
123 /**
124 * Returns a specific repetition of
125 * PROVIDER (a Group object) - creates it if necessary
126 *
127 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
128 * @throws HL7Exception if the repetition requested is more than one
129 * greater than the number of existing repetitions.
130 */
131 public RPL_I02_PROVIDER getPROVIDER(int rep) {
132 RPL_I02_PROVIDER ret = null;
133 try {
134 ret = (RPL_I02_PROVIDER)this.get("PROVIDER", rep);
135 } catch(HL7Exception e) {
136 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
137 throw new RuntimeException(e);
138 }
139 return ret;
140 }
141
142 /**
143 * Returns the number of existing repetitions of PROVIDER
144 */
145 public int getPROVIDERReps() {
146 int reps = -1;
147 try {
148 reps = this.getAll("PROVIDER").length;
149 } catch (HL7Exception e) {
150 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
151 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
152 throw new RuntimeException(message);
153 }
154 return reps;
155 }
156
157 /**
158 * Inserts a specific repetition of PROVIDER (a Group object)
159 * @see AbstractGroup\#insertRepetition(Structure, int)
160 */
161 public void insertPROVIDER(RPL_I02_PROVIDER structure, int rep) throws HL7Exception {
162 super.insertRepetition( "PROVIDER", structure, rep);
163 }
164
165
166 /**
167 * Inserts a specific repetition of PROVIDER (a Group object)
168 * @see AbstractGroup\#insertRepetition(Structure, int)
169 */
170 public RPL_I02_PROVIDER insertPROVIDER(int rep) throws HL7Exception {
171 return (RPL_I02_PROVIDER)super.insertRepetition("PROVIDER", rep);
172 }
173
174
175 /**
176 * Removes a specific repetition of PROVIDER (a Group object)
177 * @see AbstractGroup\#removeRepetition(String, int)
178 */
179 public RPL_I02_PROVIDER removePROVIDER(int rep) throws HL7Exception {
180 return (RPL_I02_PROVIDER)super.removeRepetition("PROVIDER", rep);
181 }
182
183
184
185 /**
186 * Returns
187 * the first repetition of
188 * NTE (Notes and Comments) - creates it if necessary
189 */
190 public NTE getNTE() {
191 NTE ret = null;
192 try {
193 ret = (NTE)this.get("NTE");
194 } catch(HL7Exception e) {
195 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
196 throw new RuntimeException(e);
197 }
198 return ret;
199 }
200
201
202 /**
203 * Returns a specific repetition of
204 * NTE (Notes and Comments) - creates it if necessary
205 *
206 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
207 * @throws HL7Exception if the repetition requested is more than one
208 * greater than the number of existing repetitions.
209 */
210 public NTE getNTE(int rep) {
211 NTE ret = null;
212 try {
213 ret = (NTE)this.get("NTE", rep);
214 } catch(HL7Exception e) {
215 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
216 throw new RuntimeException(e);
217 }
218 return ret;
219 }
220
221 /**
222 * Returns the number of existing repetitions of NTE
223 */
224 public int getNTEReps() {
225 int reps = -1;
226 try {
227 reps = this.getAll("NTE").length;
228 } catch (HL7Exception e) {
229 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
230 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
231 throw new RuntimeException(message);
232 }
233 return reps;
234 }
235
236 /**
237 * Inserts a specific repetition of NTE (Notes and Comments)
238 * @see AbstractGroup\#insertRepetition(Structure, int)
239 */
240 public void insertNTE(NTE structure, int rep) throws HL7Exception {
241 super.insertRepetition( "NTE", structure, rep);
242 }
243
244
245 /**
246 * Inserts a specific repetition of NTE (Notes and Comments)
247 * @see AbstractGroup\#insertRepetition(Structure, int)
248 */
249 public NTE insertNTE(int rep) throws HL7Exception {
250 return (NTE)super.insertRepetition("NTE", rep);
251 }
252
253
254 /**
255 * Removes a specific repetition of NTE (Notes and Comments)
256 * @see AbstractGroup\#removeRepetition(String, int)
257 */
258 public NTE removeNTE(int rep) throws HL7Exception {
259 return (NTE)super.removeRepetition("NTE", rep);
260 }
261
262
263
264 /**
265 * Returns
266 * the first repetition of
267 * DSP (Display Data) - creates it if necessary
268 */
269 public DSP getDSP() {
270 DSP ret = null;
271 try {
272 ret = (DSP)this.get("DSP");
273 } catch(HL7Exception e) {
274 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
275 throw new RuntimeException(e);
276 }
277 return ret;
278 }
279
280
281 /**
282 * Returns a specific repetition of
283 * DSP (Display Data) - creates it if necessary
284 *
285 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
286 * @throws HL7Exception if the repetition requested is more than one
287 * greater than the number of existing repetitions.
288 */
289 public DSP getDSP(int rep) {
290 DSP ret = null;
291 try {
292 ret = (DSP)this.get("DSP", rep);
293 } catch(HL7Exception e) {
294 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
295 throw new RuntimeException(e);
296 }
297 return ret;
298 }
299
300 /**
301 * Returns the number of existing repetitions of DSP
302 */
303 public int getDSPReps() {
304 int reps = -1;
305 try {
306 reps = this.getAll("DSP").length;
307 } catch (HL7Exception e) {
308 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
309 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
310 throw new RuntimeException(message);
311 }
312 return reps;
313 }
314
315 /**
316 * Inserts a specific repetition of DSP (Display Data)
317 * @see AbstractGroup\#insertRepetition(Structure, int)
318 */
319 public void insertDSP(DSP structure, int rep) throws HL7Exception {
320 super.insertRepetition( "DSP", structure, rep);
321 }
322
323
324 /**
325 * Inserts a specific repetition of DSP (Display Data)
326 * @see AbstractGroup\#insertRepetition(Structure, int)
327 */
328 public DSP insertDSP(int rep) throws HL7Exception {
329 return (DSP)super.insertRepetition("DSP", rep);
330 }
331
332
333 /**
334 * Removes a specific repetition of DSP (Display Data)
335 * @see AbstractGroup\#removeRepetition(String, int)
336 */
337 public DSP removeDSP(int rep) throws HL7Exception {
338 return (DSP)super.removeRepetition("DSP", rep);
339 }
340
341
342
343 /**
344 * Returns
345 * DSC (Continuation Pointer) - creates it if necessary
346 */
347 public DSC getDSC() {
348 DSC ret = null;
349 try {
350 ret = (DSC)this.get("DSC");
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
361 }
362