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 QRD message segment (Original-Style Query Definition). 
024     * This segment has the following fields:</p>
025     * <ul>
026         * <li>QRD-1: Query Date/Time (TS) <b> </b>
027         * <li>QRD-2: Query Format Code (ID) <b> </b>
028         * <li>QRD-3: Query Priority (ID) <b> </b>
029         * <li>QRD-4: Query ID (ST) <b> </b>
030         * <li>QRD-5: Deferred Response Type (ID) <b>optional </b>
031         * <li>QRD-6: Deferred Response Date/Time (TS) <b>optional </b>
032         * <li>QRD-7: Quantity Limited Request (CQ) <b> </b>
033         * <li>QRD-8: Who Subject Filter (XCN) <b> repeating</b>
034         * <li>QRD-9: What Subject Filter (CE) <b> repeating</b>
035         * <li>QRD-10: What Department Data Code (CE) <b> repeating</b>
036         * <li>QRD-11: What Data Code Value Qual. (VR) <b>optional repeating</b>
037         * <li>QRD-12: Query Results Level (ID) <b>optional </b>
038     * </ul>
039     */
040    public class QRD extends AbstractSegment {
041    
042        /** 
043         * Creates a new QRD segment
044         */
045        public QRD(Group parent, ModelClassFactory factory) {
046           super(parent, factory);
047           init(factory);
048        }
049    
050        private void init(ModelClassFactory factory) {
051           try {
052                                      this.add(TS.class, true, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Query Date/Time");
053                                      this.add(ID.class, true, 1, 1, new Object[]{ getMessage() }, "Query Format Code");
054                                      this.add(ID.class, true, 1, 1, new Object[]{ getMessage() }, "Query Priority");
055                                      this.add(ST.class, true, 1, 10, new Object[]{ getMessage(), new Integer(0) }, "Query ID");
056                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Deferred Response Type");
057                                      this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Deferred Response Date/Time");
058                                      this.add(CQ.class, true, 1, 10, new Object[]{ getMessage(), new Integer(126) }, "Quantity Limited Request");
059                                      this.add(XCN.class, true, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Who Subject Filter");
060                                      this.add(CE.class, true, 0, 250, new Object[]{ getMessage(), new Integer(48) }, "What Subject Filter");
061                                      this.add(CE.class, true, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "What Department Data Code");
062                                      this.add(VR.class, false, 0, 20, new Object[]{ getMessage(), new Integer(0) }, "What Data Code Value Qual.");
063                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Query Results Level");
064           } catch(HL7Exception e) {
065              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating QRD - this is probably a bug in the source code generator.", e);
066           }
067        }
068    
069    
070    
071        /**
072         * Returns
073         * QRD-1: "Query Date/Time" - creates it if necessary
074         */
075        public TS getQueryDateTime() { 
076            TS ret = null;
077            try {
078                Type t = this.getField(1, 0);
079                ret = (TS)t;
080            } catch (ClassCastException cce) {
081                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
082                throw new RuntimeException(cce);
083            } catch (HL7Exception he) {
084                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
085                throw new RuntimeException(he);
086            }
087            return ret;
088        }
089    
090    
091        /**
092         * Returns
093         * QRD-1: "Query Date/Time" - creates it if necessary
094         */
095        public TS getQrd1_QueryDateTime() { 
096            TS ret = null;
097            try {
098                Type t = this.getField(1, 0);
099                ret = (TS)t;
100            } catch (ClassCastException cce) {
101                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
102                throw new RuntimeException(cce);
103            } catch (HL7Exception he) {
104                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
105                throw new RuntimeException(he);
106            }
107            return ret;
108        }
109    
110    
111    
112        /**
113         * Returns
114         * QRD-2: "Query Format Code" - creates it if necessary
115         */
116        public ID getQueryFormatCode() { 
117            ID ret = null;
118            try {
119                Type t = this.getField(2, 0);
120                ret = (ID)t;
121            } catch (ClassCastException cce) {
122                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
123                throw new RuntimeException(cce);
124            } catch (HL7Exception he) {
125                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
126                throw new RuntimeException(he);
127            }
128            return ret;
129        }
130    
131    
132        /**
133         * Returns
134         * QRD-2: "Query Format Code" - creates it if necessary
135         */
136        public ID getQrd2_QueryFormatCode() { 
137            ID ret = null;
138            try {
139                Type t = this.getField(2, 0);
140                ret = (ID)t;
141            } catch (ClassCastException cce) {
142                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
143                throw new RuntimeException(cce);
144            } catch (HL7Exception he) {
145                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
146                throw new RuntimeException(he);
147            }
148            return ret;
149        }
150    
151    
152    
153        /**
154         * Returns
155         * QRD-3: "Query Priority" - creates it if necessary
156         */
157        public ID getQueryPriority() { 
158            ID ret = null;
159            try {
160                Type t = this.getField(3, 0);
161                ret = (ID)t;
162            } catch (ClassCastException cce) {
163                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
164                throw new RuntimeException(cce);
165            } catch (HL7Exception he) {
166                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
167                throw new RuntimeException(he);
168            }
169            return ret;
170        }
171    
172    
173        /**
174         * Returns
175         * QRD-3: "Query Priority" - creates it if necessary
176         */
177        public ID getQrd3_QueryPriority() { 
178            ID ret = null;
179            try {
180                Type t = this.getField(3, 0);
181                ret = (ID)t;
182            } catch (ClassCastException cce) {
183                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
184                throw new RuntimeException(cce);
185            } catch (HL7Exception he) {
186                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
187                throw new RuntimeException(he);
188            }
189            return ret;
190        }
191    
192    
193    
194        /**
195         * Returns
196         * QRD-4: "Query ID" - creates it if necessary
197         */
198        public ST getQueryID() { 
199            ST ret = null;
200            try {
201                Type t = this.getField(4, 0);
202                ret = (ST)t;
203            } catch (ClassCastException cce) {
204                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
205                throw new RuntimeException(cce);
206            } catch (HL7Exception he) {
207                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
208                throw new RuntimeException(he);
209            }
210            return ret;
211        }
212    
213    
214        /**
215         * Returns
216         * QRD-4: "Query ID" - creates it if necessary
217         */
218        public ST getQrd4_QueryID() { 
219            ST ret = null;
220            try {
221                Type t = this.getField(4, 0);
222                ret = (ST)t;
223            } catch (ClassCastException cce) {
224                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
225                throw new RuntimeException(cce);
226            } catch (HL7Exception he) {
227                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
228                throw new RuntimeException(he);
229            }
230            return ret;
231        }
232    
233    
234    
235        /**
236         * Returns
237         * QRD-5: "Deferred Response Type" - creates it if necessary
238         */
239        public ID getDeferredResponseType() { 
240            ID ret = null;
241            try {
242                Type t = this.getField(5, 0);
243                ret = (ID)t;
244            } catch (ClassCastException cce) {
245                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
246                throw new RuntimeException(cce);
247            } catch (HL7Exception he) {
248                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
249                throw new RuntimeException(he);
250            }
251            return ret;
252        }
253    
254    
255        /**
256         * Returns
257         * QRD-5: "Deferred Response Type" - creates it if necessary
258         */
259        public ID getQrd5_DeferredResponseType() { 
260            ID ret = null;
261            try {
262                Type t = this.getField(5, 0);
263                ret = (ID)t;
264            } catch (ClassCastException cce) {
265                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
266                throw new RuntimeException(cce);
267            } catch (HL7Exception he) {
268                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
269                throw new RuntimeException(he);
270            }
271            return ret;
272        }
273    
274    
275    
276        /**
277         * Returns
278         * QRD-6: "Deferred Response Date/Time" - creates it if necessary
279         */
280        public TS getDeferredResponseDateTime() { 
281            TS ret = null;
282            try {
283                Type t = this.getField(6, 0);
284                ret = (TS)t;
285            } catch (ClassCastException cce) {
286                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
287                throw new RuntimeException(cce);
288            } catch (HL7Exception he) {
289                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
290                throw new RuntimeException(he);
291            }
292            return ret;
293        }
294    
295    
296        /**
297         * Returns
298         * QRD-6: "Deferred Response Date/Time" - creates it if necessary
299         */
300        public TS getQrd6_DeferredResponseDateTime() { 
301            TS ret = null;
302            try {
303                Type t = this.getField(6, 0);
304                ret = (TS)t;
305            } catch (ClassCastException cce) {
306                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
307                throw new RuntimeException(cce);
308            } catch (HL7Exception he) {
309                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
310                throw new RuntimeException(he);
311            }
312            return ret;
313        }
314    
315    
316    
317        /**
318         * Returns
319         * QRD-7: "Quantity Limited Request" - creates it if necessary
320         */
321        public CQ getQuantityLimitedRequest() { 
322            CQ ret = null;
323            try {
324                Type t = this.getField(7, 0);
325                ret = (CQ)t;
326            } catch (ClassCastException cce) {
327                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
328                throw new RuntimeException(cce);
329            } catch (HL7Exception he) {
330                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
331                throw new RuntimeException(he);
332            }
333            return ret;
334        }
335    
336    
337        /**
338         * Returns
339         * QRD-7: "Quantity Limited Request" - creates it if necessary
340         */
341        public CQ getQrd7_QuantityLimitedRequest() { 
342            CQ ret = null;
343            try {
344                Type t = this.getField(7, 0);
345                ret = (CQ)t;
346            } catch (ClassCastException cce) {
347                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
348                throw new RuntimeException(cce);
349            } catch (HL7Exception he) {
350                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
351                throw new RuntimeException(he);
352            }
353            return ret;
354        }
355    
356    
357        /**
358         * Returns all repetitions of Who Subject Filter (QRD-8).
359         */
360        public XCN[] getWhoSubjectFilter() {
361            XCN[] ret = null;
362            try {
363                Type[] t = this.getField(8);  
364                ret = new XCN[t.length];
365                for (int i = 0; i < ret.length; i++) {
366                    ret[i] = (XCN)t[i];
367                }
368            } catch (ClassCastException cce) {
369                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
370                throw new RuntimeException(cce);
371            } catch (HL7Exception he) {
372                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
373                throw new RuntimeException(he);
374            }
375            return ret;
376        }
377    
378    
379        /**
380         * Returns a count of the current number of repetitions of Who Subject Filter (QRD-8).
381         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
382         * it will return zero.
383         */
384        public int getWhoSubjectFilterReps() {
385            XCN[] ret = null;
386            try {
387                Type[] t = this.getField(8);
388                return t.length;  
389            } catch (ClassCastException cce) {
390                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
391                throw new RuntimeException(cce);
392            } catch (HL7Exception he) {
393                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
394                throw new RuntimeException(he);
395            }
396        }
397    
398    
399        /**
400         * Returns a specific repetition of
401         * QRD-8: "Who Subject Filter" - creates it if necessary
402         *
403         * @param rep The repetition index (0-indexed)
404         */
405        public XCN getWhoSubjectFilter(int rep) { 
406            XCN ret = null;
407            try {
408                Type t = this.getField(8, rep);
409                ret = (XCN)t;
410            } catch (ClassCastException cce) {
411                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
412                throw new RuntimeException(cce);
413            } catch (HL7Exception he) {
414                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
415                throw new RuntimeException(he);
416            }
417            return ret;
418        }
419    
420        /**
421         * Returns a specific repetition of
422         * QRD-8: "Who Subject Filter" - creates it if necessary
423         *
424         * @param rep The repetition index (0-indexed)
425         */
426        public XCN getQrd8_WhoSubjectFilter(int rep) { 
427            XCN ret = null;
428            try {
429                Type t = this.getField(8, rep);
430                ret = (XCN)t;
431            } catch (ClassCastException cce) {
432                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
433                throw new RuntimeException(cce);
434            } catch (HL7Exception he) {
435                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
436                throw new RuntimeException(he);
437            }
438            return ret;
439        }
440    
441    
442        /**
443         * Returns a count of the current number of repetitions of Who Subject Filter (QRD-8).
444         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
445         * it will return zero.
446         */
447        public int getQrd8_WhoSubjectFilterReps() {
448            XCN[] ret = null;
449            try {
450                Type[] t = this.getField(8);
451                return t.length;  
452            } catch (ClassCastException cce) {
453                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
454                throw new RuntimeException(cce);
455            } catch (HL7Exception he) {
456                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
457                throw new RuntimeException(he);
458            }
459        }
460    
461    
462    
463        /**
464         * Inserts a repetition of
465         * QRD-8: "Who Subject Filter" at a specific index
466         *
467         * @param rep The repetition index (0-indexed)
468         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
469         */
470        public XCN insertWhoSubjectFilter(int rep) throws HL7Exception { 
471            return (XCN) super.insertRepetition(8, rep);
472        }
473    
474    
475    
476        /**
477         * Inserts a repetition of
478         * QRD-8: "Who Subject Filter" at a specific index
479         *
480         * @param rep The repetition index (0-indexed)
481         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
482         */
483        public XCN insertQrd8_WhoSubjectFilter(int rep) throws HL7Exception { 
484            return (XCN) super.insertRepetition(8, rep);
485        }
486    
487    
488        /**
489         * Removes a repetition of
490         * QRD-8: "Who Subject Filter" at a specific index
491         *
492         * @param rep The repetition index (0-indexed)
493         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
494         */
495        public XCN removeWhoSubjectFilter(int rep) throws HL7Exception { 
496            return (XCN) super.removeRepetition(8, rep);
497        }
498    
499    
500        /**
501         * Removes a repetition of
502         * QRD-8: "Who Subject Filter" at a specific index
503         *
504         * @param rep The repetition index (0-indexed)
505         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
506         */
507        public XCN removeQrd8_WhoSubjectFilter(int rep) throws HL7Exception { 
508            return (XCN) super.removeRepetition(8, rep);
509        }
510    
511    
512    
513        /**
514         * Returns all repetitions of What Subject Filter (QRD-9).
515         */
516        public CE[] getWhatSubjectFilter() {
517            CE[] ret = null;
518            try {
519                Type[] t = this.getField(9);  
520                ret = new CE[t.length];
521                for (int i = 0; i < ret.length; i++) {
522                    ret[i] = (CE)t[i];
523                }
524            } catch (ClassCastException cce) {
525                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
526                throw new RuntimeException(cce);
527            } catch (HL7Exception he) {
528                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
529                throw new RuntimeException(he);
530            }
531            return ret;
532        }
533    
534    
535        /**
536         * Returns a count of the current number of repetitions of What Subject Filter (QRD-9).
537         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
538         * it will return zero.
539         */
540        public int getWhatSubjectFilterReps() {
541            CE[] ret = null;
542            try {
543                Type[] t = this.getField(9);
544                return t.length;  
545            } catch (ClassCastException cce) {
546                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
547                throw new RuntimeException(cce);
548            } catch (HL7Exception he) {
549                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
550                throw new RuntimeException(he);
551            }
552        }
553    
554    
555        /**
556         * Returns a specific repetition of
557         * QRD-9: "What Subject Filter" - creates it if necessary
558         *
559         * @param rep The repetition index (0-indexed)
560         */
561        public CE getWhatSubjectFilter(int rep) { 
562            CE ret = null;
563            try {
564                Type t = this.getField(9, rep);
565                ret = (CE)t;
566            } catch (ClassCastException cce) {
567                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
568                throw new RuntimeException(cce);
569            } catch (HL7Exception he) {
570                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
571                throw new RuntimeException(he);
572            }
573            return ret;
574        }
575    
576        /**
577         * Returns a specific repetition of
578         * QRD-9: "What Subject Filter" - creates it if necessary
579         *
580         * @param rep The repetition index (0-indexed)
581         */
582        public CE getQrd9_WhatSubjectFilter(int rep) { 
583            CE ret = null;
584            try {
585                Type t = this.getField(9, rep);
586                ret = (CE)t;
587            } catch (ClassCastException cce) {
588                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
589                throw new RuntimeException(cce);
590            } catch (HL7Exception he) {
591                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
592                throw new RuntimeException(he);
593            }
594            return ret;
595        }
596    
597    
598        /**
599         * Returns a count of the current number of repetitions of What Subject Filter (QRD-9).
600         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
601         * it will return zero.
602         */
603        public int getQrd9_WhatSubjectFilterReps() {
604            CE[] ret = null;
605            try {
606                Type[] t = this.getField(9);
607                return t.length;  
608            } catch (ClassCastException cce) {
609                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
610                throw new RuntimeException(cce);
611            } catch (HL7Exception he) {
612                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
613                throw new RuntimeException(he);
614            }
615        }
616    
617    
618    
619        /**
620         * Inserts a repetition of
621         * QRD-9: "What Subject Filter" at a specific index
622         *
623         * @param rep The repetition index (0-indexed)
624         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
625         */
626        public CE insertWhatSubjectFilter(int rep) throws HL7Exception { 
627            return (CE) super.insertRepetition(9, rep);
628        }
629    
630    
631    
632        /**
633         * Inserts a repetition of
634         * QRD-9: "What Subject Filter" at a specific index
635         *
636         * @param rep The repetition index (0-indexed)
637         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
638         */
639        public CE insertQrd9_WhatSubjectFilter(int rep) throws HL7Exception { 
640            return (CE) super.insertRepetition(9, rep);
641        }
642    
643    
644        /**
645         * Removes a repetition of
646         * QRD-9: "What Subject Filter" at a specific index
647         *
648         * @param rep The repetition index (0-indexed)
649         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
650         */
651        public CE removeWhatSubjectFilter(int rep) throws HL7Exception { 
652            return (CE) super.removeRepetition(9, rep);
653        }
654    
655    
656        /**
657         * Removes a repetition of
658         * QRD-9: "What Subject Filter" at a specific index
659         *
660         * @param rep The repetition index (0-indexed)
661         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
662         */
663        public CE removeQrd9_WhatSubjectFilter(int rep) throws HL7Exception { 
664            return (CE) super.removeRepetition(9, rep);
665        }
666    
667    
668    
669        /**
670         * Returns all repetitions of What Department Data Code (QRD-10).
671         */
672        public CE[] getWhatDepartmentDataCode() {
673            CE[] ret = null;
674            try {
675                Type[] t = this.getField(10);  
676                ret = new CE[t.length];
677                for (int i = 0; i < ret.length; i++) {
678                    ret[i] = (CE)t[i];
679                }
680            } catch (ClassCastException cce) {
681                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
682                throw new RuntimeException(cce);
683            } catch (HL7Exception he) {
684                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
685                throw new RuntimeException(he);
686            }
687            return ret;
688        }
689    
690    
691        /**
692         * Returns a count of the current number of repetitions of What Department Data Code (QRD-10).
693         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
694         * it will return zero.
695         */
696        public int getWhatDepartmentDataCodeReps() {
697            CE[] ret = null;
698            try {
699                Type[] t = this.getField(10);
700                return t.length;  
701            } catch (ClassCastException cce) {
702                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
703                throw new RuntimeException(cce);
704            } catch (HL7Exception he) {
705                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
706                throw new RuntimeException(he);
707            }
708        }
709    
710    
711        /**
712         * Returns a specific repetition of
713         * QRD-10: "What Department Data Code" - creates it if necessary
714         *
715         * @param rep The repetition index (0-indexed)
716         */
717        public CE getWhatDepartmentDataCode(int rep) { 
718            CE ret = null;
719            try {
720                Type t = this.getField(10, rep);
721                ret = (CE)t;
722            } catch (ClassCastException cce) {
723                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
724                throw new RuntimeException(cce);
725            } catch (HL7Exception he) {
726                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
727                throw new RuntimeException(he);
728            }
729            return ret;
730        }
731    
732        /**
733         * Returns a specific repetition of
734         * QRD-10: "What Department Data Code" - creates it if necessary
735         *
736         * @param rep The repetition index (0-indexed)
737         */
738        public CE getQrd10_WhatDepartmentDataCode(int rep) { 
739            CE ret = null;
740            try {
741                Type t = this.getField(10, rep);
742                ret = (CE)t;
743            } catch (ClassCastException cce) {
744                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
745                throw new RuntimeException(cce);
746            } catch (HL7Exception he) {
747                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
748                throw new RuntimeException(he);
749            }
750            return ret;
751        }
752    
753    
754        /**
755         * Returns a count of the current number of repetitions of What Department Data Code (QRD-10).
756         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
757         * it will return zero.
758         */
759        public int getQrd10_WhatDepartmentDataCodeReps() {
760            CE[] ret = null;
761            try {
762                Type[] t = this.getField(10);
763                return t.length;  
764            } catch (ClassCastException cce) {
765                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
766                throw new RuntimeException(cce);
767            } catch (HL7Exception he) {
768                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
769                throw new RuntimeException(he);
770            }
771        }
772    
773    
774    
775        /**
776         * Inserts a repetition of
777         * QRD-10: "What Department Data Code" at a specific index
778         *
779         * @param rep The repetition index (0-indexed)
780         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
781         */
782        public CE insertWhatDepartmentDataCode(int rep) throws HL7Exception { 
783            return (CE) super.insertRepetition(10, rep);
784        }
785    
786    
787    
788        /**
789         * Inserts a repetition of
790         * QRD-10: "What Department Data Code" at a specific index
791         *
792         * @param rep The repetition index (0-indexed)
793         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
794         */
795        public CE insertQrd10_WhatDepartmentDataCode(int rep) throws HL7Exception { 
796            return (CE) super.insertRepetition(10, rep);
797        }
798    
799    
800        /**
801         * Removes a repetition of
802         * QRD-10: "What Department Data Code" at a specific index
803         *
804         * @param rep The repetition index (0-indexed)
805         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
806         */
807        public CE removeWhatDepartmentDataCode(int rep) throws HL7Exception { 
808            return (CE) super.removeRepetition(10, rep);
809        }
810    
811    
812        /**
813         * Removes a repetition of
814         * QRD-10: "What Department Data Code" at a specific index
815         *
816         * @param rep The repetition index (0-indexed)
817         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
818         */
819        public CE removeQrd10_WhatDepartmentDataCode(int rep) throws HL7Exception { 
820            return (CE) super.removeRepetition(10, rep);
821        }
822    
823    
824    
825        /**
826         * Returns all repetitions of What Data Code Value Qual. (QRD-11).
827         */
828        public VR[] getWhatDataCodeValueQual() {
829            VR[] ret = null;
830            try {
831                Type[] t = this.getField(11);  
832                ret = new VR[t.length];
833                for (int i = 0; i < ret.length; i++) {
834                    ret[i] = (VR)t[i];
835                }
836            } catch (ClassCastException cce) {
837                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
838                throw new RuntimeException(cce);
839            } catch (HL7Exception he) {
840                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
841                throw new RuntimeException(he);
842            }
843            return ret;
844        }
845    
846    
847        /**
848         * Returns a count of the current number of repetitions of What Data Code Value Qual. (QRD-11).
849         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
850         * it will return zero.
851         */
852        public int getWhatDataCodeValueQualReps() {
853            VR[] ret = null;
854            try {
855                Type[] t = this.getField(11);
856                return t.length;  
857            } catch (ClassCastException cce) {
858                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
859                throw new RuntimeException(cce);
860            } catch (HL7Exception he) {
861                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
862                throw new RuntimeException(he);
863            }
864        }
865    
866    
867        /**
868         * Returns a specific repetition of
869         * QRD-11: "What Data Code Value Qual." - creates it if necessary
870         *
871         * @param rep The repetition index (0-indexed)
872         */
873        public VR getWhatDataCodeValueQual(int rep) { 
874            VR ret = null;
875            try {
876                Type t = this.getField(11, rep);
877                ret = (VR)t;
878            } catch (ClassCastException cce) {
879                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
880                throw new RuntimeException(cce);
881            } catch (HL7Exception he) {
882                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
883                throw new RuntimeException(he);
884            }
885            return ret;
886        }
887    
888        /**
889         * Returns a specific repetition of
890         * QRD-11: "What Data Code Value Qual." - creates it if necessary
891         *
892         * @param rep The repetition index (0-indexed)
893         */
894        public VR getQrd11_WhatDataCodeValueQual(int rep) { 
895            VR ret = null;
896            try {
897                Type t = this.getField(11, rep);
898                ret = (VR)t;
899            } catch (ClassCastException cce) {
900                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
901                throw new RuntimeException(cce);
902            } catch (HL7Exception he) {
903                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
904                throw new RuntimeException(he);
905            }
906            return ret;
907        }
908    
909    
910        /**
911         * Returns a count of the current number of repetitions of What Data Code Value Qual. (QRD-11).
912         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
913         * it will return zero.
914         */
915        public int getQrd11_WhatDataCodeValueQualReps() {
916            VR[] ret = null;
917            try {
918                Type[] t = this.getField(11);
919                return t.length;  
920            } catch (ClassCastException cce) {
921                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
922                throw new RuntimeException(cce);
923            } catch (HL7Exception he) {
924                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
925                throw new RuntimeException(he);
926            }
927        }
928    
929    
930    
931        /**
932         * Inserts a repetition of
933         * QRD-11: "What Data Code Value Qual." at a specific index
934         *
935         * @param rep The repetition index (0-indexed)
936         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
937         */
938        public VR insertWhatDataCodeValueQual(int rep) throws HL7Exception { 
939            return (VR) super.insertRepetition(11, rep);
940        }
941    
942    
943    
944        /**
945         * Inserts a repetition of
946         * QRD-11: "What Data Code Value Qual." at a specific index
947         *
948         * @param rep The repetition index (0-indexed)
949         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
950         */
951        public VR insertQrd11_WhatDataCodeValueQual(int rep) throws HL7Exception { 
952            return (VR) super.insertRepetition(11, rep);
953        }
954    
955    
956        /**
957         * Removes a repetition of
958         * QRD-11: "What Data Code Value Qual." at a specific index
959         *
960         * @param rep The repetition index (0-indexed)
961         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
962         */
963        public VR removeWhatDataCodeValueQual(int rep) throws HL7Exception { 
964            return (VR) super.removeRepetition(11, rep);
965        }
966    
967    
968        /**
969         * Removes a repetition of
970         * QRD-11: "What Data Code Value Qual." at a specific index
971         *
972         * @param rep The repetition index (0-indexed)
973         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
974         */
975        public VR removeQrd11_WhatDataCodeValueQual(int rep) throws HL7Exception { 
976            return (VR) super.removeRepetition(11, rep);
977        }
978    
979    
980    
981    
982        /**
983         * Returns
984         * QRD-12: "Query Results Level" - creates it if necessary
985         */
986        public ID getQueryResultsLevel() { 
987            ID ret = null;
988            try {
989                Type t = this.getField(12, 0);
990                ret = (ID)t;
991            } catch (ClassCastException cce) {
992                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
993                throw new RuntimeException(cce);
994            } catch (HL7Exception he) {
995                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
996                throw new RuntimeException(he);
997            }
998            return ret;
999        }
1000    
1001    
1002        /**
1003         * Returns
1004         * QRD-12: "Query Results Level" - creates it if necessary
1005         */
1006        public ID getQrd12_QueryResultsLevel() { 
1007            ID ret = null;
1008            try {
1009                Type t = this.getField(12, 0);
1010                ret = (ID)t;
1011            } catch (ClassCastException cce) {
1012                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1013                throw new RuntimeException(cce);
1014            } catch (HL7Exception he) {
1015                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1016                throw new RuntimeException(he);
1017            }
1018            return ret;
1019        }
1020    
1021    
1022    
1023    
1024    
1025        /** {@inheritDoc} */   
1026        protected Type createNewTypeWithoutReflection(int field) {
1027           switch (field) {
1028              case 0: return new TS(getMessage());
1029              case 1: return new ID(getMessage(), new Integer( 106 ));
1030              case 2: return new ID(getMessage(), new Integer( 91 ));
1031              case 3: return new ST(getMessage());
1032              case 4: return new ID(getMessage(), new Integer( 107 ));
1033              case 5: return new TS(getMessage());
1034              case 6: return new CQ(getMessage());
1035              case 7: return new XCN(getMessage());
1036              case 8: return new CE(getMessage());
1037              case 9: return new CE(getMessage());
1038              case 10: return new VR(getMessage());
1039              case 11: return new ID(getMessage(), new Integer( 108 ));
1040              default: return null;
1041           }
1042       }
1043    
1044    
1045    }
1046