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