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