1 /* 2 * This class is an auto-generated source file for a HAPI 3 * HL7 v2.x standard structure class. 4 * 5 * For more information, visit: http://hl7api.sourceforge.net/ 6 * 7 * The contents of this file are subject to the Mozilla Public License Version 1.1 8 * (the "License"); you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 10 * Software distributed under the License is distributed on an "AS IS" basis, 11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 12 * specific language governing rights and limitations under the License. 13 * 14 * The Original Code is "[file_name]". Description: 15 * "[one_line_description]" 16 * 17 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 18 * 2012. All Rights Reserved. 19 * 20 * Contributor(s): ______________________________________. 21 * 22 * Alternatively, the contents of this file may be used under the terms of the 23 * GNU General Public License (the "GPL"), in which case the provisions of the GPL are 24 * applicable instead of those above. If you wish to allow use of your version of this 25 * file only under the terms of the GPL and not to allow others to use your version 26 * of this file under the MPL, indicate your decision by deleting the provisions above 27 * and replace them with the notice and other provisions required by the GPL License. 28 * If you do not delete the provisions above, a recipient may use your version of 29 * this file under either the MPL or the GPL. 30 * 31 */ 32 33 34 package ca.uhn.hl7v2.model.v24.segment; 35 36 // import ca.uhn.hl7v2.model.v24.group.*; 37 import ca.uhn.hl7v2.model.v24.datatype.*; 38 import ca.uhn.hl7v2.HL7Exception; 39 import ca.uhn.hl7v2.parser.ModelClassFactory; 40 import ca.uhn.hl7v2.parser.DefaultModelClassFactory; 41 import ca.uhn.hl7v2.model.AbstractMessage; 42 import ca.uhn.hl7v2.model.Group; 43 import ca.uhn.hl7v2.model.Type; 44 import ca.uhn.hl7v2.model.AbstractSegment; 45 import ca.uhn.hl7v2.model.Varies; 46 47 48 /** 49 *<p>Represents an HL7 ROL message segment (Role). 50 * This segment has the following fields:</p> 51 * <ul> 52 * <li>ROL-1: Role Instance ID (EI) <b>optional </b> 53 * <li>ROL-2: Action Code (ID) <b> </b> 54 * <li>ROL-3: Role-ROL (CE) <b> </b> 55 * <li>ROL-4: Role Person (XCN) <b> repeating</b> 56 * <li>ROL-5: Role Begin Date/Time (TS) <b>optional </b> 57 * <li>ROL-6: Role End Date/Time (TS) <b>optional </b> 58 * <li>ROL-7: Role Duration (CE) <b>optional </b> 59 * <li>ROL-8: Role Action Reason (CE) <b>optional </b> 60 * <li>ROL-9: Provider Type (CE) <b>optional repeating</b> 61 * <li>ROL-10: Organization Unit Type - ROL (CE) <b>optional </b> 62 * <li>ROL-11: Office/Home Address (XAD) <b>optional repeating</b> 63 * <li>ROL-12: Phone (XTN) <b>optional repeating</b> 64 * </ul> 65 */ 66 @SuppressWarnings("unused") 67 public class ROL extends AbstractSegment { 68 69 /** 70 * Creates a new ROL segment 71 */ 72 public ROL(Group parent, ModelClassFactory factory) { 73 super(parent, factory); 74 init(factory); 75 } 76 77 private void init(ModelClassFactory factory) { 78 try { 79 this.add(EI.class, false, 1, 60, new Object[]{ getMessage() }, "Role Instance ID"); 80 this.add(ID.class, true, 1, 2, new Object[]{ getMessage(), new Integer(287) }, "Action Code"); 81 this.add(CE.class, true, 1, 250, new Object[]{ getMessage() }, "Role-ROL"); 82 this.add(XCN.class, true, 0, 250, new Object[]{ getMessage() }, "Role Person"); 83 this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Role Begin Date/Time"); 84 this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Role End Date/Time"); 85 this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Role Duration"); 86 this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Role Action Reason"); 87 this.add(CE.class, false, 0, 250, new Object[]{ getMessage() }, "Provider Type"); 88 this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Organization Unit Type - ROL"); 89 this.add(XAD.class, false, 0, 250, new Object[]{ getMessage() }, "Office/Home Address"); 90 this.add(XTN.class, false, 0, 250, new Object[]{ getMessage() }, "Phone"); 91 } catch(HL7Exception e) { 92 log.error("Unexpected error creating ROL - this is probably a bug in the source code generator.", e); 93 } 94 } 95 96 97 98 /** 99 * Returns 100 * ROL-1: "Role Instance ID" - creates it if necessary 101 */ 102 public EI getRoleInstanceID() { 103 EI retVal = this.getTypedField(1, 0); 104 return retVal; 105 } 106 107 /** 108 * Returns 109 * ROL-1: "Role Instance ID" - creates it if necessary 110 */ 111 public EI getRol1_RoleInstanceID() { 112 EI retVal = this.getTypedField(1, 0); 113 return retVal; 114 } 115 116 117 118 /** 119 * Returns 120 * ROL-2: "Action Code" - creates it if necessary 121 */ 122 public ID getActionCode() { 123 ID retVal = this.getTypedField(2, 0); 124 return retVal; 125 } 126 127 /** 128 * Returns 129 * ROL-2: "Action Code" - creates it if necessary 130 */ 131 public ID getRol2_ActionCode() { 132 ID retVal = this.getTypedField(2, 0); 133 return retVal; 134 } 135 136 137 138 /** 139 * Returns 140 * ROL-3: "Role-ROL" - creates it if necessary 141 */ 142 public CE getRoleROL() { 143 CE retVal = this.getTypedField(3, 0); 144 return retVal; 145 } 146 147 /** 148 * Returns 149 * ROL-3: "Role-ROL" - creates it if necessary 150 */ 151 public CE getRol3_RoleROL() { 152 CE retVal = this.getTypedField(3, 0); 153 return retVal; 154 } 155 156 157 /** 158 * Returns all repetitions of Role Person (ROL-4). 159 */ 160 public XCN[] getRolePerson() { 161 XCN[] retVal = this.getTypedField(4, new XCN[0]); 162 return retVal; 163 } 164 165 166 /** 167 * Returns all repetitions of Role Person (ROL-4). 168 */ 169 public XCN[] getRol4_RolePerson() { 170 XCN[] retVal = this.getTypedField(4, new XCN[0]); 171 return retVal; 172 } 173 174 175 /** 176 * Returns a count of the current number of repetitions of Role Person (ROL-4). 177 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 178 * it will return zero. 179 */ 180 public int getRolePersonReps() { 181 return this.getReps(4); 182 } 183 184 185 /** 186 * Returns a specific repetition of 187 * ROL-4: "Role Person" - creates it if necessary 188 * 189 * @param rep The repetition index (0-indexed) 190 */ 191 public XCN getRolePerson(int rep) { 192 XCN retVal = this.getTypedField(4, rep); 193 return retVal; 194 } 195 196 /** 197 * Returns a specific repetition of 198 * ROL-4: "Role Person" - creates it if necessary 199 * 200 * @param rep The repetition index (0-indexed) 201 */ 202 public XCN getRol4_RolePerson(int rep) { 203 XCN retVal = this.getTypedField(4, rep); 204 return retVal; 205 } 206 207 /** 208 * Returns a count of the current number of repetitions of Role Person (ROL-4). 209 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 210 * it will return zero. 211 */ 212 public int getRol4_RolePersonReps() { 213 return this.getReps(4); 214 } 215 216 217 /** 218 * Inserts a repetition of 219 * ROL-4: "Role Person" at a specific index 220 * 221 * @param rep The repetition index (0-indexed) 222 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 223 */ 224 public XCN insertRolePerson(int rep) throws HL7Exception { 225 return (XCN) super.insertRepetition(4, rep); 226 } 227 228 229 /** 230 * Inserts a repetition of 231 * ROL-4: "Role Person" at a specific index 232 * 233 * @param rep The repetition index (0-indexed) 234 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 235 */ 236 public XCN insertRol4_RolePerson(int rep) throws HL7Exception { 237 return (XCN) super.insertRepetition(4, rep); 238 } 239 240 241 /** 242 * Removes a repetition of 243 * ROL-4: "Role Person" at a specific index 244 * 245 * @param rep The repetition index (0-indexed) 246 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 247 */ 248 public XCN removeRolePerson(int rep) throws HL7Exception { 249 return (XCN) super.removeRepetition(4, rep); 250 } 251 252 253 /** 254 * Removes a repetition of 255 * ROL-4: "Role Person" at a specific index 256 * 257 * @param rep The repetition index (0-indexed) 258 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 259 */ 260 public XCN removeRol4_RolePerson(int rep) throws HL7Exception { 261 return (XCN) super.removeRepetition(4, rep); 262 } 263 264 265 266 267 /** 268 * Returns 269 * ROL-5: "Role Begin Date/Time" - creates it if necessary 270 */ 271 public TS getRoleBeginDateTime() { 272 TS retVal = this.getTypedField(5, 0); 273 return retVal; 274 } 275 276 /** 277 * Returns 278 * ROL-5: "Role Begin Date/Time" - creates it if necessary 279 */ 280 public TS getRol5_RoleBeginDateTime() { 281 TS retVal = this.getTypedField(5, 0); 282 return retVal; 283 } 284 285 286 287 /** 288 * Returns 289 * ROL-6: "Role End Date/Time" - creates it if necessary 290 */ 291 public TS getRoleEndDateTime() { 292 TS retVal = this.getTypedField(6, 0); 293 return retVal; 294 } 295 296 /** 297 * Returns 298 * ROL-6: "Role End Date/Time" - creates it if necessary 299 */ 300 public TS getRol6_RoleEndDateTime() { 301 TS retVal = this.getTypedField(6, 0); 302 return retVal; 303 } 304 305 306 307 /** 308 * Returns 309 * ROL-7: "Role Duration" - creates it if necessary 310 */ 311 public CE getRoleDuration() { 312 CE retVal = this.getTypedField(7, 0); 313 return retVal; 314 } 315 316 /** 317 * Returns 318 * ROL-7: "Role Duration" - creates it if necessary 319 */ 320 public CE getRol7_RoleDuration() { 321 CE retVal = this.getTypedField(7, 0); 322 return retVal; 323 } 324 325 326 327 /** 328 * Returns 329 * ROL-8: "Role Action Reason" - creates it if necessary 330 */ 331 public CE getRoleActionReason() { 332 CE retVal = this.getTypedField(8, 0); 333 return retVal; 334 } 335 336 /** 337 * Returns 338 * ROL-8: "Role Action Reason" - creates it if necessary 339 */ 340 public CE getRol8_RoleActionReason() { 341 CE retVal = this.getTypedField(8, 0); 342 return retVal; 343 } 344 345 346 /** 347 * Returns all repetitions of Provider Type (ROL-9). 348 */ 349 public CE[] getProviderType() { 350 CE[] retVal = this.getTypedField(9, new CE[0]); 351 return retVal; 352 } 353 354 355 /** 356 * Returns all repetitions of Provider Type (ROL-9). 357 */ 358 public CE[] getRol9_ProviderType() { 359 CE[] retVal = this.getTypedField(9, new CE[0]); 360 return retVal; 361 } 362 363 364 /** 365 * Returns a count of the current number of repetitions of Provider Type (ROL-9). 366 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 367 * it will return zero. 368 */ 369 public int getProviderTypeReps() { 370 return this.getReps(9); 371 } 372 373 374 /** 375 * Returns a specific repetition of 376 * ROL-9: "Provider Type" - creates it if necessary 377 * 378 * @param rep The repetition index (0-indexed) 379 */ 380 public CE getProviderType(int rep) { 381 CE retVal = this.getTypedField(9, rep); 382 return retVal; 383 } 384 385 /** 386 * Returns a specific repetition of 387 * ROL-9: "Provider Type" - creates it if necessary 388 * 389 * @param rep The repetition index (0-indexed) 390 */ 391 public CE getRol9_ProviderType(int rep) { 392 CE retVal = this.getTypedField(9, rep); 393 return retVal; 394 } 395 396 /** 397 * Returns a count of the current number of repetitions of Provider Type (ROL-9). 398 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 399 * it will return zero. 400 */ 401 public int getRol9_ProviderTypeReps() { 402 return this.getReps(9); 403 } 404 405 406 /** 407 * Inserts a repetition of 408 * ROL-9: "Provider Type" at a specific index 409 * 410 * @param rep The repetition index (0-indexed) 411 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 412 */ 413 public CE insertProviderType(int rep) throws HL7Exception { 414 return (CE) super.insertRepetition(9, rep); 415 } 416 417 418 /** 419 * Inserts a repetition of 420 * ROL-9: "Provider Type" at a specific index 421 * 422 * @param rep The repetition index (0-indexed) 423 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 424 */ 425 public CE insertRol9_ProviderType(int rep) throws HL7Exception { 426 return (CE) super.insertRepetition(9, rep); 427 } 428 429 430 /** 431 * Removes a repetition of 432 * ROL-9: "Provider Type" at a specific index 433 * 434 * @param rep The repetition index (0-indexed) 435 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 436 */ 437 public CE removeProviderType(int rep) throws HL7Exception { 438 return (CE) super.removeRepetition(9, rep); 439 } 440 441 442 /** 443 * Removes a repetition of 444 * ROL-9: "Provider Type" at a specific index 445 * 446 * @param rep The repetition index (0-indexed) 447 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 448 */ 449 public CE removeRol9_ProviderType(int rep) throws HL7Exception { 450 return (CE) super.removeRepetition(9, rep); 451 } 452 453 454 455 456 /** 457 * Returns 458 * ROL-10: "Organization Unit Type - ROL" - creates it if necessary 459 */ 460 public CE getOrganizationUnitTypeROL() { 461 CE retVal = this.getTypedField(10, 0); 462 return retVal; 463 } 464 465 /** 466 * Returns 467 * ROL-10: "Organization Unit Type - ROL" - creates it if necessary 468 */ 469 public CE getRol10_OrganizationUnitTypeROL() { 470 CE retVal = this.getTypedField(10, 0); 471 return retVal; 472 } 473 474 475 /** 476 * Returns all repetitions of Office/Home Address (ROL-11). 477 */ 478 public XAD[] getOfficeHomeAddress() { 479 XAD[] retVal = this.getTypedField(11, new XAD[0]); 480 return retVal; 481 } 482 483 484 /** 485 * Returns all repetitions of Office/Home Address (ROL-11). 486 */ 487 public XAD[] getRol11_OfficeHomeAddress() { 488 XAD[] retVal = this.getTypedField(11, new XAD[0]); 489 return retVal; 490 } 491 492 493 /** 494 * Returns a count of the current number of repetitions of Office/Home Address (ROL-11). 495 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 496 * it will return zero. 497 */ 498 public int getOfficeHomeAddressReps() { 499 return this.getReps(11); 500 } 501 502 503 /** 504 * Returns a specific repetition of 505 * ROL-11: "Office/Home Address" - creates it if necessary 506 * 507 * @param rep The repetition index (0-indexed) 508 */ 509 public XAD getOfficeHomeAddress(int rep) { 510 XAD retVal = this.getTypedField(11, rep); 511 return retVal; 512 } 513 514 /** 515 * Returns a specific repetition of 516 * ROL-11: "Office/Home Address" - creates it if necessary 517 * 518 * @param rep The repetition index (0-indexed) 519 */ 520 public XAD getRol11_OfficeHomeAddress(int rep) { 521 XAD retVal = this.getTypedField(11, rep); 522 return retVal; 523 } 524 525 /** 526 * Returns a count of the current number of repetitions of Office/Home Address (ROL-11). 527 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 528 * it will return zero. 529 */ 530 public int getRol11_OfficeHomeAddressReps() { 531 return this.getReps(11); 532 } 533 534 535 /** 536 * Inserts a repetition of 537 * ROL-11: "Office/Home Address" at a specific index 538 * 539 * @param rep The repetition index (0-indexed) 540 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 541 */ 542 public XAD insertOfficeHomeAddress(int rep) throws HL7Exception { 543 return (XAD) super.insertRepetition(11, rep); 544 } 545 546 547 /** 548 * Inserts a repetition of 549 * ROL-11: "Office/Home Address" at a specific index 550 * 551 * @param rep The repetition index (0-indexed) 552 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 553 */ 554 public XAD insertRol11_OfficeHomeAddress(int rep) throws HL7Exception { 555 return (XAD) super.insertRepetition(11, rep); 556 } 557 558 559 /** 560 * Removes a repetition of 561 * ROL-11: "Office/Home Address" at a specific index 562 * 563 * @param rep The repetition index (0-indexed) 564 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 565 */ 566 public XAD removeOfficeHomeAddress(int rep) throws HL7Exception { 567 return (XAD) super.removeRepetition(11, rep); 568 } 569 570 571 /** 572 * Removes a repetition of 573 * ROL-11: "Office/Home Address" at a specific index 574 * 575 * @param rep The repetition index (0-indexed) 576 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 577 */ 578 public XAD removeRol11_OfficeHomeAddress(int rep) throws HL7Exception { 579 return (XAD) super.removeRepetition(11, rep); 580 } 581 582 583 584 /** 585 * Returns all repetitions of Phone (ROL-12). 586 */ 587 public XTN[] getPhone() { 588 XTN[] retVal = this.getTypedField(12, new XTN[0]); 589 return retVal; 590 } 591 592 593 /** 594 * Returns all repetitions of Phone (ROL-12). 595 */ 596 public XTN[] getRol12_Phone() { 597 XTN[] retVal = this.getTypedField(12, new XTN[0]); 598 return retVal; 599 } 600 601 602 /** 603 * Returns a count of the current number of repetitions of Phone (ROL-12). 604 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 605 * it will return zero. 606 */ 607 public int getPhoneReps() { 608 return this.getReps(12); 609 } 610 611 612 /** 613 * Returns a specific repetition of 614 * ROL-12: "Phone" - creates it if necessary 615 * 616 * @param rep The repetition index (0-indexed) 617 */ 618 public XTN getPhone(int rep) { 619 XTN retVal = this.getTypedField(12, rep); 620 return retVal; 621 } 622 623 /** 624 * Returns a specific repetition of 625 * ROL-12: "Phone" - creates it if necessary 626 * 627 * @param rep The repetition index (0-indexed) 628 */ 629 public XTN getRol12_Phone(int rep) { 630 XTN retVal = this.getTypedField(12, rep); 631 return retVal; 632 } 633 634 /** 635 * Returns a count of the current number of repetitions of Phone (ROL-12). 636 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 637 * it will return zero. 638 */ 639 public int getRol12_PhoneReps() { 640 return this.getReps(12); 641 } 642 643 644 /** 645 * Inserts a repetition of 646 * ROL-12: "Phone" at a specific index 647 * 648 * @param rep The repetition index (0-indexed) 649 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 650 */ 651 public XTN insertPhone(int rep) throws HL7Exception { 652 return (XTN) super.insertRepetition(12, rep); 653 } 654 655 656 /** 657 * Inserts a repetition of 658 * ROL-12: "Phone" at a specific index 659 * 660 * @param rep The repetition index (0-indexed) 661 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 662 */ 663 public XTN insertRol12_Phone(int rep) throws HL7Exception { 664 return (XTN) super.insertRepetition(12, rep); 665 } 666 667 668 /** 669 * Removes a repetition of 670 * ROL-12: "Phone" at a specific index 671 * 672 * @param rep The repetition index (0-indexed) 673 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 674 */ 675 public XTN removePhone(int rep) throws HL7Exception { 676 return (XTN) super.removeRepetition(12, rep); 677 } 678 679 680 /** 681 * Removes a repetition of 682 * ROL-12: "Phone" at a specific index 683 * 684 * @param rep The repetition index (0-indexed) 685 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 686 */ 687 public XTN removeRol12_Phone(int rep) throws HL7Exception { 688 return (XTN) super.removeRepetition(12, rep); 689 } 690 691 692 693 694 695 696 /** {@inheritDoc} */ 697 protected Type createNewTypeWithoutReflection(int field) { 698 switch (field) { 699 case 0: return new EI(getMessage()); 700 case 1: return new ID(getMessage(), new Integer( 287 )); 701 case 2: return new CE(getMessage()); 702 case 3: return new XCN(getMessage()); 703 case 4: return new TS(getMessage()); 704 case 5: return new TS(getMessage()); 705 case 6: return new CE(getMessage()); 706 case 7: return new CE(getMessage()); 707 case 8: return new CE(getMessage()); 708 case 9: return new CE(getMessage()); 709 case 10: return new XAD(getMessage()); 710 case 11: return new XTN(getMessage()); 711 default: return null; 712 } 713 } 714 715 716 } 717