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.segment;
009
010 // import ca.uhn.hl7v2.model.v24.group.*;
011 import ca.uhn.hl7v2.model.v24.datatype.*;
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.Type;
019 import ca.uhn.hl7v2.model.AbstractSegment;
020 import ca.uhn.hl7v2.model.Varies;
021
022 /**
023 *<p>Represents an HL7 QAK message segment (Query Acknowledgment).
024 * This segment has the following fields:</p>
025 * <ul>
026 * <li>QAK-1: Query Tag (ST) <b>optional </b>
027 * <li>QAK-2: Query Response Status (ID) <b>optional </b>
028 * <li>QAK-3: Message Query Name (CE) <b>optional </b>
029 * <li>QAK-4: Hit Count Total (NM) <b>optional </b>
030 * <li>QAK-5: This payload (NM) <b>optional </b>
031 * <li>QAK-6: Hits remaining (NM) <b>optional </b>
032 * </ul>
033 */
034 public class QAK extends AbstractSegment {
035
036 /**
037 * Creates a new QAK segment
038 */
039 public QAK(Group parent, ModelClassFactory factory) {
040 super(parent, factory);
041 init(factory);
042 }
043
044 private void init(ModelClassFactory factory) {
045 try {
046 this.add(ST.class, false, 1, 32, new Object[]{ getMessage(), new Integer(0) }, "Query Tag");
047 this.add(ID.class, false, 1, 2, new Object[]{ getMessage() }, "Query Response Status");
048 this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(471) }, "Message Query Name");
049 this.add(NM.class, false, 1, 10, new Object[]{ getMessage(), new Integer(0) }, "Hit Count Total");
050 this.add(NM.class, false, 1, 10, new Object[]{ getMessage(), new Integer(0) }, "This payload");
051 this.add(NM.class, false, 1, 10, new Object[]{ getMessage(), new Integer(0) }, "Hits remaining");
052 } catch(HL7Exception e) {
053 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating QAK - this is probably a bug in the source code generator.", e);
054 }
055 }
056
057
058
059 /**
060 * Returns
061 * QAK-1: "Query Tag" - creates it if necessary
062 */
063 public ST getQueryTag() {
064 ST ret = null;
065 try {
066 Type t = this.getField(1, 0);
067 ret = (ST)t;
068 } catch (ClassCastException cce) {
069 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
070 throw new RuntimeException(cce);
071 } catch (HL7Exception he) {
072 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
073 throw new RuntimeException(he);
074 }
075 return ret;
076 }
077
078
079 /**
080 * Returns
081 * QAK-1: "Query Tag" - creates it if necessary
082 */
083 public ST getQak1_QueryTag() {
084 ST ret = null;
085 try {
086 Type t = this.getField(1, 0);
087 ret = (ST)t;
088 } catch (ClassCastException cce) {
089 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
090 throw new RuntimeException(cce);
091 } catch (HL7Exception he) {
092 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
093 throw new RuntimeException(he);
094 }
095 return ret;
096 }
097
098
099
100 /**
101 * Returns
102 * QAK-2: "Query Response Status" - creates it if necessary
103 */
104 public ID getQueryResponseStatus() {
105 ID ret = null;
106 try {
107 Type t = this.getField(2, 0);
108 ret = (ID)t;
109 } catch (ClassCastException cce) {
110 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
111 throw new RuntimeException(cce);
112 } catch (HL7Exception he) {
113 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
114 throw new RuntimeException(he);
115 }
116 return ret;
117 }
118
119
120 /**
121 * Returns
122 * QAK-2: "Query Response Status" - creates it if necessary
123 */
124 public ID getQak2_QueryResponseStatus() {
125 ID ret = null;
126 try {
127 Type t = this.getField(2, 0);
128 ret = (ID)t;
129 } catch (ClassCastException cce) {
130 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
131 throw new RuntimeException(cce);
132 } catch (HL7Exception he) {
133 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
134 throw new RuntimeException(he);
135 }
136 return ret;
137 }
138
139
140
141 /**
142 * Returns
143 * QAK-3: "Message Query Name" - creates it if necessary
144 */
145 public CE getMessageQueryName() {
146 CE ret = null;
147 try {
148 Type t = this.getField(3, 0);
149 ret = (CE)t;
150 } catch (ClassCastException cce) {
151 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
152 throw new RuntimeException(cce);
153 } catch (HL7Exception he) {
154 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
155 throw new RuntimeException(he);
156 }
157 return ret;
158 }
159
160
161 /**
162 * Returns
163 * QAK-3: "Message Query Name" - creates it if necessary
164 */
165 public CE getQak3_MessageQueryName() {
166 CE ret = null;
167 try {
168 Type t = this.getField(3, 0);
169 ret = (CE)t;
170 } catch (ClassCastException cce) {
171 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
172 throw new RuntimeException(cce);
173 } catch (HL7Exception he) {
174 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
175 throw new RuntimeException(he);
176 }
177 return ret;
178 }
179
180
181
182 /**
183 * Returns
184 * QAK-4: "Hit Count Total" - creates it if necessary
185 */
186 public NM getHitCountTotal() {
187 NM ret = null;
188 try {
189 Type t = this.getField(4, 0);
190 ret = (NM)t;
191 } catch (ClassCastException cce) {
192 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
193 throw new RuntimeException(cce);
194 } catch (HL7Exception he) {
195 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
196 throw new RuntimeException(he);
197 }
198 return ret;
199 }
200
201
202 /**
203 * Returns
204 * QAK-4: "Hit Count Total" - creates it if necessary
205 */
206 public NM getQak4_HitCountTotal() {
207 NM ret = null;
208 try {
209 Type t = this.getField(4, 0);
210 ret = (NM)t;
211 } catch (ClassCastException cce) {
212 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
213 throw new RuntimeException(cce);
214 } catch (HL7Exception he) {
215 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
216 throw new RuntimeException(he);
217 }
218 return ret;
219 }
220
221
222
223 /**
224 * Returns
225 * QAK-5: "This payload" - creates it if necessary
226 */
227 public NM getThisPayload() {
228 NM ret = null;
229 try {
230 Type t = this.getField(5, 0);
231 ret = (NM)t;
232 } catch (ClassCastException cce) {
233 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
234 throw new RuntimeException(cce);
235 } catch (HL7Exception he) {
236 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
237 throw new RuntimeException(he);
238 }
239 return ret;
240 }
241
242
243 /**
244 * Returns
245 * QAK-5: "This payload" - creates it if necessary
246 */
247 public NM getQak5_ThisPayload() {
248 NM ret = null;
249 try {
250 Type t = this.getField(5, 0);
251 ret = (NM)t;
252 } catch (ClassCastException cce) {
253 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
254 throw new RuntimeException(cce);
255 } catch (HL7Exception he) {
256 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
257 throw new RuntimeException(he);
258 }
259 return ret;
260 }
261
262
263
264 /**
265 * Returns
266 * QAK-6: "Hits remaining" - creates it if necessary
267 */
268 public NM getHitsRemaining() {
269 NM ret = null;
270 try {
271 Type t = this.getField(6, 0);
272 ret = (NM)t;
273 } catch (ClassCastException cce) {
274 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
275 throw new RuntimeException(cce);
276 } catch (HL7Exception he) {
277 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
278 throw new RuntimeException(he);
279 }
280 return ret;
281 }
282
283
284 /**
285 * Returns
286 * QAK-6: "Hits remaining" - creates it if necessary
287 */
288 public NM getQak6_HitsRemaining() {
289 NM ret = null;
290 try {
291 Type t = this.getField(6, 0);
292 ret = (NM)t;
293 } catch (ClassCastException cce) {
294 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
295 throw new RuntimeException(cce);
296 } catch (HL7Exception he) {
297 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
298 throw new RuntimeException(he);
299 }
300 return ret;
301 }
302
303
304
305
306
307 /** {@inheritDoc} */
308 protected Type createNewTypeWithoutReflection(int field) {
309 switch (field) {
310 case 0: return new ST(getMessage());
311 case 1: return new ID(getMessage(), new Integer( 208 ));
312 case 2: return new CE(getMessage());
313 case 3: return new NM(getMessage());
314 case 4: return new NM(getMessage());
315 case 5: return new NM(getMessage());
316 default: return null;
317 }
318 }
319
320
321 }
322