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