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