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.v22.segment;
035
036// import ca.uhn.hl7v2.model.v22.group.*;
037import ca.uhn.hl7v2.model.v22.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/**
049 *<p>Represents an HL7 QRD message segment (QUERY DEFINITION). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>QRD-1: Query date / time (TS) <b> </b>
053     * <li>QRD-2: Query Format Code (ID) <b> </b>
054     * <li>QRD-3: Query Priority (ID) <b> </b>
055     * <li>QRD-4: Query ID (ST) <b> </b>
056     * <li>QRD-5: Deferred Response Type (ID) <b>optional </b>
057     * <li>QRD-6: Deferred response date / time (TS) <b>optional </b>
058     * <li>QRD-7: Quantity Limited Request (CQ_QUANTITY) <b> </b>
059     * <li>QRD-8: Who Subject Filter (ST) <b> repeating</b>
060     * <li>QRD-9: What Subject Filter (ID) <b> repeating</b>
061     * <li>QRD-10: What Department Data Code (ST) <b> repeating</b>
062     * <li>QRD-11: What data code value qualifier (CM_VR) <b>optional repeating</b>
063     * <li>QRD-12: Query Results Level (ID) <b>optional </b>
064 * </ul>
065 */
066@SuppressWarnings("unused")
067public class QRD extends AbstractSegment {
068
069    /** 
070     * Creates a new QRD segment
071     */
072    public QRD(Group parent, ModelClassFactory factory) {
073       super(parent, factory);
074       init(factory);
075    }
076
077    private void init(ModelClassFactory factory) {
078       try {
079                                  this.add(TS.class, true, 1, 26, new Object[]{ getMessage() }, "Query date / time");
080                                              this.add(ID.class, true, 1, 1, new Object[]{ getMessage(), new Integer(106) }, "Query Format Code");
081                                              this.add(ID.class, true, 1, 1, new Object[]{ getMessage(), new Integer(91) }, "Query Priority");
082                                  this.add(ST.class, true, 1, 10, new Object[]{ getMessage() }, "Query ID");
083                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(107) }, "Deferred Response Type");
084                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Deferred response date / time");
085                                  this.add(CQ_QUANTITY.class, true, 1, 10, new Object[]{ getMessage() }, "Quantity Limited Request");
086                                  this.add(ST.class, true, 0, 20, new Object[]{ getMessage() }, "Who Subject Filter");
087                                              this.add(ID.class, true, 0, 3, new Object[]{ getMessage(), new Integer(48) }, "What Subject Filter");
088                                  this.add(ST.class, true, 0, 20, new Object[]{ getMessage() }, "What Department Data Code");
089                                  this.add(CM_VR.class, false, 0, 20, new Object[]{ getMessage() }, "What data code value qualifier");
090                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(108) }, "Query Results Level");
091       } catch(HL7Exception e) {
092          log.error("Unexpected error creating QRD - this is probably a bug in the source code generator.", e);
093       }
094    }
095
096
097
098    /**
099     * Returns
100     * QRD-1: "Query date / time" - creates it if necessary
101     */
102    public TS getQueryDateTime() { 
103                TS retVal = this.getTypedField(1, 0);
104                return retVal;
105    }
106    
107    /**
108     * Returns
109     * QRD-1: "Query date / time" - creates it if necessary
110     */
111    public TS getQrd1_QueryDateTime() { 
112                TS retVal = this.getTypedField(1, 0);
113                return retVal;
114    }
115
116
117
118    /**
119     * Returns
120     * QRD-2: "Query Format Code" - creates it if necessary
121     */
122    public ID getQueryFormatCode() { 
123                ID retVal = this.getTypedField(2, 0);
124                return retVal;
125    }
126    
127    /**
128     * Returns
129     * QRD-2: "Query Format Code" - creates it if necessary
130     */
131    public ID getQrd2_QueryFormatCode() { 
132                ID retVal = this.getTypedField(2, 0);
133                return retVal;
134    }
135
136
137
138    /**
139     * Returns
140     * QRD-3: "Query Priority" - creates it if necessary
141     */
142    public ID getQueryPriority() { 
143                ID retVal = this.getTypedField(3, 0);
144                return retVal;
145    }
146    
147    /**
148     * Returns
149     * QRD-3: "Query Priority" - creates it if necessary
150     */
151    public ID getQrd3_QueryPriority() { 
152                ID retVal = this.getTypedField(3, 0);
153                return retVal;
154    }
155
156
157
158    /**
159     * Returns
160     * QRD-4: "Query ID" - creates it if necessary
161     */
162    public ST getQueryID() { 
163                ST retVal = this.getTypedField(4, 0);
164                return retVal;
165    }
166    
167    /**
168     * Returns
169     * QRD-4: "Query ID" - creates it if necessary
170     */
171    public ST getQrd4_QueryID() { 
172                ST retVal = this.getTypedField(4, 0);
173                return retVal;
174    }
175
176
177
178    /**
179     * Returns
180     * QRD-5: "Deferred Response Type" - creates it if necessary
181     */
182    public ID getDeferredResponseType() { 
183                ID retVal = this.getTypedField(5, 0);
184                return retVal;
185    }
186    
187    /**
188     * Returns
189     * QRD-5: "Deferred Response Type" - creates it if necessary
190     */
191    public ID getQrd5_DeferredResponseType() { 
192                ID retVal = this.getTypedField(5, 0);
193                return retVal;
194    }
195
196
197
198    /**
199     * Returns
200     * QRD-6: "Deferred response date / time" - creates it if necessary
201     */
202    public TS getDeferredResponseDateTime() { 
203                TS retVal = this.getTypedField(6, 0);
204                return retVal;
205    }
206    
207    /**
208     * Returns
209     * QRD-6: "Deferred response date / time" - creates it if necessary
210     */
211    public TS getQrd6_DeferredResponseDateTime() { 
212                TS retVal = this.getTypedField(6, 0);
213                return retVal;
214    }
215
216
217
218    /**
219     * Returns
220     * QRD-7: "Quantity Limited Request" - creates it if necessary
221     */
222    public CQ_QUANTITY getQuantityLimitedRequest() { 
223                CQ_QUANTITY retVal = this.getTypedField(7, 0);
224                return retVal;
225    }
226    
227    /**
228     * Returns
229     * QRD-7: "Quantity Limited Request" - creates it if necessary
230     */
231    public CQ_QUANTITY getQrd7_QuantityLimitedRequest() { 
232                CQ_QUANTITY retVal = this.getTypedField(7, 0);
233                return retVal;
234    }
235
236
237    /**
238     * Returns all repetitions of Who Subject Filter (QRD-8).
239     */
240    public ST[] getWhoSubjectFilter() {
241        ST[] retVal = this.getTypedField(8, new ST[0]);
242        return retVal;
243    }
244
245
246    /**
247     * Returns all repetitions of Who Subject Filter (QRD-8).
248     */
249    public ST[] getQrd8_WhoSubjectFilter() {
250        ST[] retVal = this.getTypedField(8, new ST[0]);
251        return retVal;
252    }
253
254
255    /**
256     * Returns a count of the current number of repetitions of Who Subject Filter (QRD-8).
257     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
258     * it will return zero.
259     */
260    public int getWhoSubjectFilterReps() {
261        return this.getReps(8);
262    }
263
264
265    /**
266     * Returns a specific repetition of
267     * QRD-8: "Who Subject Filter" - creates it if necessary
268     *
269     * @param rep The repetition index (0-indexed)
270     */
271    public ST getWhoSubjectFilter(int rep) { 
272                ST retVal = this.getTypedField(8, rep);
273                return retVal;
274    }
275
276    /**
277     * Returns a specific repetition of
278     * QRD-8: "Who Subject Filter" - creates it if necessary
279     *
280     * @param rep The repetition index (0-indexed)
281     */
282    public ST getQrd8_WhoSubjectFilter(int rep) { 
283                ST retVal = this.getTypedField(8, rep);
284                return retVal;
285    }
286
287    /**
288     * Returns a count of the current number of repetitions of Who Subject Filter (QRD-8).
289     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
290     * it will return zero.
291     */
292    public int getQrd8_WhoSubjectFilterReps() {
293        return this.getReps(8);
294    }
295
296
297    /**
298     * Inserts a repetition of
299     * QRD-8: "Who Subject Filter" at a specific index
300     *
301     * @param rep The repetition index (0-indexed)
302     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
303     */
304    public ST insertWhoSubjectFilter(int rep) throws HL7Exception { 
305        return (ST) super.insertRepetition(8, rep);
306    }
307
308
309    /**
310     * Inserts a repetition of
311     * QRD-8: "Who Subject Filter" at a specific index
312     *
313     * @param rep The repetition index (0-indexed)
314     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
315     */
316    public ST insertQrd8_WhoSubjectFilter(int rep) throws HL7Exception { 
317        return (ST) super.insertRepetition(8, rep);
318    }
319
320
321    /**
322     * Removes a repetition of
323     * QRD-8: "Who Subject Filter" at a specific index
324     *
325     * @param rep The repetition index (0-indexed)
326     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
327     */
328    public ST removeWhoSubjectFilter(int rep) throws HL7Exception { 
329        return (ST) super.removeRepetition(8, rep);
330    }
331
332
333    /**
334     * Removes a repetition of
335     * QRD-8: "Who Subject Filter" at a specific index
336     *
337     * @param rep The repetition index (0-indexed)
338     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
339     */
340    public ST removeQrd8_WhoSubjectFilter(int rep) throws HL7Exception { 
341        return (ST) super.removeRepetition(8, rep);
342    }
343
344
345
346    /**
347     * Returns all repetitions of What Subject Filter (QRD-9).
348     */
349    public ID[] getWhatSubjectFilter() {
350        ID[] retVal = this.getTypedField(9, new ID[0]);
351        return retVal;
352    }
353
354
355    /**
356     * Returns all repetitions of What Subject Filter (QRD-9).
357     */
358    public ID[] getQrd9_WhatSubjectFilter() {
359        ID[] retVal = this.getTypedField(9, new ID[0]);
360        return retVal;
361    }
362
363
364    /**
365     * Returns a count of the current number of repetitions of What Subject Filter (QRD-9).
366     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
367     * it will return zero.
368     */
369    public int getWhatSubjectFilterReps() {
370        return this.getReps(9);
371    }
372
373
374    /**
375     * Returns a specific repetition of
376     * QRD-9: "What Subject Filter" - creates it if necessary
377     *
378     * @param rep The repetition index (0-indexed)
379     */
380    public ID getWhatSubjectFilter(int rep) { 
381                ID retVal = this.getTypedField(9, rep);
382                return retVal;
383    }
384
385    /**
386     * Returns a specific repetition of
387     * QRD-9: "What Subject Filter" - creates it if necessary
388     *
389     * @param rep The repetition index (0-indexed)
390     */
391    public ID getQrd9_WhatSubjectFilter(int rep) { 
392                ID retVal = this.getTypedField(9, rep);
393                return retVal;
394    }
395
396    /**
397     * Returns a count of the current number of repetitions of What Subject Filter (QRD-9).
398     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
399     * it will return zero.
400     */
401    public int getQrd9_WhatSubjectFilterReps() {
402        return this.getReps(9);
403    }
404
405
406    /**
407     * Inserts a repetition of
408     * QRD-9: "What Subject Filter" at a specific index
409     *
410     * @param rep The repetition index (0-indexed)
411     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
412     */
413    public ID insertWhatSubjectFilter(int rep) throws HL7Exception { 
414        return (ID) super.insertRepetition(9, rep);
415    }
416
417
418    /**
419     * Inserts a repetition of
420     * QRD-9: "What Subject Filter" at a specific index
421     *
422     * @param rep The repetition index (0-indexed)
423     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
424     */
425    public ID insertQrd9_WhatSubjectFilter(int rep) throws HL7Exception { 
426        return (ID) super.insertRepetition(9, rep);
427    }
428
429
430    /**
431     * Removes a repetition of
432     * QRD-9: "What Subject Filter" at a specific index
433     *
434     * @param rep The repetition index (0-indexed)
435     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
436     */
437    public ID removeWhatSubjectFilter(int rep) throws HL7Exception { 
438        return (ID) super.removeRepetition(9, rep);
439    }
440
441
442    /**
443     * Removes a repetition of
444     * QRD-9: "What Subject Filter" at a specific index
445     *
446     * @param rep The repetition index (0-indexed)
447     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
448     */
449    public ID removeQrd9_WhatSubjectFilter(int rep) throws HL7Exception { 
450        return (ID) super.removeRepetition(9, rep);
451    }
452
453
454
455    /**
456     * Returns all repetitions of What Department Data Code (QRD-10).
457     */
458    public ST[] getWhatDepartmentDataCode() {
459        ST[] retVal = this.getTypedField(10, new ST[0]);
460        return retVal;
461    }
462
463
464    /**
465     * Returns all repetitions of What Department Data Code (QRD-10).
466     */
467    public ST[] getQrd10_WhatDepartmentDataCode() {
468        ST[] retVal = this.getTypedField(10, new ST[0]);
469        return retVal;
470    }
471
472
473    /**
474     * Returns a count of the current number of repetitions of What Department Data Code (QRD-10).
475     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
476     * it will return zero.
477     */
478    public int getWhatDepartmentDataCodeReps() {
479        return this.getReps(10);
480    }
481
482
483    /**
484     * Returns a specific repetition of
485     * QRD-10: "What Department Data Code" - creates it if necessary
486     *
487     * @param rep The repetition index (0-indexed)
488     */
489    public ST getWhatDepartmentDataCode(int rep) { 
490                ST retVal = this.getTypedField(10, rep);
491                return retVal;
492    }
493
494    /**
495     * Returns a specific repetition of
496     * QRD-10: "What Department Data Code" - creates it if necessary
497     *
498     * @param rep The repetition index (0-indexed)
499     */
500    public ST getQrd10_WhatDepartmentDataCode(int rep) { 
501                ST retVal = this.getTypedField(10, rep);
502                return retVal;
503    }
504
505    /**
506     * Returns a count of the current number of repetitions of What Department Data Code (QRD-10).
507     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
508     * it will return zero.
509     */
510    public int getQrd10_WhatDepartmentDataCodeReps() {
511        return this.getReps(10);
512    }
513
514
515    /**
516     * Inserts a repetition of
517     * QRD-10: "What Department Data Code" at a specific index
518     *
519     * @param rep The repetition index (0-indexed)
520     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
521     */
522    public ST insertWhatDepartmentDataCode(int rep) throws HL7Exception { 
523        return (ST) super.insertRepetition(10, rep);
524    }
525
526
527    /**
528     * Inserts a repetition of
529     * QRD-10: "What Department Data Code" at a specific index
530     *
531     * @param rep The repetition index (0-indexed)
532     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
533     */
534    public ST insertQrd10_WhatDepartmentDataCode(int rep) throws HL7Exception { 
535        return (ST) super.insertRepetition(10, rep);
536    }
537
538
539    /**
540     * Removes a repetition of
541     * QRD-10: "What Department Data Code" at a specific index
542     *
543     * @param rep The repetition index (0-indexed)
544     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
545     */
546    public ST removeWhatDepartmentDataCode(int rep) throws HL7Exception { 
547        return (ST) super.removeRepetition(10, rep);
548    }
549
550
551    /**
552     * Removes a repetition of
553     * QRD-10: "What Department Data Code" at a specific index
554     *
555     * @param rep The repetition index (0-indexed)
556     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
557     */
558    public ST removeQrd10_WhatDepartmentDataCode(int rep) throws HL7Exception { 
559        return (ST) super.removeRepetition(10, rep);
560    }
561
562
563
564    /**
565     * Returns all repetitions of What data code value qualifier (QRD-11).
566     */
567    public CM_VR[] getWhatDataCodeValueQualifier() {
568        CM_VR[] retVal = this.getTypedField(11, new CM_VR[0]);
569        return retVal;
570    }
571
572
573    /**
574     * Returns all repetitions of What data code value qualifier (QRD-11).
575     */
576    public CM_VR[] getQrd11_WhatDataCodeValueQualifier() {
577        CM_VR[] retVal = this.getTypedField(11, new CM_VR[0]);
578        return retVal;
579    }
580
581
582    /**
583     * Returns a count of the current number of repetitions of What data code value qualifier (QRD-11).
584     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
585     * it will return zero.
586     */
587    public int getWhatDataCodeValueQualifierReps() {
588        return this.getReps(11);
589    }
590
591
592    /**
593     * Returns a specific repetition of
594     * QRD-11: "What data code value qualifier" - creates it if necessary
595     *
596     * @param rep The repetition index (0-indexed)
597     */
598    public CM_VR getWhatDataCodeValueQualifier(int rep) { 
599                CM_VR retVal = this.getTypedField(11, rep);
600                return retVal;
601    }
602
603    /**
604     * Returns a specific repetition of
605     * QRD-11: "What data code value qualifier" - creates it if necessary
606     *
607     * @param rep The repetition index (0-indexed)
608     */
609    public CM_VR getQrd11_WhatDataCodeValueQualifier(int rep) { 
610                CM_VR retVal = this.getTypedField(11, rep);
611                return retVal;
612    }
613
614    /**
615     * Returns a count of the current number of repetitions of What data code value qualifier (QRD-11).
616     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
617     * it will return zero.
618     */
619    public int getQrd11_WhatDataCodeValueQualifierReps() {
620        return this.getReps(11);
621    }
622
623
624    /**
625     * Inserts a repetition of
626     * QRD-11: "What data code value qualifier" at a specific index
627     *
628     * @param rep The repetition index (0-indexed)
629     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
630     */
631    public CM_VR insertWhatDataCodeValueQualifier(int rep) throws HL7Exception { 
632        return (CM_VR) super.insertRepetition(11, rep);
633    }
634
635
636    /**
637     * Inserts a repetition of
638     * QRD-11: "What data code value qualifier" at a specific index
639     *
640     * @param rep The repetition index (0-indexed)
641     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
642     */
643    public CM_VR insertQrd11_WhatDataCodeValueQualifier(int rep) throws HL7Exception { 
644        return (CM_VR) super.insertRepetition(11, rep);
645    }
646
647
648    /**
649     * Removes a repetition of
650     * QRD-11: "What data code value qualifier" at a specific index
651     *
652     * @param rep The repetition index (0-indexed)
653     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
654     */
655    public CM_VR removeWhatDataCodeValueQualifier(int rep) throws HL7Exception { 
656        return (CM_VR) super.removeRepetition(11, rep);
657    }
658
659
660    /**
661     * Removes a repetition of
662     * QRD-11: "What data code value qualifier" at a specific index
663     *
664     * @param rep The repetition index (0-indexed)
665     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
666     */
667    public CM_VR removeQrd11_WhatDataCodeValueQualifier(int rep) throws HL7Exception { 
668        return (CM_VR) super.removeRepetition(11, rep);
669    }
670
671
672
673
674    /**
675     * Returns
676     * QRD-12: "Query Results Level" - creates it if necessary
677     */
678    public ID getQueryResultsLevel() { 
679                ID retVal = this.getTypedField(12, 0);
680                return retVal;
681    }
682    
683    /**
684     * Returns
685     * QRD-12: "Query Results Level" - creates it if necessary
686     */
687    public ID getQrd12_QueryResultsLevel() { 
688                ID retVal = this.getTypedField(12, 0);
689                return retVal;
690    }
691
692
693
694
695
696    /** {@inheritDoc} */   
697    protected Type createNewTypeWithoutReflection(int field) {
698       switch (field) {
699          case 0: return new TS(getMessage());
700          case 1: return new ID(getMessage(), new Integer( 106 ));
701          case 2: return new ID(getMessage(), new Integer( 91 ));
702          case 3: return new ST(getMessage());
703          case 4: return new ID(getMessage(), new Integer( 107 ));
704          case 5: return new TS(getMessage());
705          case 6: return new CQ_QUANTITY(getMessage());
706          case 7: return new ST(getMessage());
707          case 8: return new ID(getMessage(), new Integer( 48 ));
708          case 9: return new ST(getMessage());
709          case 10: return new CM_VR(getMessage());
710          case 11: return new ID(getMessage(), new Integer( 108 ));
711          default: return null;
712       }
713   }
714
715
716}
717