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