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