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.v23.segment;
035
036// import ca.uhn.hl7v2.model.v23.group.*;
037import ca.uhn.hl7v2.model.v23.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: 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 </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 (CM_PI) <b>optional repeating</b>
058     * <li>PRD-8: Effective Start Date of Role (TS) <b>optional </b>
059     * <li>PRD-9: Effective End Date of 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() }, "Role");
076                                  this.add(XPN.class, false, 0, 106, new Object[]{ getMessage() }, "Provider Name");
077                                  this.add(XAD.class, false, 1, 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, 20, new Object[]{ getMessage() }, "Provider Communication Information");
080                                  this.add(CE.class, false, 1, 200, new Object[]{ getMessage() }, "Preferred Method of Contact");
081                                  this.add(CM_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 Role");
083                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Effective End Date of 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 Role (PRD-1).
092     */
093    public CE[] getRole() {
094        CE[] retVal = this.getTypedField(1, new CE[0]);
095        return retVal;
096    }
097
098
099    /**
100     * Returns all repetitions of Role (PRD-1).
101     */
102    public CE[] getPrd1_Role() {
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 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 getRoleReps() {
114        return this.getReps(1);
115    }
116
117
118    /**
119     * Returns a specific repetition of
120     * PRD-1: "Role" - creates it if necessary
121     *
122     * @param rep The repetition index (0-indexed)
123     */
124    public CE getRole(int rep) { 
125                CE retVal = this.getTypedField(1, rep);
126                return retVal;
127    }
128
129    /**
130     * Returns a specific repetition of
131     * PRD-1: "Role" - creates it if necessary
132     *
133     * @param rep The repetition index (0-indexed)
134     */
135    public CE getPrd1_Role(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 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_RoleReps() {
146        return this.getReps(1);
147    }
148
149
150    /**
151     * Inserts a repetition of
152     * PRD-1: "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 insertRole(int rep) throws HL7Exception { 
158        return (CE) super.insertRepetition(1, rep);
159    }
160
161
162    /**
163     * Inserts a repetition of
164     * PRD-1: "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_Role(int rep) throws HL7Exception { 
170        return (CE) super.insertRepetition(1, rep);
171    }
172
173
174    /**
175     * Removes a repetition of
176     * PRD-1: "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 removeRole(int rep) throws HL7Exception { 
182        return (CE) super.removeRepetition(1, rep);
183    }
184
185
186    /**
187     * Removes a repetition of
188     * PRD-1: "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_Role(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    /**
310     * Returns
311     * PRD-3: "Provider Address" - creates it if necessary
312     */
313    public XAD getProviderAddress() { 
314                XAD retVal = this.getTypedField(3, 0);
315                return retVal;
316    }
317    
318    /**
319     * Returns
320     * PRD-3: "Provider Address" - creates it if necessary
321     */
322    public XAD getPrd3_ProviderAddress() { 
323                XAD retVal = this.getTypedField(3, 0);
324                return retVal;
325    }
326
327
328
329    /**
330     * Returns
331     * PRD-4: "Provider Location" - creates it if necessary
332     */
333    public PL getProviderLocation() { 
334                PL retVal = this.getTypedField(4, 0);
335                return retVal;
336    }
337    
338    /**
339     * Returns
340     * PRD-4: "Provider Location" - creates it if necessary
341     */
342    public PL getPrd4_ProviderLocation() { 
343                PL retVal = this.getTypedField(4, 0);
344                return retVal;
345    }
346
347
348    /**
349     * Returns all repetitions of Provider Communication Information (PRD-5).
350     */
351    public XTN[] getProviderCommunicationInformation() {
352        XTN[] retVal = this.getTypedField(5, new XTN[0]);
353        return retVal;
354    }
355
356
357    /**
358     * Returns all repetitions of Provider Communication Information (PRD-5).
359     */
360    public XTN[] getPrd5_ProviderCommunicationInformation() {
361        XTN[] retVal = this.getTypedField(5, new XTN[0]);
362        return retVal;
363    }
364
365
366    /**
367     * Returns a count of the current number of repetitions of Provider Communication Information (PRD-5).
368     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
369     * it will return zero.
370     */
371    public int getProviderCommunicationInformationReps() {
372        return this.getReps(5);
373    }
374
375
376    /**
377     * Returns a specific repetition of
378     * PRD-5: "Provider Communication Information" - creates it if necessary
379     *
380     * @param rep The repetition index (0-indexed)
381     */
382    public XTN getProviderCommunicationInformation(int rep) { 
383                XTN retVal = this.getTypedField(5, rep);
384                return retVal;
385    }
386
387    /**
388     * Returns a specific repetition of
389     * PRD-5: "Provider Communication Information" - creates it if necessary
390     *
391     * @param rep The repetition index (0-indexed)
392     */
393    public XTN getPrd5_ProviderCommunicationInformation(int rep) { 
394                XTN retVal = this.getTypedField(5, rep);
395                return retVal;
396    }
397
398    /**
399     * Returns a count of the current number of repetitions of Provider Communication Information (PRD-5).
400     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
401     * it will return zero.
402     */
403    public int getPrd5_ProviderCommunicationInformationReps() {
404        return this.getReps(5);
405    }
406
407
408    /**
409     * Inserts a repetition of
410     * PRD-5: "Provider Communication Information" at a specific index
411     *
412     * @param rep The repetition index (0-indexed)
413     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
414     */
415    public XTN insertProviderCommunicationInformation(int rep) throws HL7Exception { 
416        return (XTN) super.insertRepetition(5, rep);
417    }
418
419
420    /**
421     * Inserts a repetition of
422     * PRD-5: "Provider Communication Information" at a specific index
423     *
424     * @param rep The repetition index (0-indexed)
425     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
426     */
427    public XTN insertPrd5_ProviderCommunicationInformation(int rep) throws HL7Exception { 
428        return (XTN) super.insertRepetition(5, rep);
429    }
430
431
432    /**
433     * Removes a repetition of
434     * PRD-5: "Provider Communication Information" at a specific index
435     *
436     * @param rep The repetition index (0-indexed)
437     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
438     */
439    public XTN removeProviderCommunicationInformation(int rep) throws HL7Exception { 
440        return (XTN) super.removeRepetition(5, rep);
441    }
442
443
444    /**
445     * Removes a repetition of
446     * PRD-5: "Provider Communication Information" at a specific index
447     *
448     * @param rep The repetition index (0-indexed)
449     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
450     */
451    public XTN removePrd5_ProviderCommunicationInformation(int rep) throws HL7Exception { 
452        return (XTN) super.removeRepetition(5, rep);
453    }
454
455
456
457
458    /**
459     * Returns
460     * PRD-6: "Preferred Method of Contact" - creates it if necessary
461     */
462    public CE getPreferredMethodOfContact() { 
463                CE retVal = this.getTypedField(6, 0);
464                return retVal;
465    }
466    
467    /**
468     * Returns
469     * PRD-6: "Preferred Method of Contact" - creates it if necessary
470     */
471    public CE getPrd6_PreferredMethodOfContact() { 
472                CE retVal = this.getTypedField(6, 0);
473                return retVal;
474    }
475
476
477    /**
478     * Returns all repetitions of Provider Identifiers (PRD-7).
479     */
480    public CM_PI[] getProviderIdentifiers() {
481        CM_PI[] retVal = this.getTypedField(7, new CM_PI[0]);
482        return retVal;
483    }
484
485
486    /**
487     * Returns all repetitions of Provider Identifiers (PRD-7).
488     */
489    public CM_PI[] getPrd7_ProviderIdentifiers() {
490        CM_PI[] retVal = this.getTypedField(7, new CM_PI[0]);
491        return retVal;
492    }
493
494
495    /**
496     * Returns a count of the current number of repetitions of Provider Identifiers (PRD-7).
497     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
498     * it will return zero.
499     */
500    public int getProviderIdentifiersReps() {
501        return this.getReps(7);
502    }
503
504
505    /**
506     * Returns a specific repetition of
507     * PRD-7: "Provider Identifiers" - creates it if necessary
508     *
509     * @param rep The repetition index (0-indexed)
510     */
511    public CM_PI getProviderIdentifiers(int rep) { 
512                CM_PI retVal = this.getTypedField(7, rep);
513                return retVal;
514    }
515
516    /**
517     * Returns a specific repetition of
518     * PRD-7: "Provider Identifiers" - creates it if necessary
519     *
520     * @param rep The repetition index (0-indexed)
521     */
522    public CM_PI getPrd7_ProviderIdentifiers(int rep) { 
523                CM_PI retVal = this.getTypedField(7, rep);
524                return retVal;
525    }
526
527    /**
528     * Returns a count of the current number of repetitions of Provider Identifiers (PRD-7).
529     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
530     * it will return zero.
531     */
532    public int getPrd7_ProviderIdentifiersReps() {
533        return this.getReps(7);
534    }
535
536
537    /**
538     * Inserts a repetition of
539     * PRD-7: "Provider Identifiers" at a specific index
540     *
541     * @param rep The repetition index (0-indexed)
542     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
543     */
544    public CM_PI insertProviderIdentifiers(int rep) throws HL7Exception { 
545        return (CM_PI) super.insertRepetition(7, rep);
546    }
547
548
549    /**
550     * Inserts a repetition of
551     * PRD-7: "Provider Identifiers" at a specific index
552     *
553     * @param rep The repetition index (0-indexed)
554     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
555     */
556    public CM_PI insertPrd7_ProviderIdentifiers(int rep) throws HL7Exception { 
557        return (CM_PI) super.insertRepetition(7, rep);
558    }
559
560
561    /**
562     * Removes a repetition of
563     * PRD-7: "Provider Identifiers" at a specific index
564     *
565     * @param rep The repetition index (0-indexed)
566     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
567     */
568    public CM_PI removeProviderIdentifiers(int rep) throws HL7Exception { 
569        return (CM_PI) super.removeRepetition(7, rep);
570    }
571
572
573    /**
574     * Removes a repetition of
575     * PRD-7: "Provider Identifiers" at a specific index
576     *
577     * @param rep The repetition index (0-indexed)
578     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
579     */
580    public CM_PI removePrd7_ProviderIdentifiers(int rep) throws HL7Exception { 
581        return (CM_PI) super.removeRepetition(7, rep);
582    }
583
584
585
586
587    /**
588     * Returns
589     * PRD-8: "Effective Start Date of Role" - creates it if necessary
590     */
591    public TS getEffectiveStartDateOfRole() { 
592                TS retVal = this.getTypedField(8, 0);
593                return retVal;
594    }
595    
596    /**
597     * Returns
598     * PRD-8: "Effective Start Date of Role" - creates it if necessary
599     */
600    public TS getPrd8_EffectiveStartDateOfRole() { 
601                TS retVal = this.getTypedField(8, 0);
602                return retVal;
603    }
604
605
606
607    /**
608     * Returns
609     * PRD-9: "Effective End Date of Role" - creates it if necessary
610     */
611    public TS getEffectiveEndDateOfRole() { 
612                TS retVal = this.getTypedField(9, 0);
613                return retVal;
614    }
615    
616    /**
617     * Returns
618     * PRD-9: "Effective End Date of Role" - creates it if necessary
619     */
620    public TS getPrd9_EffectiveEndDateOfRole() { 
621                TS retVal = this.getTypedField(9, 0);
622                return retVal;
623    }
624
625
626
627
628
629    /** {@inheritDoc} */   
630    protected Type createNewTypeWithoutReflection(int field) {
631       switch (field) {
632          case 0: return new CE(getMessage());
633          case 1: return new XPN(getMessage());
634          case 2: return new XAD(getMessage());
635          case 3: return new PL(getMessage());
636          case 4: return new XTN(getMessage());
637          case 5: return new CE(getMessage());
638          case 6: return new CM_PI(getMessage());
639          case 7: return new TS(getMessage());
640          case 8: return new TS(getMessage());
641          default: return null;
642       }
643   }
644
645
646}
647