001/*
002 * This class is an auto-generated source file for a HAPI
003 * HL7 v2.x standard structure class.
004 *
005 * For more information, visit: http://hl7api.sourceforge.net/
006 * 
007 * The contents of this file are subject to the Mozilla Public License Version 1.1 
008 * (the "License"); you may not use this file except in compliance with the License. 
009 * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
010 * Software distributed under the License is distributed on an "AS IS" basis, 
011 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
012 * specific language governing rights and limitations under the License. 
013 * 
014 * The Original Code is "[file_name]".  Description: 
015 * "[one_line_description]" 
016 * 
017 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
018 * 2012.  All Rights Reserved. 
019 * 
020 * Contributor(s): ______________________________________. 
021 * 
022 * Alternatively, the contents of this file may be used under the terms of the 
023 * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
024 * applicable instead of those above.  If you wish to allow use of your version of this 
025 * file only under the terms of the GPL and not to allow others to use your version 
026 * of this file under the MPL, indicate your decision by deleting  the provisions above 
027 * and replace  them with the notice and other provisions required by the GPL License.  
028 * If you do not delete the provisions above, a recipient may use your version of 
029 * this file under either the MPL or the GPL. 
030 * 
031 */
032
033
034package ca.uhn.hl7v2.model.v231.segment;
035
036// import ca.uhn.hl7v2.model.v231.group.*;
037import ca.uhn.hl7v2.model.v231.datatype.*;
038import ca.uhn.hl7v2.HL7Exception;
039import ca.uhn.hl7v2.parser.ModelClassFactory;
040import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
041import ca.uhn.hl7v2.model.AbstractMessage;
042import ca.uhn.hl7v2.model.Group;
043import ca.uhn.hl7v2.model.Type;
044import ca.uhn.hl7v2.model.AbstractSegment;
045import ca.uhn.hl7v2.model.Varies;
046
047
048/**
049 *<p>Represents an HL7 PDC message segment (PDC - product detail country segment). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>PDC-1: Manufacturer/Distributor (XON) <b> repeating</b>
053     * <li>PDC-2: Country (CE) <b> </b>
054     * <li>PDC-3: Brand Name (ST) <b> </b>
055     * <li>PDC-4: Device Family Name (ST) <b>optional </b>
056     * <li>PDC-5: Generic Name (CE) <b>optional </b>
057     * <li>PDC-6: Model Identifier (ST) <b>optional repeating</b>
058     * <li>PDC-7: Catalogue Identifier (ST) <b>optional </b>
059     * <li>PDC-8: Other Identifier (ST) <b>optional repeating</b>
060     * <li>PDC-9: Product Code (CE) <b>optional </b>
061     * <li>PDC-10: Marketing Basis (ID) <b>optional </b>
062     * <li>PDC-11: Marketing Approval ID (ST) <b>optional </b>
063     * <li>PDC-12: Labeled Shelf Life (CQ) <b>optional </b>
064     * <li>PDC-13: Expected Shelf Life (CQ) <b>optional </b>
065     * <li>PDC-14: Date First Marketed (TS) <b>optional </b>
066     * <li>PDC-15: Date Last Marketed (TS) <b>optional </b>
067 * </ul>
068 */
069@SuppressWarnings("unused")
070public class PDC extends AbstractSegment {
071
072    /** 
073     * Creates a new PDC segment
074     */
075    public PDC(Group parent, ModelClassFactory factory) {
076       super(parent, factory);
077       init(factory);
078    }
079
080    private void init(ModelClassFactory factory) {
081       try {
082                                  this.add(XON.class, true, 0, 80, new Object[]{ getMessage() }, "Manufacturer/Distributor");
083                                  this.add(CE.class, true, 1, 60, new Object[]{ getMessage() }, "Country");
084                                  this.add(ST.class, true, 1, 60, new Object[]{ getMessage() }, "Brand Name");
085                                  this.add(ST.class, false, 1, 60, new Object[]{ getMessage() }, "Device Family Name");
086                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Generic Name");
087                                  this.add(ST.class, false, 0, 60, new Object[]{ getMessage() }, "Model Identifier");
088                                  this.add(ST.class, false, 1, 60, new Object[]{ getMessage() }, "Catalogue Identifier");
089                                  this.add(ST.class, false, 0, 60, new Object[]{ getMessage() }, "Other Identifier");
090                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Product Code");
091                                              this.add(ID.class, false, 1, 4, new Object[]{ getMessage(), new Integer(330) }, "Marketing Basis");
092                                  this.add(ST.class, false, 1, 60, new Object[]{ getMessage() }, "Marketing Approval ID");
093                                  this.add(CQ.class, false, 1, 12, new Object[]{ getMessage() }, "Labeled Shelf Life");
094                                  this.add(CQ.class, false, 1, 12, new Object[]{ getMessage() }, "Expected Shelf Life");
095                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Date First Marketed");
096                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Date Last Marketed");
097       } catch(HL7Exception e) {
098          log.error("Unexpected error creating PDC - this is probably a bug in the source code generator.", e);
099       }
100    }
101
102
103    /**
104     * Returns all repetitions of Manufacturer/Distributor (PDC-1).
105     */
106    public XON[] getManufacturerDistributor() {
107        XON[] retVal = this.getTypedField(1, new XON[0]);
108        return retVal;
109    }
110
111
112    /**
113     * Returns all repetitions of Manufacturer/Distributor (PDC-1).
114     */
115    public XON[] getPdc1_ManufacturerDistributor() {
116        XON[] retVal = this.getTypedField(1, new XON[0]);
117        return retVal;
118    }
119
120
121    /**
122     * Returns a count of the current number of repetitions of Manufacturer/Distributor (PDC-1).
123     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
124     * it will return zero.
125     */
126    public int getManufacturerDistributorReps() {
127        return this.getReps(1);
128    }
129
130
131    /**
132     * Returns a specific repetition of
133     * PDC-1: "Manufacturer/Distributor" - creates it if necessary
134     *
135     * @param rep The repetition index (0-indexed)
136     */
137    public XON getManufacturerDistributor(int rep) { 
138                XON retVal = this.getTypedField(1, rep);
139                return retVal;
140    }
141
142    /**
143     * Returns a specific repetition of
144     * PDC-1: "Manufacturer/Distributor" - creates it if necessary
145     *
146     * @param rep The repetition index (0-indexed)
147     */
148    public XON getPdc1_ManufacturerDistributor(int rep) { 
149                XON retVal = this.getTypedField(1, rep);
150                return retVal;
151    }
152
153    /**
154     * Returns a count of the current number of repetitions of Manufacturer/Distributor (PDC-1).
155     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
156     * it will return zero.
157     */
158    public int getPdc1_ManufacturerDistributorReps() {
159        return this.getReps(1);
160    }
161
162
163    /**
164     * Inserts a repetition of
165     * PDC-1: "Manufacturer/Distributor" at a specific index
166     *
167     * @param rep The repetition index (0-indexed)
168     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
169     */
170    public XON insertManufacturerDistributor(int rep) throws HL7Exception { 
171        return (XON) super.insertRepetition(1, rep);
172    }
173
174
175    /**
176     * Inserts a repetition of
177     * PDC-1: "Manufacturer/Distributor" at a specific index
178     *
179     * @param rep The repetition index (0-indexed)
180     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
181     */
182    public XON insertPdc1_ManufacturerDistributor(int rep) throws HL7Exception { 
183        return (XON) super.insertRepetition(1, rep);
184    }
185
186
187    /**
188     * Removes a repetition of
189     * PDC-1: "Manufacturer/Distributor" at a specific index
190     *
191     * @param rep The repetition index (0-indexed)
192     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
193     */
194    public XON removeManufacturerDistributor(int rep) throws HL7Exception { 
195        return (XON) super.removeRepetition(1, rep);
196    }
197
198
199    /**
200     * Removes a repetition of
201     * PDC-1: "Manufacturer/Distributor" at a specific index
202     *
203     * @param rep The repetition index (0-indexed)
204     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
205     */
206    public XON removePdc1_ManufacturerDistributor(int rep) throws HL7Exception { 
207        return (XON) super.removeRepetition(1, rep);
208    }
209
210
211
212
213    /**
214     * Returns
215     * PDC-2: "Country" - creates it if necessary
216     */
217    public CE getCountry() { 
218                CE retVal = this.getTypedField(2, 0);
219                return retVal;
220    }
221    
222    /**
223     * Returns
224     * PDC-2: "Country" - creates it if necessary
225     */
226    public CE getPdc2_Country() { 
227                CE retVal = this.getTypedField(2, 0);
228                return retVal;
229    }
230
231
232
233    /**
234     * Returns
235     * PDC-3: "Brand Name" - creates it if necessary
236     */
237    public ST getBrandName() { 
238                ST retVal = this.getTypedField(3, 0);
239                return retVal;
240    }
241    
242    /**
243     * Returns
244     * PDC-3: "Brand Name" - creates it if necessary
245     */
246    public ST getPdc3_BrandName() { 
247                ST retVal = this.getTypedField(3, 0);
248                return retVal;
249    }
250
251
252
253    /**
254     * Returns
255     * PDC-4: "Device Family Name" - creates it if necessary
256     */
257    public ST getDeviceFamilyName() { 
258                ST retVal = this.getTypedField(4, 0);
259                return retVal;
260    }
261    
262    /**
263     * Returns
264     * PDC-4: "Device Family Name" - creates it if necessary
265     */
266    public ST getPdc4_DeviceFamilyName() { 
267                ST retVal = this.getTypedField(4, 0);
268                return retVal;
269    }
270
271
272
273    /**
274     * Returns
275     * PDC-5: "Generic Name" - creates it if necessary
276     */
277    public CE getGenericName() { 
278                CE retVal = this.getTypedField(5, 0);
279                return retVal;
280    }
281    
282    /**
283     * Returns
284     * PDC-5: "Generic Name" - creates it if necessary
285     */
286    public CE getPdc5_GenericName() { 
287                CE retVal = this.getTypedField(5, 0);
288                return retVal;
289    }
290
291
292    /**
293     * Returns all repetitions of Model Identifier (PDC-6).
294     */
295    public ST[] getModelIdentifier() {
296        ST[] retVal = this.getTypedField(6, new ST[0]);
297        return retVal;
298    }
299
300
301    /**
302     * Returns all repetitions of Model Identifier (PDC-6).
303     */
304    public ST[] getPdc6_ModelIdentifier() {
305        ST[] retVal = this.getTypedField(6, new ST[0]);
306        return retVal;
307    }
308
309
310    /**
311     * Returns a count of the current number of repetitions of Model Identifier (PDC-6).
312     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
313     * it will return zero.
314     */
315    public int getModelIdentifierReps() {
316        return this.getReps(6);
317    }
318
319
320    /**
321     * Returns a specific repetition of
322     * PDC-6: "Model Identifier" - creates it if necessary
323     *
324     * @param rep The repetition index (0-indexed)
325     */
326    public ST getModelIdentifier(int rep) { 
327                ST retVal = this.getTypedField(6, rep);
328                return retVal;
329    }
330
331    /**
332     * Returns a specific repetition of
333     * PDC-6: "Model Identifier" - creates it if necessary
334     *
335     * @param rep The repetition index (0-indexed)
336     */
337    public ST getPdc6_ModelIdentifier(int rep) { 
338                ST retVal = this.getTypedField(6, rep);
339                return retVal;
340    }
341
342    /**
343     * Returns a count of the current number of repetitions of Model Identifier (PDC-6).
344     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
345     * it will return zero.
346     */
347    public int getPdc6_ModelIdentifierReps() {
348        return this.getReps(6);
349    }
350
351
352    /**
353     * Inserts a repetition of
354     * PDC-6: "Model Identifier" at a specific index
355     *
356     * @param rep The repetition index (0-indexed)
357     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
358     */
359    public ST insertModelIdentifier(int rep) throws HL7Exception { 
360        return (ST) super.insertRepetition(6, rep);
361    }
362
363
364    /**
365     * Inserts a repetition of
366     * PDC-6: "Model Identifier" at a specific index
367     *
368     * @param rep The repetition index (0-indexed)
369     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
370     */
371    public ST insertPdc6_ModelIdentifier(int rep) throws HL7Exception { 
372        return (ST) super.insertRepetition(6, rep);
373    }
374
375
376    /**
377     * Removes a repetition of
378     * PDC-6: "Model Identifier" at a specific index
379     *
380     * @param rep The repetition index (0-indexed)
381     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
382     */
383    public ST removeModelIdentifier(int rep) throws HL7Exception { 
384        return (ST) super.removeRepetition(6, rep);
385    }
386
387
388    /**
389     * Removes a repetition of
390     * PDC-6: "Model Identifier" at a specific index
391     *
392     * @param rep The repetition index (0-indexed)
393     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
394     */
395    public ST removePdc6_ModelIdentifier(int rep) throws HL7Exception { 
396        return (ST) super.removeRepetition(6, rep);
397    }
398
399
400
401
402    /**
403     * Returns
404     * PDC-7: "Catalogue Identifier" - creates it if necessary
405     */
406    public ST getCatalogueIdentifier() { 
407                ST retVal = this.getTypedField(7, 0);
408                return retVal;
409    }
410    
411    /**
412     * Returns
413     * PDC-7: "Catalogue Identifier" - creates it if necessary
414     */
415    public ST getPdc7_CatalogueIdentifier() { 
416                ST retVal = this.getTypedField(7, 0);
417                return retVal;
418    }
419
420
421    /**
422     * Returns all repetitions of Other Identifier (PDC-8).
423     */
424    public ST[] getOtherIdentifier() {
425        ST[] retVal = this.getTypedField(8, new ST[0]);
426        return retVal;
427    }
428
429
430    /**
431     * Returns all repetitions of Other Identifier (PDC-8).
432     */
433    public ST[] getPdc8_OtherIdentifier() {
434        ST[] retVal = this.getTypedField(8, new ST[0]);
435        return retVal;
436    }
437
438
439    /**
440     * Returns a count of the current number of repetitions of Other Identifier (PDC-8).
441     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
442     * it will return zero.
443     */
444    public int getOtherIdentifierReps() {
445        return this.getReps(8);
446    }
447
448
449    /**
450     * Returns a specific repetition of
451     * PDC-8: "Other Identifier" - creates it if necessary
452     *
453     * @param rep The repetition index (0-indexed)
454     */
455    public ST getOtherIdentifier(int rep) { 
456                ST retVal = this.getTypedField(8, rep);
457                return retVal;
458    }
459
460    /**
461     * Returns a specific repetition of
462     * PDC-8: "Other Identifier" - creates it if necessary
463     *
464     * @param rep The repetition index (0-indexed)
465     */
466    public ST getPdc8_OtherIdentifier(int rep) { 
467                ST retVal = this.getTypedField(8, rep);
468                return retVal;
469    }
470
471    /**
472     * Returns a count of the current number of repetitions of Other Identifier (PDC-8).
473     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
474     * it will return zero.
475     */
476    public int getPdc8_OtherIdentifierReps() {
477        return this.getReps(8);
478    }
479
480
481    /**
482     * Inserts a repetition of
483     * PDC-8: "Other Identifier" at a specific index
484     *
485     * @param rep The repetition index (0-indexed)
486     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
487     */
488    public ST insertOtherIdentifier(int rep) throws HL7Exception { 
489        return (ST) super.insertRepetition(8, rep);
490    }
491
492
493    /**
494     * Inserts a repetition of
495     * PDC-8: "Other Identifier" at a specific index
496     *
497     * @param rep The repetition index (0-indexed)
498     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
499     */
500    public ST insertPdc8_OtherIdentifier(int rep) throws HL7Exception { 
501        return (ST) super.insertRepetition(8, rep);
502    }
503
504
505    /**
506     * Removes a repetition of
507     * PDC-8: "Other Identifier" at a specific index
508     *
509     * @param rep The repetition index (0-indexed)
510     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
511     */
512    public ST removeOtherIdentifier(int rep) throws HL7Exception { 
513        return (ST) super.removeRepetition(8, rep);
514    }
515
516
517    /**
518     * Removes a repetition of
519     * PDC-8: "Other Identifier" at a specific index
520     *
521     * @param rep The repetition index (0-indexed)
522     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
523     */
524    public ST removePdc8_OtherIdentifier(int rep) throws HL7Exception { 
525        return (ST) super.removeRepetition(8, rep);
526    }
527
528
529
530
531    /**
532     * Returns
533     * PDC-9: "Product Code" - creates it if necessary
534     */
535    public CE getProductCode() { 
536                CE retVal = this.getTypedField(9, 0);
537                return retVal;
538    }
539    
540    /**
541     * Returns
542     * PDC-9: "Product Code" - creates it if necessary
543     */
544    public CE getPdc9_ProductCode() { 
545                CE retVal = this.getTypedField(9, 0);
546                return retVal;
547    }
548
549
550
551    /**
552     * Returns
553     * PDC-10: "Marketing Basis" - creates it if necessary
554     */
555    public ID getMarketingBasis() { 
556                ID retVal = this.getTypedField(10, 0);
557                return retVal;
558    }
559    
560    /**
561     * Returns
562     * PDC-10: "Marketing Basis" - creates it if necessary
563     */
564    public ID getPdc10_MarketingBasis() { 
565                ID retVal = this.getTypedField(10, 0);
566                return retVal;
567    }
568
569
570
571    /**
572     * Returns
573     * PDC-11: "Marketing Approval ID" - creates it if necessary
574     */
575    public ST getMarketingApprovalID() { 
576                ST retVal = this.getTypedField(11, 0);
577                return retVal;
578    }
579    
580    /**
581     * Returns
582     * PDC-11: "Marketing Approval ID" - creates it if necessary
583     */
584    public ST getPdc11_MarketingApprovalID() { 
585                ST retVal = this.getTypedField(11, 0);
586                return retVal;
587    }
588
589
590
591    /**
592     * Returns
593     * PDC-12: "Labeled Shelf Life" - creates it if necessary
594     */
595    public CQ getLabeledShelfLife() { 
596                CQ retVal = this.getTypedField(12, 0);
597                return retVal;
598    }
599    
600    /**
601     * Returns
602     * PDC-12: "Labeled Shelf Life" - creates it if necessary
603     */
604    public CQ getPdc12_LabeledShelfLife() { 
605                CQ retVal = this.getTypedField(12, 0);
606                return retVal;
607    }
608
609
610
611    /**
612     * Returns
613     * PDC-13: "Expected Shelf Life" - creates it if necessary
614     */
615    public CQ getExpectedShelfLife() { 
616                CQ retVal = this.getTypedField(13, 0);
617                return retVal;
618    }
619    
620    /**
621     * Returns
622     * PDC-13: "Expected Shelf Life" - creates it if necessary
623     */
624    public CQ getPdc13_ExpectedShelfLife() { 
625                CQ retVal = this.getTypedField(13, 0);
626                return retVal;
627    }
628
629
630
631    /**
632     * Returns
633     * PDC-14: "Date First Marketed" - creates it if necessary
634     */
635    public TS getDateFirstMarketed() { 
636                TS retVal = this.getTypedField(14, 0);
637                return retVal;
638    }
639    
640    /**
641     * Returns
642     * PDC-14: "Date First Marketed" - creates it if necessary
643     */
644    public TS getPdc14_DateFirstMarketed() { 
645                TS retVal = this.getTypedField(14, 0);
646                return retVal;
647    }
648
649
650
651    /**
652     * Returns
653     * PDC-15: "Date Last Marketed" - creates it if necessary
654     */
655    public TS getDateLastMarketed() { 
656                TS retVal = this.getTypedField(15, 0);
657                return retVal;
658    }
659    
660    /**
661     * Returns
662     * PDC-15: "Date Last Marketed" - creates it if necessary
663     */
664    public TS getPdc15_DateLastMarketed() { 
665                TS retVal = this.getTypedField(15, 0);
666                return retVal;
667    }
668
669
670
671
672
673    /** {@inheritDoc} */   
674    protected Type createNewTypeWithoutReflection(int field) {
675       switch (field) {
676          case 0: return new XON(getMessage());
677          case 1: return new CE(getMessage());
678          case 2: return new ST(getMessage());
679          case 3: return new ST(getMessage());
680          case 4: return new CE(getMessage());
681          case 5: return new ST(getMessage());
682          case 6: return new ST(getMessage());
683          case 7: return new ST(getMessage());
684          case 8: return new CE(getMessage());
685          case 9: return new ID(getMessage(), new Integer( 330 ));
686          case 10: return new ST(getMessage());
687          case 11: return new CQ(getMessage());
688          case 12: return new CQ(getMessage());
689          case 13: return new TS(getMessage());
690          case 14: return new TS(getMessage());
691          default: return null;
692       }
693   }
694
695
696}
697