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 PSH message segment (Product Summary Header). 
024     * This segment has the following fields:</p>
025     * <ul>
026         * <li>PSH-1: Report Type (ST) <b> </b>
027         * <li>PSH-2: Report Form Identifier (ST) <b>optional </b>
028         * <li>PSH-3: Report Date (TS) <b> </b>
029         * <li>PSH-4: Report Interval Start Date (TS) <b>optional </b>
030         * <li>PSH-5: Report Interval End Date (TS) <b>optional </b>
031         * <li>PSH-6: Quantity Manufactured (CQ) <b>optional </b>
032         * <li>PSH-7: Quantity Distributed (CQ) <b>optional </b>
033         * <li>PSH-8: Quantity Distributed Method (ID) <b>optional </b>
034         * <li>PSH-9: Quantity Distributed Comment (FT) <b>optional </b>
035         * <li>PSH-10: Quantity in Use (CQ) <b>optional </b>
036         * <li>PSH-11: Quantity in Use Method (ID) <b>optional </b>
037         * <li>PSH-12: Quantity in Use Comment (FT) <b>optional </b>
038         * <li>PSH-13: Number of Product Experience Reports Filed by Facility (NM) <b>optional repeating</b>
039         * <li>PSH-14: Number of Product Experience Reports Filed by Distributor (NM) <b>optional repeating</b>
040     * </ul>
041     */
042    public class PSH extends AbstractSegment {
043    
044        /** 
045         * Creates a new PSH segment
046         */
047        public PSH(Group parent, ModelClassFactory factory) {
048           super(parent, factory);
049           init(factory);
050        }
051    
052        private void init(ModelClassFactory factory) {
053           try {
054                                      this.add(ST.class, true, 1, 60, new Object[]{ getMessage(), new Integer(0) }, "Report Type");
055                                      this.add(ST.class, false, 1, 60, new Object[]{ getMessage(), new Integer(0) }, "Report Form Identifier");
056                                      this.add(TS.class, true, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Report Date");
057                                      this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Report Interval Start Date");
058                                      this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Report Interval End Date");
059                                      this.add(CQ.class, false, 1, 12, new Object[]{ getMessage(), new Integer(0) }, "Quantity Manufactured");
060                                      this.add(CQ.class, false, 1, 12, new Object[]{ getMessage(), new Integer(0) }, "Quantity Distributed");
061                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Quantity Distributed Method");
062                                      this.add(FT.class, false, 1, 600, new Object[]{ getMessage(), new Integer(0) }, "Quantity Distributed Comment");
063                                      this.add(CQ.class, false, 1, 12, new Object[]{ getMessage(), new Integer(0) }, "Quantity in Use");
064                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Quantity in Use Method");
065                                      this.add(FT.class, false, 1, 600, new Object[]{ getMessage(), new Integer(0) }, "Quantity in Use Comment");
066                                      this.add(NM.class, false, 8, 2, new Object[]{ getMessage(), new Integer(0) }, "Number of Product Experience Reports Filed by Facility");
067                                      this.add(NM.class, false, 8, 2, new Object[]{ getMessage(), new Integer(0) }, "Number of Product Experience Reports Filed by Distributor");
068           } catch(HL7Exception e) {
069              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating PSH - this is probably a bug in the source code generator.", e);
070           }
071        }
072    
073    
074    
075        /**
076         * Returns
077         * PSH-1: "Report Type" - creates it if necessary
078         */
079        public ST getReportType() { 
080            ST ret = null;
081            try {
082                Type t = this.getField(1, 0);
083                ret = (ST)t;
084            } catch (ClassCastException cce) {
085                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
086                throw new RuntimeException(cce);
087            } catch (HL7Exception he) {
088                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
089                throw new RuntimeException(he);
090            }
091            return ret;
092        }
093    
094    
095        /**
096         * Returns
097         * PSH-1: "Report Type" - creates it if necessary
098         */
099        public ST getPsh1_ReportType() { 
100            ST ret = null;
101            try {
102                Type t = this.getField(1, 0);
103                ret = (ST)t;
104            } catch (ClassCastException cce) {
105                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
106                throw new RuntimeException(cce);
107            } catch (HL7Exception he) {
108                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
109                throw new RuntimeException(he);
110            }
111            return ret;
112        }
113    
114    
115    
116        /**
117         * Returns
118         * PSH-2: "Report Form Identifier" - creates it if necessary
119         */
120        public ST getReportFormIdentifier() { 
121            ST ret = null;
122            try {
123                Type t = this.getField(2, 0);
124                ret = (ST)t;
125            } catch (ClassCastException cce) {
126                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
127                throw new RuntimeException(cce);
128            } catch (HL7Exception he) {
129                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
130                throw new RuntimeException(he);
131            }
132            return ret;
133        }
134    
135    
136        /**
137         * Returns
138         * PSH-2: "Report Form Identifier" - creates it if necessary
139         */
140        public ST getPsh2_ReportFormIdentifier() { 
141            ST ret = null;
142            try {
143                Type t = this.getField(2, 0);
144                ret = (ST)t;
145            } catch (ClassCastException cce) {
146                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
147                throw new RuntimeException(cce);
148            } catch (HL7Exception he) {
149                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
150                throw new RuntimeException(he);
151            }
152            return ret;
153        }
154    
155    
156    
157        /**
158         * Returns
159         * PSH-3: "Report Date" - creates it if necessary
160         */
161        public TS getReportDate() { 
162            TS ret = null;
163            try {
164                Type t = this.getField(3, 0);
165                ret = (TS)t;
166            } catch (ClassCastException cce) {
167                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
168                throw new RuntimeException(cce);
169            } catch (HL7Exception he) {
170                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
171                throw new RuntimeException(he);
172            }
173            return ret;
174        }
175    
176    
177        /**
178         * Returns
179         * PSH-3: "Report Date" - creates it if necessary
180         */
181        public TS getPsh3_ReportDate() { 
182            TS ret = null;
183            try {
184                Type t = this.getField(3, 0);
185                ret = (TS)t;
186            } catch (ClassCastException cce) {
187                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
188                throw new RuntimeException(cce);
189            } catch (HL7Exception he) {
190                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
191                throw new RuntimeException(he);
192            }
193            return ret;
194        }
195    
196    
197    
198        /**
199         * Returns
200         * PSH-4: "Report Interval Start Date" - creates it if necessary
201         */
202        public TS getReportIntervalStartDate() { 
203            TS ret = null;
204            try {
205                Type t = this.getField(4, 0);
206                ret = (TS)t;
207            } catch (ClassCastException cce) {
208                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
209                throw new RuntimeException(cce);
210            } catch (HL7Exception he) {
211                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
212                throw new RuntimeException(he);
213            }
214            return ret;
215        }
216    
217    
218        /**
219         * Returns
220         * PSH-4: "Report Interval Start Date" - creates it if necessary
221         */
222        public TS getPsh4_ReportIntervalStartDate() { 
223            TS ret = null;
224            try {
225                Type t = this.getField(4, 0);
226                ret = (TS)t;
227            } catch (ClassCastException cce) {
228                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
229                throw new RuntimeException(cce);
230            } catch (HL7Exception he) {
231                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
232                throw new RuntimeException(he);
233            }
234            return ret;
235        }
236    
237    
238    
239        /**
240         * Returns
241         * PSH-5: "Report Interval End Date" - creates it if necessary
242         */
243        public TS getReportIntervalEndDate() { 
244            TS ret = null;
245            try {
246                Type t = this.getField(5, 0);
247                ret = (TS)t;
248            } catch (ClassCastException cce) {
249                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
250                throw new RuntimeException(cce);
251            } catch (HL7Exception he) {
252                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
253                throw new RuntimeException(he);
254            }
255            return ret;
256        }
257    
258    
259        /**
260         * Returns
261         * PSH-5: "Report Interval End Date" - creates it if necessary
262         */
263        public TS getPsh5_ReportIntervalEndDate() { 
264            TS ret = null;
265            try {
266                Type t = this.getField(5, 0);
267                ret = (TS)t;
268            } catch (ClassCastException cce) {
269                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
270                throw new RuntimeException(cce);
271            } catch (HL7Exception he) {
272                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
273                throw new RuntimeException(he);
274            }
275            return ret;
276        }
277    
278    
279    
280        /**
281         * Returns
282         * PSH-6: "Quantity Manufactured" - creates it if necessary
283         */
284        public CQ getQuantityManufactured() { 
285            CQ ret = null;
286            try {
287                Type t = this.getField(6, 0);
288                ret = (CQ)t;
289            } catch (ClassCastException cce) {
290                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
291                throw new RuntimeException(cce);
292            } catch (HL7Exception he) {
293                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
294                throw new RuntimeException(he);
295            }
296            return ret;
297        }
298    
299    
300        /**
301         * Returns
302         * PSH-6: "Quantity Manufactured" - creates it if necessary
303         */
304        public CQ getPsh6_QuantityManufactured() { 
305            CQ ret = null;
306            try {
307                Type t = this.getField(6, 0);
308                ret = (CQ)t;
309            } catch (ClassCastException cce) {
310                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
311                throw new RuntimeException(cce);
312            } catch (HL7Exception he) {
313                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
314                throw new RuntimeException(he);
315            }
316            return ret;
317        }
318    
319    
320    
321        /**
322         * Returns
323         * PSH-7: "Quantity Distributed" - creates it if necessary
324         */
325        public CQ getQuantityDistributed() { 
326            CQ ret = null;
327            try {
328                Type t = this.getField(7, 0);
329                ret = (CQ)t;
330            } catch (ClassCastException cce) {
331                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
332                throw new RuntimeException(cce);
333            } catch (HL7Exception he) {
334                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
335                throw new RuntimeException(he);
336            }
337            return ret;
338        }
339    
340    
341        /**
342         * Returns
343         * PSH-7: "Quantity Distributed" - creates it if necessary
344         */
345        public CQ getPsh7_QuantityDistributed() { 
346            CQ ret = null;
347            try {
348                Type t = this.getField(7, 0);
349                ret = (CQ)t;
350            } catch (ClassCastException cce) {
351                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
352                throw new RuntimeException(cce);
353            } catch (HL7Exception he) {
354                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
355                throw new RuntimeException(he);
356            }
357            return ret;
358        }
359    
360    
361    
362        /**
363         * Returns
364         * PSH-8: "Quantity Distributed Method" - creates it if necessary
365         */
366        public ID getQuantityDistributedMethod() { 
367            ID ret = null;
368            try {
369                Type t = this.getField(8, 0);
370                ret = (ID)t;
371            } catch (ClassCastException cce) {
372                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
373                throw new RuntimeException(cce);
374            } catch (HL7Exception he) {
375                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
376                throw new RuntimeException(he);
377            }
378            return ret;
379        }
380    
381    
382        /**
383         * Returns
384         * PSH-8: "Quantity Distributed Method" - creates it if necessary
385         */
386        public ID getPsh8_QuantityDistributedMethod() { 
387            ID ret = null;
388            try {
389                Type t = this.getField(8, 0);
390                ret = (ID)t;
391            } catch (ClassCastException cce) {
392                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
393                throw new RuntimeException(cce);
394            } catch (HL7Exception he) {
395                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
396                throw new RuntimeException(he);
397            }
398            return ret;
399        }
400    
401    
402    
403        /**
404         * Returns
405         * PSH-9: "Quantity Distributed Comment" - creates it if necessary
406         */
407        public FT getQuantityDistributedComment() { 
408            FT ret = null;
409            try {
410                Type t = this.getField(9, 0);
411                ret = (FT)t;
412            } catch (ClassCastException cce) {
413                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
414                throw new RuntimeException(cce);
415            } catch (HL7Exception he) {
416                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
417                throw new RuntimeException(he);
418            }
419            return ret;
420        }
421    
422    
423        /**
424         * Returns
425         * PSH-9: "Quantity Distributed Comment" - creates it if necessary
426         */
427        public FT getPsh9_QuantityDistributedComment() { 
428            FT ret = null;
429            try {
430                Type t = this.getField(9, 0);
431                ret = (FT)t;
432            } catch (ClassCastException cce) {
433                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
434                throw new RuntimeException(cce);
435            } catch (HL7Exception he) {
436                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
437                throw new RuntimeException(he);
438            }
439            return ret;
440        }
441    
442    
443    
444        /**
445         * Returns
446         * PSH-10: "Quantity in Use" - creates it if necessary
447         */
448        public CQ getQuantityInUse() { 
449            CQ ret = null;
450            try {
451                Type t = this.getField(10, 0);
452                ret = (CQ)t;
453            } catch (ClassCastException cce) {
454                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
455                throw new RuntimeException(cce);
456            } catch (HL7Exception he) {
457                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
458                throw new RuntimeException(he);
459            }
460            return ret;
461        }
462    
463    
464        /**
465         * Returns
466         * PSH-10: "Quantity in Use" - creates it if necessary
467         */
468        public CQ getPsh10_QuantityInUse() { 
469            CQ ret = null;
470            try {
471                Type t = this.getField(10, 0);
472                ret = (CQ)t;
473            } catch (ClassCastException cce) {
474                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
475                throw new RuntimeException(cce);
476            } catch (HL7Exception he) {
477                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
478                throw new RuntimeException(he);
479            }
480            return ret;
481        }
482    
483    
484    
485        /**
486         * Returns
487         * PSH-11: "Quantity in Use Method" - creates it if necessary
488         */
489        public ID getQuantityInUseMethod() { 
490            ID ret = null;
491            try {
492                Type t = this.getField(11, 0);
493                ret = (ID)t;
494            } catch (ClassCastException cce) {
495                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
496                throw new RuntimeException(cce);
497            } catch (HL7Exception he) {
498                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
499                throw new RuntimeException(he);
500            }
501            return ret;
502        }
503    
504    
505        /**
506         * Returns
507         * PSH-11: "Quantity in Use Method" - creates it if necessary
508         */
509        public ID getPsh11_QuantityInUseMethod() { 
510            ID ret = null;
511            try {
512                Type t = this.getField(11, 0);
513                ret = (ID)t;
514            } catch (ClassCastException cce) {
515                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
516                throw new RuntimeException(cce);
517            } catch (HL7Exception he) {
518                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
519                throw new RuntimeException(he);
520            }
521            return ret;
522        }
523    
524    
525    
526        /**
527         * Returns
528         * PSH-12: "Quantity in Use Comment" - creates it if necessary
529         */
530        public FT getQuantityInUseComment() { 
531            FT ret = null;
532            try {
533                Type t = this.getField(12, 0);
534                ret = (FT)t;
535            } catch (ClassCastException cce) {
536                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
537                throw new RuntimeException(cce);
538            } catch (HL7Exception he) {
539                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
540                throw new RuntimeException(he);
541            }
542            return ret;
543        }
544    
545    
546        /**
547         * Returns
548         * PSH-12: "Quantity in Use Comment" - creates it if necessary
549         */
550        public FT getPsh12_QuantityInUseComment() { 
551            FT ret = null;
552            try {
553                Type t = this.getField(12, 0);
554                ret = (FT)t;
555            } catch (ClassCastException cce) {
556                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
557                throw new RuntimeException(cce);
558            } catch (HL7Exception he) {
559                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
560                throw new RuntimeException(he);
561            }
562            return ret;
563        }
564    
565    
566        /**
567         * Returns all repetitions of Number of Product Experience Reports Filed by Facility (PSH-13).
568         */
569        public NM[] getNumberOfProductExperienceReportsFiledByFacility() {
570            NM[] ret = null;
571            try {
572                Type[] t = this.getField(13);  
573                ret = new NM[t.length];
574                for (int i = 0; i < ret.length; i++) {
575                    ret[i] = (NM)t[i];
576                }
577            } catch (ClassCastException cce) {
578                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
579                throw new RuntimeException(cce);
580            } catch (HL7Exception he) {
581                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
582                throw new RuntimeException(he);
583            }
584            return ret;
585        }
586    
587    
588        /**
589         * Returns a count of the current number of repetitions of Number of Product Experience Reports Filed by Facility (PSH-13).
590         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
591         * it will return zero.
592         */
593        public int getNumberOfProductExperienceReportsFiledByFacilityReps() {
594            NM[] ret = null;
595            try {
596                Type[] t = this.getField(13);
597                return t.length;  
598            } catch (ClassCastException cce) {
599                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
600                throw new RuntimeException(cce);
601            } catch (HL7Exception he) {
602                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
603                throw new RuntimeException(he);
604            }
605        }
606    
607    
608        /**
609         * Returns a specific repetition of
610         * PSH-13: "Number of Product Experience Reports Filed by Facility" - creates it if necessary
611         *
612         * @param rep The repetition index (0-indexed)
613         */
614        public NM getNumberOfProductExperienceReportsFiledByFacility(int rep) { 
615            NM ret = null;
616            try {
617                Type t = this.getField(13, rep);
618                ret = (NM)t;
619            } catch (ClassCastException cce) {
620                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
621                throw new RuntimeException(cce);
622            } catch (HL7Exception he) {
623                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
624                throw new RuntimeException(he);
625            }
626            return ret;
627        }
628    
629        /**
630         * Returns a specific repetition of
631         * PSH-13: "Number of Product Experience Reports Filed by Facility" - creates it if necessary
632         *
633         * @param rep The repetition index (0-indexed)
634         */
635        public NM getPsh13_NumberOfProductExperienceReportsFiledByFacility(int rep) { 
636            NM ret = null;
637            try {
638                Type t = this.getField(13, rep);
639                ret = (NM)t;
640            } catch (ClassCastException cce) {
641                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
642                throw new RuntimeException(cce);
643            } catch (HL7Exception he) {
644                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
645                throw new RuntimeException(he);
646            }
647            return ret;
648        }
649    
650    
651        /**
652         * Returns a count of the current number of repetitions of Number of Product Experience Reports Filed by Facility (PSH-13).
653         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
654         * it will return zero.
655         */
656        public int getPsh13_NumberOfProductExperienceReportsFiledByFacilityReps() {
657            NM[] ret = null;
658            try {
659                Type[] t = this.getField(13);
660                return t.length;  
661            } catch (ClassCastException cce) {
662                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
663                throw new RuntimeException(cce);
664            } catch (HL7Exception he) {
665                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
666                throw new RuntimeException(he);
667            }
668        }
669    
670    
671    
672        /**
673         * Inserts a repetition of
674         * PSH-13: "Number of Product Experience Reports Filed by Facility" at a specific index
675         *
676         * @param rep The repetition index (0-indexed)
677         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
678         */
679        public NM insertNumberOfProductExperienceReportsFiledByFacility(int rep) throws HL7Exception { 
680            return (NM) super.insertRepetition(13, rep);
681        }
682    
683    
684    
685        /**
686         * Inserts a repetition of
687         * PSH-13: "Number of Product Experience Reports Filed by Facility" at a specific index
688         *
689         * @param rep The repetition index (0-indexed)
690         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
691         */
692        public NM insertPsh13_NumberOfProductExperienceReportsFiledByFacility(int rep) throws HL7Exception { 
693            return (NM) super.insertRepetition(13, rep);
694        }
695    
696    
697        /**
698         * Removes a repetition of
699         * PSH-13: "Number of Product Experience Reports Filed by Facility" at a specific index
700         *
701         * @param rep The repetition index (0-indexed)
702         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
703         */
704        public NM removeNumberOfProductExperienceReportsFiledByFacility(int rep) throws HL7Exception { 
705            return (NM) super.removeRepetition(13, rep);
706        }
707    
708    
709        /**
710         * Removes a repetition of
711         * PSH-13: "Number of Product Experience Reports Filed by Facility" at a specific index
712         *
713         * @param rep The repetition index (0-indexed)
714         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
715         */
716        public NM removePsh13_NumberOfProductExperienceReportsFiledByFacility(int rep) throws HL7Exception { 
717            return (NM) super.removeRepetition(13, rep);
718        }
719    
720    
721    
722        /**
723         * Returns all repetitions of Number of Product Experience Reports Filed by Distributor (PSH-14).
724         */
725        public NM[] getNumberOfProductExperienceReportsFiledByDistributor() {
726            NM[] ret = null;
727            try {
728                Type[] t = this.getField(14);  
729                ret = new NM[t.length];
730                for (int i = 0; i < ret.length; i++) {
731                    ret[i] = (NM)t[i];
732                }
733            } catch (ClassCastException cce) {
734                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
735                throw new RuntimeException(cce);
736            } catch (HL7Exception he) {
737                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
738                throw new RuntimeException(he);
739            }
740            return ret;
741        }
742    
743    
744        /**
745         * Returns a count of the current number of repetitions of Number of Product Experience Reports Filed by Distributor (PSH-14).
746         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
747         * it will return zero.
748         */
749        public int getNumberOfProductExperienceReportsFiledByDistributorReps() {
750            NM[] ret = null;
751            try {
752                Type[] t = this.getField(14);
753                return t.length;  
754            } catch (ClassCastException cce) {
755                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
756                throw new RuntimeException(cce);
757            } catch (HL7Exception he) {
758                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
759                throw new RuntimeException(he);
760            }
761        }
762    
763    
764        /**
765         * Returns a specific repetition of
766         * PSH-14: "Number of Product Experience Reports Filed by Distributor" - creates it if necessary
767         *
768         * @param rep The repetition index (0-indexed)
769         */
770        public NM getNumberOfProductExperienceReportsFiledByDistributor(int rep) { 
771            NM ret = null;
772            try {
773                Type t = this.getField(14, rep);
774                ret = (NM)t;
775            } catch (ClassCastException cce) {
776                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
777                throw new RuntimeException(cce);
778            } catch (HL7Exception he) {
779                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
780                throw new RuntimeException(he);
781            }
782            return ret;
783        }
784    
785        /**
786         * Returns a specific repetition of
787         * PSH-14: "Number of Product Experience Reports Filed by Distributor" - creates it if necessary
788         *
789         * @param rep The repetition index (0-indexed)
790         */
791        public NM getPsh14_NumberOfProductExperienceReportsFiledByDistributor(int rep) { 
792            NM ret = null;
793            try {
794                Type t = this.getField(14, rep);
795                ret = (NM)t;
796            } catch (ClassCastException cce) {
797                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
798                throw new RuntimeException(cce);
799            } catch (HL7Exception he) {
800                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
801                throw new RuntimeException(he);
802            }
803            return ret;
804        }
805    
806    
807        /**
808         * Returns a count of the current number of repetitions of Number of Product Experience Reports Filed by Distributor (PSH-14).
809         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
810         * it will return zero.
811         */
812        public int getPsh14_NumberOfProductExperienceReportsFiledByDistributorReps() {
813            NM[] ret = null;
814            try {
815                Type[] t = this.getField(14);
816                return t.length;  
817            } catch (ClassCastException cce) {
818                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
819                throw new RuntimeException(cce);
820            } catch (HL7Exception he) {
821                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
822                throw new RuntimeException(he);
823            }
824        }
825    
826    
827    
828        /**
829         * Inserts a repetition of
830         * PSH-14: "Number of Product Experience Reports Filed by Distributor" at a specific index
831         *
832         * @param rep The repetition index (0-indexed)
833         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
834         */
835        public NM insertNumberOfProductExperienceReportsFiledByDistributor(int rep) throws HL7Exception { 
836            return (NM) super.insertRepetition(14, rep);
837        }
838    
839    
840    
841        /**
842         * Inserts a repetition of
843         * PSH-14: "Number of Product Experience Reports Filed by Distributor" at a specific index
844         *
845         * @param rep The repetition index (0-indexed)
846         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
847         */
848        public NM insertPsh14_NumberOfProductExperienceReportsFiledByDistributor(int rep) throws HL7Exception { 
849            return (NM) super.insertRepetition(14, rep);
850        }
851    
852    
853        /**
854         * Removes a repetition of
855         * PSH-14: "Number of Product Experience Reports Filed by Distributor" at a specific index
856         *
857         * @param rep The repetition index (0-indexed)
858         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
859         */
860        public NM removeNumberOfProductExperienceReportsFiledByDistributor(int rep) throws HL7Exception { 
861            return (NM) super.removeRepetition(14, rep);
862        }
863    
864    
865        /**
866         * Removes a repetition of
867         * PSH-14: "Number of Product Experience Reports Filed by Distributor" at a specific index
868         *
869         * @param rep The repetition index (0-indexed)
870         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
871         */
872        public NM removePsh14_NumberOfProductExperienceReportsFiledByDistributor(int rep) throws HL7Exception { 
873            return (NM) super.removeRepetition(14, rep);
874        }
875    
876    
877    
878    
879    
880    
881        /** {@inheritDoc} */   
882        protected Type createNewTypeWithoutReflection(int field) {
883           switch (field) {
884              case 0: return new ST(getMessage());
885              case 1: return new ST(getMessage());
886              case 2: return new TS(getMessage());
887              case 3: return new TS(getMessage());
888              case 4: return new TS(getMessage());
889              case 5: return new CQ(getMessage());
890              case 6: return new CQ(getMessage());
891              case 7: return new ID(getMessage(), new Integer( 329 ));
892              case 8: return new FT(getMessage());
893              case 9: return new CQ(getMessage());
894              case 10: return new ID(getMessage(), new Integer( 329 ));
895              case 11: return new FT(getMessage());
896              case 12: return new NM(getMessage());
897              case 13: return new NM(getMessage());
898              default: return null;
899           }
900       }
901    
902    
903    }
904