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.v23.segment; 35 36 // import ca.uhn.hl7v2.model.v23.group.*; 37 import ca.uhn.hl7v2.model.v23.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 PRD message segment (Provider Data). 50 * This segment has the following fields:</p> 51 * <ul> 52 * <li>PRD-1: Role (CE) <b> repeating</b> 53 * <li>PRD-2: Provider Name (XPN) <b>optional repeating</b> 54 * <li>PRD-3: Provider Address (XAD) <b>optional </b> 55 * <li>PRD-4: Provider Location (PL) <b>optional </b> 56 * <li>PRD-5: Provider Communication Information (XTN) <b>optional repeating</b> 57 * <li>PRD-6: Preferred Method of Contact (CE) <b>optional </b> 58 * <li>PRD-7: Provider Identifiers (CM_PI) <b>optional repeating</b> 59 * <li>PRD-8: Effective Start Date of Role (TS) <b>optional </b> 60 * <li>PRD-9: Effective End Date of Role (TS) <b>optional </b> 61 * </ul> 62 */ 63 @SuppressWarnings("unused") 64 public class PRD extends AbstractSegment { 65 66 /** 67 * Creates a new PRD segment 68 */ 69 public PRD(Group parent, ModelClassFactory factory) { 70 super(parent, factory); 71 init(factory); 72 } 73 74 private void init(ModelClassFactory factory) { 75 try { 76 this.add(CE.class, true, 0, 200, new Object[]{ getMessage() }, "Role"); 77 this.add(XPN.class, false, 0, 106, new Object[]{ getMessage() }, "Provider Name"); 78 this.add(XAD.class, false, 1, 60, new Object[]{ getMessage() }, "Provider Address"); 79 this.add(PL.class, false, 1, 60, new Object[]{ getMessage() }, "Provider Location"); 80 this.add(XTN.class, false, 0, 20, new Object[]{ getMessage() }, "Provider Communication Information"); 81 this.add(CE.class, false, 1, 200, new Object[]{ getMessage() }, "Preferred Method of Contact"); 82 this.add(CM_PI.class, false, 0, 100, new Object[]{ getMessage() }, "Provider Identifiers"); 83 this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Effective Start Date of Role"); 84 this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Effective End Date of Role"); 85 } catch(HL7Exception e) { 86 log.error("Unexpected error creating PRD - this is probably a bug in the source code generator.", e); 87 } 88 } 89 90 91 /** 92 * Returns all repetitions of Role (PRD-1). 93 */ 94 public CE[] getRole() { 95 CE[] retVal = this.getTypedField(1, new CE[0]); 96 return retVal; 97 } 98 99 100 /** 101 * Returns all repetitions of Role (PRD-1). 102 */ 103 public CE[] getPrd1_Role() { 104 CE[] retVal = this.getTypedField(1, new CE[0]); 105 return retVal; 106 } 107 108 109 /** 110 * Returns a count of the current number of repetitions of Role (PRD-1). 111 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 112 * it will return zero. 113 */ 114 public int getRoleReps() { 115 return this.getReps(1); 116 } 117 118 119 /** 120 * Returns a specific repetition of 121 * PRD-1: "Role" - creates it if necessary 122 * 123 * @param rep The repetition index (0-indexed) 124 */ 125 public CE getRole(int rep) { 126 CE retVal = this.getTypedField(1, rep); 127 return retVal; 128 } 129 130 /** 131 * Returns a specific repetition of 132 * PRD-1: "Role" - creates it if necessary 133 * 134 * @param rep The repetition index (0-indexed) 135 */ 136 public CE getPrd1_Role(int rep) { 137 CE retVal = this.getTypedField(1, rep); 138 return retVal; 139 } 140 141 /** 142 * Returns a count of the current number of repetitions of Role (PRD-1). 143 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 144 * it will return zero. 145 */ 146 public int getPrd1_RoleReps() { 147 return this.getReps(1); 148 } 149 150 151 /** 152 * Inserts a repetition of 153 * PRD-1: "Role" at a specific index 154 * 155 * @param rep The repetition index (0-indexed) 156 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 157 */ 158 public CE insertRole(int rep) throws HL7Exception { 159 return (CE) super.insertRepetition(1, rep); 160 } 161 162 163 /** 164 * Inserts a repetition of 165 * PRD-1: "Role" at a specific index 166 * 167 * @param rep The repetition index (0-indexed) 168 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 169 */ 170 public CE insertPrd1_Role(int rep) throws HL7Exception { 171 return (CE) super.insertRepetition(1, rep); 172 } 173 174 175 /** 176 * Removes a repetition of 177 * PRD-1: "Role" at a specific index 178 * 179 * @param rep The repetition index (0-indexed) 180 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 181 */ 182 public CE removeRole(int rep) throws HL7Exception { 183 return (CE) super.removeRepetition(1, rep); 184 } 185 186 187 /** 188 * Removes a repetition of 189 * PRD-1: "Role" at a specific index 190 * 191 * @param rep The repetition index (0-indexed) 192 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 193 */ 194 public CE removePrd1_Role(int rep) throws HL7Exception { 195 return (CE) super.removeRepetition(1, rep); 196 } 197 198 199 200 /** 201 * Returns all repetitions of Provider Name (PRD-2). 202 */ 203 public XPN[] getProviderName() { 204 XPN[] retVal = this.getTypedField(2, new XPN[0]); 205 return retVal; 206 } 207 208 209 /** 210 * Returns all repetitions of Provider Name (PRD-2). 211 */ 212 public XPN[] getPrd2_ProviderName() { 213 XPN[] retVal = this.getTypedField(2, new XPN[0]); 214 return retVal; 215 } 216 217 218 /** 219 * Returns a count of the current number of repetitions of Provider Name (PRD-2). 220 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 221 * it will return zero. 222 */ 223 public int getProviderNameReps() { 224 return this.getReps(2); 225 } 226 227 228 /** 229 * Returns a specific repetition of 230 * PRD-2: "Provider Name" - creates it if necessary 231 * 232 * @param rep The repetition index (0-indexed) 233 */ 234 public XPN getProviderName(int rep) { 235 XPN retVal = this.getTypedField(2, rep); 236 return retVal; 237 } 238 239 /** 240 * Returns a specific repetition of 241 * PRD-2: "Provider Name" - creates it if necessary 242 * 243 * @param rep The repetition index (0-indexed) 244 */ 245 public XPN getPrd2_ProviderName(int rep) { 246 XPN retVal = this.getTypedField(2, rep); 247 return retVal; 248 } 249 250 /** 251 * Returns a count of the current number of repetitions of Provider Name (PRD-2). 252 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 253 * it will return zero. 254 */ 255 public int getPrd2_ProviderNameReps() { 256 return this.getReps(2); 257 } 258 259 260 /** 261 * Inserts a repetition of 262 * PRD-2: "Provider Name" at a specific index 263 * 264 * @param rep The repetition index (0-indexed) 265 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 266 */ 267 public XPN insertProviderName(int rep) throws HL7Exception { 268 return (XPN) super.insertRepetition(2, rep); 269 } 270 271 272 /** 273 * Inserts a repetition of 274 * PRD-2: "Provider Name" at a specific index 275 * 276 * @param rep The repetition index (0-indexed) 277 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 278 */ 279 public XPN insertPrd2_ProviderName(int rep) throws HL7Exception { 280 return (XPN) super.insertRepetition(2, rep); 281 } 282 283 284 /** 285 * Removes a repetition of 286 * PRD-2: "Provider Name" at a specific index 287 * 288 * @param rep The repetition index (0-indexed) 289 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 290 */ 291 public XPN removeProviderName(int rep) throws HL7Exception { 292 return (XPN) super.removeRepetition(2, rep); 293 } 294 295 296 /** 297 * Removes a repetition of 298 * PRD-2: "Provider Name" at a specific index 299 * 300 * @param rep The repetition index (0-indexed) 301 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 302 */ 303 public XPN removePrd2_ProviderName(int rep) throws HL7Exception { 304 return (XPN) super.removeRepetition(2, rep); 305 } 306 307 308 309 310 /** 311 * Returns 312 * PRD-3: "Provider Address" - creates it if necessary 313 */ 314 public XAD getProviderAddress() { 315 XAD retVal = this.getTypedField(3, 0); 316 return retVal; 317 } 318 319 /** 320 * Returns 321 * PRD-3: "Provider Address" - creates it if necessary 322 */ 323 public XAD getPrd3_ProviderAddress() { 324 XAD retVal = this.getTypedField(3, 0); 325 return retVal; 326 } 327 328 329 330 /** 331 * Returns 332 * PRD-4: "Provider Location" - creates it if necessary 333 */ 334 public PL getProviderLocation() { 335 PL retVal = this.getTypedField(4, 0); 336 return retVal; 337 } 338 339 /** 340 * Returns 341 * PRD-4: "Provider Location" - creates it if necessary 342 */ 343 public PL getPrd4_ProviderLocation() { 344 PL retVal = this.getTypedField(4, 0); 345 return retVal; 346 } 347 348 349 /** 350 * Returns all repetitions of Provider Communication Information (PRD-5). 351 */ 352 public XTN[] getProviderCommunicationInformation() { 353 XTN[] retVal = this.getTypedField(5, new XTN[0]); 354 return retVal; 355 } 356 357 358 /** 359 * Returns all repetitions of Provider Communication Information (PRD-5). 360 */ 361 public XTN[] getPrd5_ProviderCommunicationInformation() { 362 XTN[] retVal = this.getTypedField(5, new XTN[0]); 363 return retVal; 364 } 365 366 367 /** 368 * Returns a count of the current number of repetitions of Provider Communication Information (PRD-5). 369 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 370 * it will return zero. 371 */ 372 public int getProviderCommunicationInformationReps() { 373 return this.getReps(5); 374 } 375 376 377 /** 378 * Returns a specific repetition of 379 * PRD-5: "Provider Communication Information" - creates it if necessary 380 * 381 * @param rep The repetition index (0-indexed) 382 */ 383 public XTN getProviderCommunicationInformation(int rep) { 384 XTN retVal = this.getTypedField(5, rep); 385 return retVal; 386 } 387 388 /** 389 * Returns a specific repetition of 390 * PRD-5: "Provider Communication Information" - creates it if necessary 391 * 392 * @param rep The repetition index (0-indexed) 393 */ 394 public XTN getPrd5_ProviderCommunicationInformation(int rep) { 395 XTN retVal = this.getTypedField(5, rep); 396 return retVal; 397 } 398 399 /** 400 * Returns a count of the current number of repetitions of Provider Communication Information (PRD-5). 401 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 402 * it will return zero. 403 */ 404 public int getPrd5_ProviderCommunicationInformationReps() { 405 return this.getReps(5); 406 } 407 408 409 /** 410 * Inserts a repetition of 411 * PRD-5: "Provider Communication Information" at a specific index 412 * 413 * @param rep The repetition index (0-indexed) 414 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 415 */ 416 public XTN insertProviderCommunicationInformation(int rep) throws HL7Exception { 417 return (XTN) super.insertRepetition(5, rep); 418 } 419 420 421 /** 422 * Inserts a repetition of 423 * PRD-5: "Provider Communication Information" at a specific index 424 * 425 * @param rep The repetition index (0-indexed) 426 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 427 */ 428 public XTN insertPrd5_ProviderCommunicationInformation(int rep) throws HL7Exception { 429 return (XTN) super.insertRepetition(5, rep); 430 } 431 432 433 /** 434 * Removes a repetition of 435 * PRD-5: "Provider Communication Information" at a specific index 436 * 437 * @param rep The repetition index (0-indexed) 438 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 439 */ 440 public XTN removeProviderCommunicationInformation(int rep) throws HL7Exception { 441 return (XTN) super.removeRepetition(5, rep); 442 } 443 444 445 /** 446 * Removes a repetition of 447 * PRD-5: "Provider Communication Information" at a specific index 448 * 449 * @param rep The repetition index (0-indexed) 450 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 451 */ 452 public XTN removePrd5_ProviderCommunicationInformation(int rep) throws HL7Exception { 453 return (XTN) super.removeRepetition(5, rep); 454 } 455 456 457 458 459 /** 460 * Returns 461 * PRD-6: "Preferred Method of Contact" - creates it if necessary 462 */ 463 public CE getPreferredMethodOfContact() { 464 CE retVal = this.getTypedField(6, 0); 465 return retVal; 466 } 467 468 /** 469 * Returns 470 * PRD-6: "Preferred Method of Contact" - creates it if necessary 471 */ 472 public CE getPrd6_PreferredMethodOfContact() { 473 CE retVal = this.getTypedField(6, 0); 474 return retVal; 475 } 476 477 478 /** 479 * Returns all repetitions of Provider Identifiers (PRD-7). 480 */ 481 public CM_PI[] getProviderIdentifiers() { 482 CM_PI[] retVal = this.getTypedField(7, new CM_PI[0]); 483 return retVal; 484 } 485 486 487 /** 488 * Returns all repetitions of Provider Identifiers (PRD-7). 489 */ 490 public CM_PI[] getPrd7_ProviderIdentifiers() { 491 CM_PI[] retVal = this.getTypedField(7, new CM_PI[0]); 492 return retVal; 493 } 494 495 496 /** 497 * Returns a count of the current number of repetitions of Provider Identifiers (PRD-7). 498 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 499 * it will return zero. 500 */ 501 public int getProviderIdentifiersReps() { 502 return this.getReps(7); 503 } 504 505 506 /** 507 * Returns a specific repetition of 508 * PRD-7: "Provider Identifiers" - creates it if necessary 509 * 510 * @param rep The repetition index (0-indexed) 511 */ 512 public CM_PI getProviderIdentifiers(int rep) { 513 CM_PI retVal = this.getTypedField(7, rep); 514 return retVal; 515 } 516 517 /** 518 * Returns a specific repetition of 519 * PRD-7: "Provider Identifiers" - creates it if necessary 520 * 521 * @param rep The repetition index (0-indexed) 522 */ 523 public CM_PI getPrd7_ProviderIdentifiers(int rep) { 524 CM_PI retVal = this.getTypedField(7, rep); 525 return retVal; 526 } 527 528 /** 529 * Returns a count of the current number of repetitions of Provider Identifiers (PRD-7). 530 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 531 * it will return zero. 532 */ 533 public int getPrd7_ProviderIdentifiersReps() { 534 return this.getReps(7); 535 } 536 537 538 /** 539 * Inserts a repetition of 540 * PRD-7: "Provider Identifiers" at a specific index 541 * 542 * @param rep The repetition index (0-indexed) 543 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 544 */ 545 public CM_PI insertProviderIdentifiers(int rep) throws HL7Exception { 546 return (CM_PI) super.insertRepetition(7, rep); 547 } 548 549 550 /** 551 * Inserts a repetition of 552 * PRD-7: "Provider Identifiers" at a specific index 553 * 554 * @param rep The repetition index (0-indexed) 555 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 556 */ 557 public CM_PI insertPrd7_ProviderIdentifiers(int rep) throws HL7Exception { 558 return (CM_PI) super.insertRepetition(7, rep); 559 } 560 561 562 /** 563 * Removes a repetition of 564 * PRD-7: "Provider Identifiers" at a specific index 565 * 566 * @param rep The repetition index (0-indexed) 567 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 568 */ 569 public CM_PI removeProviderIdentifiers(int rep) throws HL7Exception { 570 return (CM_PI) super.removeRepetition(7, rep); 571 } 572 573 574 /** 575 * Removes a repetition of 576 * PRD-7: "Provider Identifiers" at a specific index 577 * 578 * @param rep The repetition index (0-indexed) 579 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 580 */ 581 public CM_PI removePrd7_ProviderIdentifiers(int rep) throws HL7Exception { 582 return (CM_PI) super.removeRepetition(7, rep); 583 } 584 585 586 587 588 /** 589 * Returns 590 * PRD-8: "Effective Start Date of Role" - creates it if necessary 591 */ 592 public TS getEffectiveStartDateOfRole() { 593 TS retVal = this.getTypedField(8, 0); 594 return retVal; 595 } 596 597 /** 598 * Returns 599 * PRD-8: "Effective Start Date of Role" - creates it if necessary 600 */ 601 public TS getPrd8_EffectiveStartDateOfRole() { 602 TS retVal = this.getTypedField(8, 0); 603 return retVal; 604 } 605 606 607 608 /** 609 * Returns 610 * PRD-9: "Effective End Date of Role" - creates it if necessary 611 */ 612 public TS getEffectiveEndDateOfRole() { 613 TS retVal = this.getTypedField(9, 0); 614 return retVal; 615 } 616 617 /** 618 * Returns 619 * PRD-9: "Effective End Date of Role" - creates it if necessary 620 */ 621 public TS getPrd9_EffectiveEndDateOfRole() { 622 TS retVal = this.getTypedField(9, 0); 623 return retVal; 624 } 625 626 627 628 629 630 /** {@inheritDoc} */ 631 protected Type createNewTypeWithoutReflection(int field) { 632 switch (field) { 633 case 0: return new CE(getMessage()); 634 case 1: return new XPN(getMessage()); 635 case 2: return new XAD(getMessage()); 636 case 3: return new PL(getMessage()); 637 case 4: return new XTN(getMessage()); 638 case 5: return new CE(getMessage()); 639 case 6: return new CM_PI(getMessage()); 640 case 7: return new TS(getMessage()); 641 case 8: return new TS(getMessage()); 642 default: return null; 643 } 644 } 645 646 647 } 648