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 RSP_Z88 message structure (see chapter 5). 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: ERR (Error) <b>optional </b></li>
026 * <li>4: QAK (Query Acknowledgment) <b> </b></li>
027 * <li>5: QPD (Query Parameter Definition) <b> </b></li>
028 * <li>6: RCP (Response Control Parameter) <b> </b></li>
029 * <li>7: RSP_Z88_QUERY_RESPONSE (a Group object) <b>optional repeating</b></li>
030 * <li>8: DSC (Continuation Pointer) <b> </b></li>
031 * </ul>
032 */
033 public class RSP_Z88 extends AbstractMessage {
034
035 /**
036 * Creates a new RSP_Z88 message with DefaultModelClassFactory.
037 */
038 public RSP_Z88() {
039 this(new DefaultModelClassFactory());
040 }
041
042 /**
043 * Creates a new RSP_Z88 message with custom ModelClassFactory.
044 */
045 public RSP_Z88(ModelClassFactory factory) {
046 super(factory);
047 init(factory);
048 }
049
050 private void init(ModelClassFactory factory) {
051 try {
052 this.add(MSH.class, true, false);
053 this.add(MSA.class, true, false);
054 this.add(ERR.class, false, false);
055 this.add(QAK.class, true, false);
056 this.add(QPD.class, true, false);
057 this.add(RCP.class, true, false);
058 this.add(RSP_Z88_QUERY_RESPONSE.class, false, true);
059 this.add(DSC.class, true, false);
060 } catch(HL7Exception e) {
061 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating RSP_Z88 - this is probably a bug in the source code generator.", e);
062 }
063 }
064
065 /**
066 * Returns "2.4"
067 */
068 public String getVersion() {
069 return "2.4";
070 }
071
072
073
074 /**
075 * Returns
076 * MSH (Message Header) - creates it if necessary
077 */
078 public MSH getMSH() {
079 MSH ret = null;
080 try {
081 ret = (MSH)this.get("MSH");
082 } catch(HL7Exception e) {
083 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
084 throw new RuntimeException(e);
085 }
086 return ret;
087 }
088
089
090
091
092 /**
093 * Returns
094 * MSA (Message Acknowledgment) - creates it if necessary
095 */
096 public MSA getMSA() {
097 MSA ret = null;
098 try {
099 ret = (MSA)this.get("MSA");
100 } catch(HL7Exception e) {
101 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
102 throw new RuntimeException(e);
103 }
104 return ret;
105 }
106
107
108
109
110 /**
111 * Returns
112 * ERR (Error) - creates it if necessary
113 */
114 public ERR getERR() {
115 ERR ret = null;
116 try {
117 ret = (ERR)this.get("ERR");
118 } catch(HL7Exception e) {
119 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
120 throw new RuntimeException(e);
121 }
122 return ret;
123 }
124
125
126
127
128 /**
129 * Returns
130 * QAK (Query Acknowledgment) - creates it if necessary
131 */
132 public QAK getQAK() {
133 QAK ret = null;
134 try {
135 ret = (QAK)this.get("QAK");
136 } catch(HL7Exception e) {
137 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
138 throw new RuntimeException(e);
139 }
140 return ret;
141 }
142
143
144
145
146 /**
147 * Returns
148 * QPD (Query Parameter Definition) - creates it if necessary
149 */
150 public QPD getQPD() {
151 QPD ret = null;
152 try {
153 ret = (QPD)this.get("QPD");
154 } catch(HL7Exception e) {
155 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
156 throw new RuntimeException(e);
157 }
158 return ret;
159 }
160
161
162
163
164 /**
165 * Returns
166 * RCP (Response Control Parameter) - creates it if necessary
167 */
168 public RCP getRCP() {
169 RCP ret = null;
170 try {
171 ret = (RCP)this.get("RCP");
172 } catch(HL7Exception e) {
173 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
174 throw new RuntimeException(e);
175 }
176 return ret;
177 }
178
179
180
181
182 /**
183 * Returns
184 * the first repetition of
185 * QUERY_RESPONSE (a Group object) - creates it if necessary
186 */
187 public RSP_Z88_QUERY_RESPONSE getQUERY_RESPONSE() {
188 RSP_Z88_QUERY_RESPONSE ret = null;
189 try {
190 ret = (RSP_Z88_QUERY_RESPONSE)this.get("QUERY_RESPONSE");
191 } catch(HL7Exception e) {
192 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
193 throw new RuntimeException(e);
194 }
195 return ret;
196 }
197
198
199 /**
200 * Returns a specific repetition of
201 * QUERY_RESPONSE (a Group object) - creates it if necessary
202 *
203 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
204 * @throws HL7Exception if the repetition requested is more than one
205 * greater than the number of existing repetitions.
206 */
207 public RSP_Z88_QUERY_RESPONSE getQUERY_RESPONSE(int rep) {
208 RSP_Z88_QUERY_RESPONSE ret = null;
209 try {
210 ret = (RSP_Z88_QUERY_RESPONSE)this.get("QUERY_RESPONSE", rep);
211 } catch(HL7Exception e) {
212 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
213 throw new RuntimeException(e);
214 }
215 return ret;
216 }
217
218 /**
219 * Returns the number of existing repetitions of QUERY_RESPONSE
220 */
221 public int getQUERY_RESPONSEReps() {
222 int reps = -1;
223 try {
224 reps = this.getAll("QUERY_RESPONSE").length;
225 } catch (HL7Exception e) {
226 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
227 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
228 throw new RuntimeException(message);
229 }
230 return reps;
231 }
232
233 /**
234 * Inserts a specific repetition of QUERY_RESPONSE (a Group object)
235 * @see AbstractGroup\#insertRepetition(Structure, int)
236 */
237 public void insertQUERY_RESPONSE(RSP_Z88_QUERY_RESPONSE structure, int rep) throws HL7Exception {
238 super.insertRepetition( "QUERY_RESPONSE", structure, rep);
239 }
240
241
242 /**
243 * Inserts a specific repetition of QUERY_RESPONSE (a Group object)
244 * @see AbstractGroup\#insertRepetition(Structure, int)
245 */
246 public RSP_Z88_QUERY_RESPONSE insertQUERY_RESPONSE(int rep) throws HL7Exception {
247 return (RSP_Z88_QUERY_RESPONSE)super.insertRepetition("QUERY_RESPONSE", rep);
248 }
249
250
251 /**
252 * Removes a specific repetition of QUERY_RESPONSE (a Group object)
253 * @see AbstractGroup\#removeRepetition(String, int)
254 */
255 public RSP_Z88_QUERY_RESPONSE removeQUERY_RESPONSE(int rep) throws HL7Exception {
256 return (RSP_Z88_QUERY_RESPONSE)super.removeRepetition("QUERY_RESPONSE", rep);
257 }
258
259
260
261 /**
262 * Returns
263 * DSC (Continuation Pointer) - creates it if necessary
264 */
265 public DSC getDSC() {
266 DSC ret = null;
267 try {
268 ret = (DSC)this.get("DSC");
269 } catch(HL7Exception e) {
270 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
271 throw new RuntimeException(e);
272 }
273 return ret;
274 }
275
276
277
278
279 }
280