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