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.v26.segment;
035
036// import ca.uhn.hl7v2.model.v26.group.*;
037import ca.uhn.hl7v2.model.v26.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 ROL message segment (Role). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>ROL-1: Role Instance ID (EI) <b>optional </b>
053     * <li>ROL-2: Action Code (ID) <b> </b>
054     * <li>ROL-3: Role-ROL (CWE) <b> </b>
055     * <li>ROL-4: Role Person (XCN) <b> repeating</b>
056     * <li>ROL-5: Role Begin Date/Time (DTM) <b>optional </b>
057     * <li>ROL-6: Role End Date/Time (DTM) <b>optional </b>
058     * <li>ROL-7: Role Duration (CWE) <b>optional </b>
059     * <li>ROL-8: Role Action Reason (CWE) <b>optional </b>
060     * <li>ROL-9: Provider Type (CWE) <b>optional repeating</b>
061     * <li>ROL-10: Organization Unit Type (CWE) <b>optional </b>
062     * <li>ROL-11: Office/Home Address/Birthplace (XAD) <b>optional repeating</b>
063     * <li>ROL-12: Phone (XTN) <b>optional repeating</b>
064     * <li>ROL-13: Person's Location (PL) <b>optional </b>
065 * </ul>
066 */
067@SuppressWarnings("unused")
068public class ROL extends AbstractSegment {
069
070    /** 
071     * Creates a new ROL segment
072     */
073    public ROL(Group parent, ModelClassFactory factory) {
074       super(parent, factory);
075       init(factory);
076    }
077
078    private void init(ModelClassFactory factory) {
079       try {
080                                  this.add(EI.class, false, 1, 60, new Object[]{ getMessage() }, "Role Instance ID");
081                                              this.add(ID.class, true, 1, 2, new Object[]{ getMessage(), new Integer(287) }, "Action Code");
082                                  this.add(CWE.class, true, 1, 250, new Object[]{ getMessage() }, "Role-ROL");
083                                  this.add(XCN.class, true, 0, 250, new Object[]{ getMessage() }, "Role Person");
084                                  this.add(DTM.class, false, 1, 24, new Object[]{ getMessage() }, "Role Begin Date/Time");
085                                  this.add(DTM.class, false, 1, 24, new Object[]{ getMessage() }, "Role End Date/Time");
086                                  this.add(CWE.class, false, 1, 250, new Object[]{ getMessage() }, "Role Duration");
087                                  this.add(CWE.class, false, 1, 250, new Object[]{ getMessage() }, "Role Action Reason");
088                                  this.add(CWE.class, false, 0, 250, new Object[]{ getMessage() }, "Provider Type");
089                                  this.add(CWE.class, false, 1, 250, new Object[]{ getMessage() }, "Organization Unit Type");
090                                  this.add(XAD.class, false, 0, 250, new Object[]{ getMessage() }, "Office/Home Address/Birthplace");
091                                  this.add(XTN.class, false, 0, 250, new Object[]{ getMessage() }, "Phone");
092                                  this.add(PL.class, false, 1, 1230, new Object[]{ getMessage() }, "Person's Location");
093       } catch(HL7Exception e) {
094          log.error("Unexpected error creating ROL - this is probably a bug in the source code generator.", e);
095       }
096    }
097
098
099
100    /**
101     * Returns
102     * ROL-1: "Role Instance ID" - creates it if necessary
103     */
104    public EI getRoleInstanceID() { 
105                EI retVal = this.getTypedField(1, 0);
106                return retVal;
107    }
108    
109    /**
110     * Returns
111     * ROL-1: "Role Instance ID" - creates it if necessary
112     */
113    public EI getRol1_RoleInstanceID() { 
114                EI retVal = this.getTypedField(1, 0);
115                return retVal;
116    }
117
118
119
120    /**
121     * Returns
122     * ROL-2: "Action Code" - creates it if necessary
123     */
124    public ID getActionCode() { 
125                ID retVal = this.getTypedField(2, 0);
126                return retVal;
127    }
128    
129    /**
130     * Returns
131     * ROL-2: "Action Code" - creates it if necessary
132     */
133    public ID getRol2_ActionCode() { 
134                ID retVal = this.getTypedField(2, 0);
135                return retVal;
136    }
137
138
139
140    /**
141     * Returns
142     * ROL-3: "Role-ROL" - creates it if necessary
143     */
144    public CWE getRoleROL() { 
145                CWE retVal = this.getTypedField(3, 0);
146                return retVal;
147    }
148    
149    /**
150     * Returns
151     * ROL-3: "Role-ROL" - creates it if necessary
152     */
153    public CWE getRol3_RoleROL() { 
154                CWE retVal = this.getTypedField(3, 0);
155                return retVal;
156    }
157
158
159    /**
160     * Returns all repetitions of Role Person (ROL-4).
161     */
162    public XCN[] getRolePerson() {
163        XCN[] retVal = this.getTypedField(4, new XCN[0]);
164        return retVal;
165    }
166
167
168    /**
169     * Returns all repetitions of Role Person (ROL-4).
170     */
171    public XCN[] getRol4_RolePerson() {
172        XCN[] retVal = this.getTypedField(4, new XCN[0]);
173        return retVal;
174    }
175
176
177    /**
178     * Returns a count of the current number of repetitions of Role Person (ROL-4).
179     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
180     * it will return zero.
181     */
182    public int getRolePersonReps() {
183        return this.getReps(4);
184    }
185
186
187    /**
188     * Returns a specific repetition of
189     * ROL-4: "Role Person" - creates it if necessary
190     *
191     * @param rep The repetition index (0-indexed)
192     */
193    public XCN getRolePerson(int rep) { 
194                XCN retVal = this.getTypedField(4, rep);
195                return retVal;
196    }
197
198    /**
199     * Returns a specific repetition of
200     * ROL-4: "Role Person" - creates it if necessary
201     *
202     * @param rep The repetition index (0-indexed)
203     */
204    public XCN getRol4_RolePerson(int rep) { 
205                XCN retVal = this.getTypedField(4, rep);
206                return retVal;
207    }
208
209    /**
210     * Returns a count of the current number of repetitions of Role Person (ROL-4).
211     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
212     * it will return zero.
213     */
214    public int getRol4_RolePersonReps() {
215        return this.getReps(4);
216    }
217
218
219    /**
220     * Inserts a repetition of
221     * ROL-4: "Role Person" at a specific index
222     *
223     * @param rep The repetition index (0-indexed)
224     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
225     */
226    public XCN insertRolePerson(int rep) throws HL7Exception { 
227        return (XCN) super.insertRepetition(4, rep);
228    }
229
230
231    /**
232     * Inserts a repetition of
233     * ROL-4: "Role Person" at a specific index
234     *
235     * @param rep The repetition index (0-indexed)
236     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
237     */
238    public XCN insertRol4_RolePerson(int rep) throws HL7Exception { 
239        return (XCN) super.insertRepetition(4, rep);
240    }
241
242
243    /**
244     * Removes a repetition of
245     * ROL-4: "Role Person" at a specific index
246     *
247     * @param rep The repetition index (0-indexed)
248     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
249     */
250    public XCN removeRolePerson(int rep) throws HL7Exception { 
251        return (XCN) super.removeRepetition(4, rep);
252    }
253
254
255    /**
256     * Removes a repetition of
257     * ROL-4: "Role Person" at a specific index
258     *
259     * @param rep The repetition index (0-indexed)
260     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
261     */
262    public XCN removeRol4_RolePerson(int rep) throws HL7Exception { 
263        return (XCN) super.removeRepetition(4, rep);
264    }
265
266
267
268
269    /**
270     * Returns
271     * ROL-5: "Role Begin Date/Time" - creates it if necessary
272     */
273    public DTM getRoleBeginDateTime() { 
274                DTM retVal = this.getTypedField(5, 0);
275                return retVal;
276    }
277    
278    /**
279     * Returns
280     * ROL-5: "Role Begin Date/Time" - creates it if necessary
281     */
282    public DTM getRol5_RoleBeginDateTime() { 
283                DTM retVal = this.getTypedField(5, 0);
284                return retVal;
285    }
286
287
288
289    /**
290     * Returns
291     * ROL-6: "Role End Date/Time" - creates it if necessary
292     */
293    public DTM getRoleEndDateTime() { 
294                DTM retVal = this.getTypedField(6, 0);
295                return retVal;
296    }
297    
298    /**
299     * Returns
300     * ROL-6: "Role End Date/Time" - creates it if necessary
301     */
302    public DTM getRol6_RoleEndDateTime() { 
303                DTM retVal = this.getTypedField(6, 0);
304                return retVal;
305    }
306
307
308
309    /**
310     * Returns
311     * ROL-7: "Role Duration" - creates it if necessary
312     */
313    public CWE getRoleDuration() { 
314                CWE retVal = this.getTypedField(7, 0);
315                return retVal;
316    }
317    
318    /**
319     * Returns
320     * ROL-7: "Role Duration" - creates it if necessary
321     */
322    public CWE getRol7_RoleDuration() { 
323                CWE retVal = this.getTypedField(7, 0);
324                return retVal;
325    }
326
327
328
329    /**
330     * Returns
331     * ROL-8: "Role Action Reason" - creates it if necessary
332     */
333    public CWE getRoleActionReason() { 
334                CWE retVal = this.getTypedField(8, 0);
335                return retVal;
336    }
337    
338    /**
339     * Returns
340     * ROL-8: "Role Action Reason" - creates it if necessary
341     */
342    public CWE getRol8_RoleActionReason() { 
343                CWE retVal = this.getTypedField(8, 0);
344                return retVal;
345    }
346
347
348    /**
349     * Returns all repetitions of Provider Type (ROL-9).
350     */
351    public CWE[] getProviderType() {
352        CWE[] retVal = this.getTypedField(9, new CWE[0]);
353        return retVal;
354    }
355
356
357    /**
358     * Returns all repetitions of Provider Type (ROL-9).
359     */
360    public CWE[] getRol9_ProviderType() {
361        CWE[] retVal = this.getTypedField(9, new CWE[0]);
362        return retVal;
363    }
364
365
366    /**
367     * Returns a count of the current number of repetitions of Provider Type (ROL-9).
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 getProviderTypeReps() {
372        return this.getReps(9);
373    }
374
375
376    /**
377     * Returns a specific repetition of
378     * ROL-9: "Provider Type" - creates it if necessary
379     *
380     * @param rep The repetition index (0-indexed)
381     */
382    public CWE getProviderType(int rep) { 
383                CWE retVal = this.getTypedField(9, rep);
384                return retVal;
385    }
386
387    /**
388     * Returns a specific repetition of
389     * ROL-9: "Provider Type" - creates it if necessary
390     *
391     * @param rep The repetition index (0-indexed)
392     */
393    public CWE getRol9_ProviderType(int rep) { 
394                CWE retVal = this.getTypedField(9, rep);
395                return retVal;
396    }
397
398    /**
399     * Returns a count of the current number of repetitions of Provider Type (ROL-9).
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 getRol9_ProviderTypeReps() {
404        return this.getReps(9);
405    }
406
407
408    /**
409     * Inserts a repetition of
410     * ROL-9: "Provider Type" 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 CWE insertProviderType(int rep) throws HL7Exception { 
416        return (CWE) super.insertRepetition(9, rep);
417    }
418
419
420    /**
421     * Inserts a repetition of
422     * ROL-9: "Provider Type" 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 CWE insertRol9_ProviderType(int rep) throws HL7Exception { 
428        return (CWE) super.insertRepetition(9, rep);
429    }
430
431
432    /**
433     * Removes a repetition of
434     * ROL-9: "Provider Type" 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 CWE removeProviderType(int rep) throws HL7Exception { 
440        return (CWE) super.removeRepetition(9, rep);
441    }
442
443
444    /**
445     * Removes a repetition of
446     * ROL-9: "Provider Type" 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 CWE removeRol9_ProviderType(int rep) throws HL7Exception { 
452        return (CWE) super.removeRepetition(9, rep);
453    }
454
455
456
457
458    /**
459     * Returns
460     * ROL-10: "Organization Unit Type" - creates it if necessary
461     */
462    public CWE getOrganizationUnitType() { 
463                CWE retVal = this.getTypedField(10, 0);
464                return retVal;
465    }
466    
467    /**
468     * Returns
469     * ROL-10: "Organization Unit Type" - creates it if necessary
470     */
471    public CWE getRol10_OrganizationUnitType() { 
472                CWE retVal = this.getTypedField(10, 0);
473                return retVal;
474    }
475
476
477    /**
478     * Returns all repetitions of Office/Home Address/Birthplace (ROL-11).
479     */
480    public XAD[] getOfficeHomeAddressBirthplace() {
481        XAD[] retVal = this.getTypedField(11, new XAD[0]);
482        return retVal;
483    }
484
485
486    /**
487     * Returns all repetitions of Office/Home Address/Birthplace (ROL-11).
488     */
489    public XAD[] getRol11_OfficeHomeAddressBirthplace() {
490        XAD[] retVal = this.getTypedField(11, new XAD[0]);
491        return retVal;
492    }
493
494
495    /**
496     * Returns a count of the current number of repetitions of Office/Home Address/Birthplace (ROL-11).
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 getOfficeHomeAddressBirthplaceReps() {
501        return this.getReps(11);
502    }
503
504
505    /**
506     * Returns a specific repetition of
507     * ROL-11: "Office/Home Address/Birthplace" - creates it if necessary
508     *
509     * @param rep The repetition index (0-indexed)
510     */
511    public XAD getOfficeHomeAddressBirthplace(int rep) { 
512                XAD retVal = this.getTypedField(11, rep);
513                return retVal;
514    }
515
516    /**
517     * Returns a specific repetition of
518     * ROL-11: "Office/Home Address/Birthplace" - creates it if necessary
519     *
520     * @param rep The repetition index (0-indexed)
521     */
522    public XAD getRol11_OfficeHomeAddressBirthplace(int rep) { 
523                XAD retVal = this.getTypedField(11, rep);
524                return retVal;
525    }
526
527    /**
528     * Returns a count of the current number of repetitions of Office/Home Address/Birthplace (ROL-11).
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 getRol11_OfficeHomeAddressBirthplaceReps() {
533        return this.getReps(11);
534    }
535
536
537    /**
538     * Inserts a repetition of
539     * ROL-11: "Office/Home Address/Birthplace" 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 XAD insertOfficeHomeAddressBirthplace(int rep) throws HL7Exception { 
545        return (XAD) super.insertRepetition(11, rep);
546    }
547
548
549    /**
550     * Inserts a repetition of
551     * ROL-11: "Office/Home Address/Birthplace" 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 XAD insertRol11_OfficeHomeAddressBirthplace(int rep) throws HL7Exception { 
557        return (XAD) super.insertRepetition(11, rep);
558    }
559
560
561    /**
562     * Removes a repetition of
563     * ROL-11: "Office/Home Address/Birthplace" 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 XAD removeOfficeHomeAddressBirthplace(int rep) throws HL7Exception { 
569        return (XAD) super.removeRepetition(11, rep);
570    }
571
572
573    /**
574     * Removes a repetition of
575     * ROL-11: "Office/Home Address/Birthplace" 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 XAD removeRol11_OfficeHomeAddressBirthplace(int rep) throws HL7Exception { 
581        return (XAD) super.removeRepetition(11, rep);
582    }
583
584
585
586    /**
587     * Returns all repetitions of Phone (ROL-12).
588     */
589    public XTN[] getPhone() {
590        XTN[] retVal = this.getTypedField(12, new XTN[0]);
591        return retVal;
592    }
593
594
595    /**
596     * Returns all repetitions of Phone (ROL-12).
597     */
598    public XTN[] getRol12_Phone() {
599        XTN[] retVal = this.getTypedField(12, new XTN[0]);
600        return retVal;
601    }
602
603
604    /**
605     * Returns a count of the current number of repetitions of Phone (ROL-12).
606     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
607     * it will return zero.
608     */
609    public int getPhoneReps() {
610        return this.getReps(12);
611    }
612
613
614    /**
615     * Returns a specific repetition of
616     * ROL-12: "Phone" - creates it if necessary
617     *
618     * @param rep The repetition index (0-indexed)
619     */
620    public XTN getPhone(int rep) { 
621                XTN retVal = this.getTypedField(12, rep);
622                return retVal;
623    }
624
625    /**
626     * Returns a specific repetition of
627     * ROL-12: "Phone" - creates it if necessary
628     *
629     * @param rep The repetition index (0-indexed)
630     */
631    public XTN getRol12_Phone(int rep) { 
632                XTN retVal = this.getTypedField(12, rep);
633                return retVal;
634    }
635
636    /**
637     * Returns a count of the current number of repetitions of Phone (ROL-12).
638     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
639     * it will return zero.
640     */
641    public int getRol12_PhoneReps() {
642        return this.getReps(12);
643    }
644
645
646    /**
647     * Inserts a repetition of
648     * ROL-12: "Phone" at a specific index
649     *
650     * @param rep The repetition index (0-indexed)
651     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
652     */
653    public XTN insertPhone(int rep) throws HL7Exception { 
654        return (XTN) super.insertRepetition(12, rep);
655    }
656
657
658    /**
659     * Inserts a repetition of
660     * ROL-12: "Phone" at a specific index
661     *
662     * @param rep The repetition index (0-indexed)
663     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
664     */
665    public XTN insertRol12_Phone(int rep) throws HL7Exception { 
666        return (XTN) super.insertRepetition(12, rep);
667    }
668
669
670    /**
671     * Removes a repetition of
672     * ROL-12: "Phone" at a specific index
673     *
674     * @param rep The repetition index (0-indexed)
675     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
676     */
677    public XTN removePhone(int rep) throws HL7Exception { 
678        return (XTN) super.removeRepetition(12, rep);
679    }
680
681
682    /**
683     * Removes a repetition of
684     * ROL-12: "Phone" at a specific index
685     *
686     * @param rep The repetition index (0-indexed)
687     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
688     */
689    public XTN removeRol12_Phone(int rep) throws HL7Exception { 
690        return (XTN) super.removeRepetition(12, rep);
691    }
692
693
694
695
696    /**
697     * Returns
698     * ROL-13: "Person's Location" - creates it if necessary
699     */
700    public PL getPersonSLocation() { 
701                PL retVal = this.getTypedField(13, 0);
702                return retVal;
703    }
704    
705    /**
706     * Returns
707     * ROL-13: "Person's Location" - creates it if necessary
708     */
709    public PL getRol13_PersonSLocation() { 
710                PL retVal = this.getTypedField(13, 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 EI(getMessage());
722          case 1: return new ID(getMessage(), new Integer( 287 ));
723          case 2: return new CWE(getMessage());
724          case 3: return new XCN(getMessage());
725          case 4: return new DTM(getMessage());
726          case 5: return new DTM(getMessage());
727          case 6: return new CWE(getMessage());
728          case 7: return new CWE(getMessage());
729          case 8: return new CWE(getMessage());
730          case 9: return new CWE(getMessage());
731          case 10: return new XAD(getMessage());
732          case 11: return new XTN(getMessage());
733          case 12: return new PL(getMessage());
734          default: return null;
735       }
736   }
737
738
739}
740