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 * The contents of this file are subject to the Mozilla Public License Version 1.1 
008 * (the "License"); you may not use this file except in compliance with the License. 
009 * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
010 * Software distributed under the License is distributed on an "AS IS" basis, 
011 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
012 * specific language governing rights and limitations under the License. 
013 * 
014 * The Original Code is "[file_name]".  Description: 
015 * "[one_line_description]" 
016 * 
017 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
018 * 2012.  All Rights Reserved. 
019 * 
020 * Contributor(s): ______________________________________. 
021 * 
022 * Alternatively, the contents of this file may be used under the terms of the 
023 * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
024 * applicable instead of those above.  If you wish to allow use of your version of this 
025 * file only under the terms of the GPL and not to allow others to use your version 
026 * of this file under the MPL, indicate your decision by deleting  the provisions above 
027 * and replace  them with the notice and other provisions required by the GPL License.  
028 * If you do not delete the provisions above, a recipient may use your version of 
029 * this file under either the MPL or the GPL. 
030 * 
031 */
032
033
034package ca.uhn.hl7v2.model.v21.segment;
035
036// import ca.uhn.hl7v2.model.v21.group.*;
037import ca.uhn.hl7v2.model.v21.datatype.*;
038import ca.uhn.hl7v2.HL7Exception;
039import ca.uhn.hl7v2.parser.ModelClassFactory;
040import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
041import ca.uhn.hl7v2.model.AbstractMessage;
042import ca.uhn.hl7v2.model.Group;
043import ca.uhn.hl7v2.model.Type;
044import ca.uhn.hl7v2.model.AbstractSegment;
045import ca.uhn.hl7v2.model.Varies;
046
047/**
048 *<p>Represents an HL7 QRF message segment (QUERY FILTER). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>QRF-1: WHERE SUBJECT FILTER (ST) <b> repeating</b>
052     * <li>QRF-2: WHEN DATA START DATE/TIME (TS) <b>optional </b>
053     * <li>QRF-3: WHEN DATA END DATE/TIME (TS) <b>optional </b>
054     * <li>QRF-4: WHAT USER QUALIFIER (ST) <b>optional repeating</b>
055     * <li>QRF-5: OTHER QRY SUBJECT FILTER (ST) <b>optional repeating</b>
056 * </ul>
057 */
058@SuppressWarnings("unused")
059public class QRF extends AbstractSegment {
060
061    /** 
062     * Creates a new QRF segment
063     */
064    public QRF(Group parent, ModelClassFactory factory) {
065       super(parent, factory);
066       init(factory);
067    }
068
069    private void init(ModelClassFactory factory) {
070       try {
071                                  this.add(ST.class, true, 0, 20, new Object[]{ getMessage() }, "WHERE SUBJECT FILTER");
072                                  this.add(TS.class, false, 1, 19, new Object[]{ getMessage() }, "WHEN DATA START DATE/TIME");
073                                  this.add(TS.class, false, 1, 19, new Object[]{ getMessage() }, "WHEN DATA END DATE/TIME");
074                                  this.add(ST.class, false, 0, 20, new Object[]{ getMessage() }, "WHAT USER QUALIFIER");
075                                  this.add(ST.class, false, 0, 20, new Object[]{ getMessage() }, "OTHER QRY SUBJECT FILTER");
076       } catch(HL7Exception e) {
077          log.error("Unexpected error creating QRF - this is probably a bug in the source code generator.", e);
078       }
079    }
080
081
082    /**
083     * Returns all repetitions of WHERE SUBJECT FILTER (QRF-1).
084     */
085    public ST[] getWHERESUBJECTFILTER() {
086        ST[] retVal = this.getTypedField(1, new ST[0]);
087        return retVal;
088    }
089
090
091    /**
092     * Returns all repetitions of WHERE SUBJECT FILTER (QRF-1).
093     */
094    public ST[] getQrf1_WHERESUBJECTFILTER() {
095        ST[] retVal = this.getTypedField(1, new ST[0]);
096        return retVal;
097    }
098
099
100    /**
101     * Returns a count of the current number of repetitions of WHERE SUBJECT FILTER (QRF-1).
102     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
103     * it will return zero.
104     */
105    public int getWHERESUBJECTFILTERReps() {
106        return this.getReps(1);
107    }
108
109
110    /**
111     * Returns a specific repetition of
112     * QRF-1: "WHERE SUBJECT FILTER" - creates it if necessary
113     *
114     * @param rep The repetition index (0-indexed)
115     */
116    public ST getWHERESUBJECTFILTER(int rep) { 
117                ST retVal = this.getTypedField(1, rep);
118                return retVal;
119    }
120
121    /**
122     * Returns a specific repetition of
123     * QRF-1: "WHERE SUBJECT FILTER" - creates it if necessary
124     *
125     * @param rep The repetition index (0-indexed)
126     */
127    public ST getQrf1_WHERESUBJECTFILTER(int rep) { 
128                ST retVal = this.getTypedField(1, rep);
129                return retVal;
130    }
131
132    /**
133     * Returns a count of the current number of repetitions of WHERE SUBJECT FILTER (QRF-1).
134     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
135     * it will return zero.
136     */
137    public int getQrf1_WHERESUBJECTFILTERReps() {
138        return this.getReps(1);
139    }
140
141
142    /**
143     * Inserts a repetition of
144     * QRF-1: "WHERE SUBJECT FILTER" at a specific index
145     *
146     * @param rep The repetition index (0-indexed)
147     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
148     */
149    public ST insertWHERESUBJECTFILTER(int rep) throws HL7Exception { 
150        return (ST) super.insertRepetition(1, rep);
151    }
152
153
154    /**
155     * Inserts a repetition of
156     * QRF-1: "WHERE SUBJECT FILTER" at a specific index
157     *
158     * @param rep The repetition index (0-indexed)
159     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
160     */
161    public ST insertQrf1_WHERESUBJECTFILTER(int rep) throws HL7Exception { 
162        return (ST) super.insertRepetition(1, rep);
163    }
164
165
166    /**
167     * Removes a repetition of
168     * QRF-1: "WHERE SUBJECT FILTER" at a specific index
169     *
170     * @param rep The repetition index (0-indexed)
171     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
172     */
173    public ST removeWHERESUBJECTFILTER(int rep) throws HL7Exception { 
174        return (ST) super.removeRepetition(1, rep);
175    }
176
177
178    /**
179     * Removes a repetition of
180     * QRF-1: "WHERE SUBJECT FILTER" at a specific index
181     *
182     * @param rep The repetition index (0-indexed)
183     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
184     */
185    public ST removeQrf1_WHERESUBJECTFILTER(int rep) throws HL7Exception { 
186        return (ST) super.removeRepetition(1, rep);
187    }
188
189
190
191
192    /**
193     * Returns
194     * QRF-2: "WHEN DATA START DATE/TIME" - creates it if necessary
195     */
196    public TS getWHENDATASTARTDATETIME() { 
197                TS retVal = this.getTypedField(2, 0);
198                return retVal;
199    }
200    
201    /**
202     * Returns
203     * QRF-2: "WHEN DATA START DATE/TIME" - creates it if necessary
204     */
205    public TS getQrf2_WHENDATASTARTDATETIME() { 
206                TS retVal = this.getTypedField(2, 0);
207                return retVal;
208    }
209
210
211
212    /**
213     * Returns
214     * QRF-3: "WHEN DATA END DATE/TIME" - creates it if necessary
215     */
216    public TS getWHENDATAENDDATETIME() { 
217                TS retVal = this.getTypedField(3, 0);
218                return retVal;
219    }
220    
221    /**
222     * Returns
223     * QRF-3: "WHEN DATA END DATE/TIME" - creates it if necessary
224     */
225    public TS getQrf3_WHENDATAENDDATETIME() { 
226                TS retVal = this.getTypedField(3, 0);
227                return retVal;
228    }
229
230
231    /**
232     * Returns all repetitions of WHAT USER QUALIFIER (QRF-4).
233     */
234    public ST[] getWHATUSERQUALIFIER() {
235        ST[] retVal = this.getTypedField(4, new ST[0]);
236        return retVal;
237    }
238
239
240    /**
241     * Returns all repetitions of WHAT USER QUALIFIER (QRF-4).
242     */
243    public ST[] getQrf4_WHATUSERQUALIFIER() {
244        ST[] retVal = this.getTypedField(4, new ST[0]);
245        return retVal;
246    }
247
248
249    /**
250     * Returns a count of the current number of repetitions of WHAT USER QUALIFIER (QRF-4).
251     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
252     * it will return zero.
253     */
254    public int getWHATUSERQUALIFIERReps() {
255        return this.getReps(4);
256    }
257
258
259    /**
260     * Returns a specific repetition of
261     * QRF-4: "WHAT USER QUALIFIER" - creates it if necessary
262     *
263     * @param rep The repetition index (0-indexed)
264     */
265    public ST getWHATUSERQUALIFIER(int rep) { 
266                ST retVal = this.getTypedField(4, rep);
267                return retVal;
268    }
269
270    /**
271     * Returns a specific repetition of
272     * QRF-4: "WHAT USER QUALIFIER" - creates it if necessary
273     *
274     * @param rep The repetition index (0-indexed)
275     */
276    public ST getQrf4_WHATUSERQUALIFIER(int rep) { 
277                ST retVal = this.getTypedField(4, rep);
278                return retVal;
279    }
280
281    /**
282     * Returns a count of the current number of repetitions of WHAT USER QUALIFIER (QRF-4).
283     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
284     * it will return zero.
285     */
286    public int getQrf4_WHATUSERQUALIFIERReps() {
287        return this.getReps(4);
288    }
289
290
291    /**
292     * Inserts a repetition of
293     * QRF-4: "WHAT USER QUALIFIER" at a specific index
294     *
295     * @param rep The repetition index (0-indexed)
296     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
297     */
298    public ST insertWHATUSERQUALIFIER(int rep) throws HL7Exception { 
299        return (ST) super.insertRepetition(4, rep);
300    }
301
302
303    /**
304     * Inserts a repetition of
305     * QRF-4: "WHAT USER QUALIFIER" at a specific index
306     *
307     * @param rep The repetition index (0-indexed)
308     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
309     */
310    public ST insertQrf4_WHATUSERQUALIFIER(int rep) throws HL7Exception { 
311        return (ST) super.insertRepetition(4, rep);
312    }
313
314
315    /**
316     * Removes a repetition of
317     * QRF-4: "WHAT USER QUALIFIER" at a specific index
318     *
319     * @param rep The repetition index (0-indexed)
320     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
321     */
322    public ST removeWHATUSERQUALIFIER(int rep) throws HL7Exception { 
323        return (ST) super.removeRepetition(4, rep);
324    }
325
326
327    /**
328     * Removes a repetition of
329     * QRF-4: "WHAT USER QUALIFIER" at a specific index
330     *
331     * @param rep The repetition index (0-indexed)
332     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
333     */
334    public ST removeQrf4_WHATUSERQUALIFIER(int rep) throws HL7Exception { 
335        return (ST) super.removeRepetition(4, rep);
336    }
337
338
339
340    /**
341     * Returns all repetitions of OTHER QRY SUBJECT FILTER (QRF-5).
342     */
343    public ST[] getOTHERQRYSUBJECTFILTER() {
344        ST[] retVal = this.getTypedField(5, new ST[0]);
345        return retVal;
346    }
347
348
349    /**
350     * Returns all repetitions of OTHER QRY SUBJECT FILTER (QRF-5).
351     */
352    public ST[] getQrf5_OTHERQRYSUBJECTFILTER() {
353        ST[] retVal = this.getTypedField(5, new ST[0]);
354        return retVal;
355    }
356
357
358    /**
359     * Returns a count of the current number of repetitions of OTHER QRY SUBJECT FILTER (QRF-5).
360     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
361     * it will return zero.
362     */
363    public int getOTHERQRYSUBJECTFILTERReps() {
364        return this.getReps(5);
365    }
366
367
368    /**
369     * Returns a specific repetition of
370     * QRF-5: "OTHER QRY SUBJECT FILTER" - creates it if necessary
371     *
372     * @param rep The repetition index (0-indexed)
373     */
374    public ST getOTHERQRYSUBJECTFILTER(int rep) { 
375                ST retVal = this.getTypedField(5, rep);
376                return retVal;
377    }
378
379    /**
380     * Returns a specific repetition of
381     * QRF-5: "OTHER QRY SUBJECT FILTER" - creates it if necessary
382     *
383     * @param rep The repetition index (0-indexed)
384     */
385    public ST getQrf5_OTHERQRYSUBJECTFILTER(int rep) { 
386                ST retVal = this.getTypedField(5, rep);
387                return retVal;
388    }
389
390    /**
391     * Returns a count of the current number of repetitions of OTHER QRY SUBJECT FILTER (QRF-5).
392     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
393     * it will return zero.
394     */
395    public int getQrf5_OTHERQRYSUBJECTFILTERReps() {
396        return this.getReps(5);
397    }
398
399
400    /**
401     * Inserts a repetition of
402     * QRF-5: "OTHER QRY SUBJECT FILTER" at a specific index
403     *
404     * @param rep The repetition index (0-indexed)
405     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
406     */
407    public ST insertOTHERQRYSUBJECTFILTER(int rep) throws HL7Exception { 
408        return (ST) super.insertRepetition(5, rep);
409    }
410
411
412    /**
413     * Inserts a repetition of
414     * QRF-5: "OTHER QRY SUBJECT FILTER" at a specific index
415     *
416     * @param rep The repetition index (0-indexed)
417     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
418     */
419    public ST insertQrf5_OTHERQRYSUBJECTFILTER(int rep) throws HL7Exception { 
420        return (ST) super.insertRepetition(5, rep);
421    }
422
423
424    /**
425     * Removes a repetition of
426     * QRF-5: "OTHER QRY SUBJECT FILTER" at a specific index
427     *
428     * @param rep The repetition index (0-indexed)
429     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
430     */
431    public ST removeOTHERQRYSUBJECTFILTER(int rep) throws HL7Exception { 
432        return (ST) super.removeRepetition(5, rep);
433    }
434
435
436    /**
437     * Removes a repetition of
438     * QRF-5: "OTHER QRY SUBJECT FILTER" at a specific index
439     *
440     * @param rep The repetition index (0-indexed)
441     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
442     */
443    public ST removeQrf5_OTHERQRYSUBJECTFILTER(int rep) throws HL7Exception { 
444        return (ST) super.removeRepetition(5, rep);
445    }
446
447
448
449
450
451
452    /** {@inheritDoc} */   
453    protected Type createNewTypeWithoutReflection(int field) {
454       switch (field) {
455          case 0: return new ST(getMessage());
456          case 1: return new TS(getMessage());
457          case 2: return new TS(getMessage());
458          case 3: return new ST(getMessage());
459          case 4: return new ST(getMessage());
460          default: return null;
461       }
462   }
463
464
465}
466