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