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