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 OSR_Q06 message structure (see chapter ?). 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: NTE (Notes and Comments) <b>optional repeating</b></li>
027 * <li>5: QRD (Original-Style Query Definition) <b> </b></li>
028 * <li>6: QRF (Original Style Query Filter) <b>optional </b></li>
029 * <li>7: OSR_Q06_RESPONSE (a Group object) <b>optional </b></li>
030 * <li>8: DSC (Continuation Pointer) <b>optional </b></li>
031 * </ul>
032 */
033 public class OSR_Q06 extends AbstractMessage {
034
035 /**
036 * Creates a new OSR_Q06 message with DefaultModelClassFactory.
037 */
038 public OSR_Q06() {
039 this(new DefaultModelClassFactory());
040 }
041
042 /**
043 * Creates a new OSR_Q06 message with custom ModelClassFactory.
044 */
045 public OSR_Q06(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(NTE.class, false, true);
056 this.add(QRD.class, true, false);
057 this.add(QRF.class, false, false);
058 this.add(OSR_Q06_RESPONSE.class, false, false);
059 this.add(DSC.class, false, false);
060 } catch(HL7Exception e) {
061 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating OSR_Q06 - 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 * the first repetition of
131 * NTE (Notes and Comments) - creates it if necessary
132 */
133 public NTE getNTE() {
134 NTE ret = null;
135 try {
136 ret = (NTE)this.get("NTE");
137 } catch(HL7Exception e) {
138 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
139 throw new RuntimeException(e);
140 }
141 return ret;
142 }
143
144
145 /**
146 * Returns a specific repetition of
147 * NTE (Notes and Comments) - creates it if necessary
148 *
149 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
150 * @throws HL7Exception if the repetition requested is more than one
151 * greater than the number of existing repetitions.
152 */
153 public NTE getNTE(int rep) {
154 NTE ret = null;
155 try {
156 ret = (NTE)this.get("NTE", rep);
157 } catch(HL7Exception e) {
158 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
159 throw new RuntimeException(e);
160 }
161 return ret;
162 }
163
164 /**
165 * Returns the number of existing repetitions of NTE
166 */
167 public int getNTEReps() {
168 int reps = -1;
169 try {
170 reps = this.getAll("NTE").length;
171 } catch (HL7Exception e) {
172 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
173 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
174 throw new RuntimeException(message);
175 }
176 return reps;
177 }
178
179 /**
180 * Inserts a specific repetition of NTE (Notes and Comments)
181 * @see AbstractGroup\#insertRepetition(Structure, int)
182 */
183 public void insertNTE(NTE structure, int rep) throws HL7Exception {
184 super.insertRepetition( "NTE", structure, rep);
185 }
186
187
188 /**
189 * Inserts a specific repetition of NTE (Notes and Comments)
190 * @see AbstractGroup\#insertRepetition(Structure, int)
191 */
192 public NTE insertNTE(int rep) throws HL7Exception {
193 return (NTE)super.insertRepetition("NTE", rep);
194 }
195
196
197 /**
198 * Removes a specific repetition of NTE (Notes and Comments)
199 * @see AbstractGroup\#removeRepetition(String, int)
200 */
201 public NTE removeNTE(int rep) throws HL7Exception {
202 return (NTE)super.removeRepetition("NTE", rep);
203 }
204
205
206
207 /**
208 * Returns
209 * QRD (Original-Style Query Definition) - creates it if necessary
210 */
211 public QRD getQRD() {
212 QRD ret = null;
213 try {
214 ret = (QRD)this.get("QRD");
215 } catch(HL7Exception e) {
216 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
217 throw new RuntimeException(e);
218 }
219 return ret;
220 }
221
222
223
224
225 /**
226 * Returns
227 * QRF (Original Style Query Filter) - creates it if necessary
228 */
229 public QRF getQRF() {
230 QRF ret = null;
231 try {
232 ret = (QRF)this.get("QRF");
233 } catch(HL7Exception e) {
234 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
235 throw new RuntimeException(e);
236 }
237 return ret;
238 }
239
240
241
242
243 /**
244 * Returns
245 * RESPONSE (a Group object) - creates it if necessary
246 */
247 public OSR_Q06_RESPONSE getRESPONSE() {
248 OSR_Q06_RESPONSE ret = null;
249 try {
250 ret = (OSR_Q06_RESPONSE)this.get("RESPONSE");
251 } catch(HL7Exception e) {
252 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
253 throw new RuntimeException(e);
254 }
255 return ret;
256 }
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