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