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.v23.segment; 035 036// import ca.uhn.hl7v2.model.v23.group.*; 037import ca.uhn.hl7v2.model.v23.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 (CE) <b> </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 (CE) <b>optional </b> 057 * <li>CTD-7: Contact Identifiers (CM_PI) <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(CE.class, true, 1, 60, new Object[]{ getMessage() }, "Contact Role"); 074 this.add(XPN.class, false, 0, 106, new Object[]{ getMessage() }, "Contact Name"); 075 this.add(XAD.class, false, 0, 60, 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, 20, new Object[]{ getMessage() }, "Contact Communication Information"); 078 this.add(CE.class, false, 1, 200, new Object[]{ getMessage() }, "Preferred Method of Contact"); 079 this.add(CM_PI.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 /** 088 * Returns 089 * CTD-1: "Contact Role" - creates it if necessary 090 */ 091 public CE getContactRole() { 092 CE retVal = this.getTypedField(1, 0); 093 return retVal; 094 } 095 096 /** 097 * Returns 098 * CTD-1: "Contact Role" - creates it if necessary 099 */ 100 public CE getCtd1_ContactRole() { 101 CE retVal = this.getTypedField(1, 0); 102 return retVal; 103 } 104 105 106 /** 107 * Returns all repetitions of Contact Name (CTD-2). 108 */ 109 public XPN[] getContactName() { 110 XPN[] retVal = this.getTypedField(2, new XPN[0]); 111 return retVal; 112 } 113 114 115 /** 116 * Returns all repetitions of Contact Name (CTD-2). 117 */ 118 public XPN[] getCtd2_ContactName() { 119 XPN[] retVal = this.getTypedField(2, new XPN[0]); 120 return retVal; 121 } 122 123 124 /** 125 * Returns a count of the current number of repetitions of Contact Name (CTD-2). 126 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 127 * it will return zero. 128 */ 129 public int getContactNameReps() { 130 return this.getReps(2); 131 } 132 133 134 /** 135 * Returns a specific repetition of 136 * CTD-2: "Contact Name" - creates it if necessary 137 * 138 * @param rep The repetition index (0-indexed) 139 */ 140 public XPN getContactName(int rep) { 141 XPN retVal = this.getTypedField(2, rep); 142 return retVal; 143 } 144 145 /** 146 * Returns a specific repetition of 147 * CTD-2: "Contact Name" - creates it if necessary 148 * 149 * @param rep The repetition index (0-indexed) 150 */ 151 public XPN getCtd2_ContactName(int rep) { 152 XPN retVal = this.getTypedField(2, rep); 153 return retVal; 154 } 155 156 /** 157 * Returns a count of the current number of repetitions of Contact Name (CTD-2). 158 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 159 * it will return zero. 160 */ 161 public int getCtd2_ContactNameReps() { 162 return this.getReps(2); 163 } 164 165 166 /** 167 * Inserts a repetition of 168 * CTD-2: "Contact Name" at a specific index 169 * 170 * @param rep The repetition index (0-indexed) 171 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 172 */ 173 public XPN insertContactName(int rep) throws HL7Exception { 174 return (XPN) super.insertRepetition(2, rep); 175 } 176 177 178 /** 179 * Inserts a repetition of 180 * CTD-2: "Contact Name" at a specific index 181 * 182 * @param rep The repetition index (0-indexed) 183 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 184 */ 185 public XPN insertCtd2_ContactName(int rep) throws HL7Exception { 186 return (XPN) super.insertRepetition(2, rep); 187 } 188 189 190 /** 191 * Removes a repetition of 192 * CTD-2: "Contact Name" at a specific index 193 * 194 * @param rep The repetition index (0-indexed) 195 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 196 */ 197 public XPN removeContactName(int rep) throws HL7Exception { 198 return (XPN) super.removeRepetition(2, rep); 199 } 200 201 202 /** 203 * Removes a repetition of 204 * CTD-2: "Contact Name" at a specific index 205 * 206 * @param rep The repetition index (0-indexed) 207 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 208 */ 209 public XPN removeCtd2_ContactName(int rep) throws HL7Exception { 210 return (XPN) super.removeRepetition(2, rep); 211 } 212 213 214 215 /** 216 * Returns all repetitions of Contact Address (CTD-3). 217 */ 218 public XAD[] getContactAddress() { 219 XAD[] retVal = this.getTypedField(3, new XAD[0]); 220 return retVal; 221 } 222 223 224 /** 225 * Returns all repetitions of Contact Address (CTD-3). 226 */ 227 public XAD[] getCtd3_ContactAddress() { 228 XAD[] retVal = this.getTypedField(3, new XAD[0]); 229 return retVal; 230 } 231 232 233 /** 234 * Returns a count of the current number of repetitions of Contact Address (CTD-3). 235 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 236 * it will return zero. 237 */ 238 public int getContactAddressReps() { 239 return this.getReps(3); 240 } 241 242 243 /** 244 * Returns a specific repetition of 245 * CTD-3: "Contact Address" - creates it if necessary 246 * 247 * @param rep The repetition index (0-indexed) 248 */ 249 public XAD getContactAddress(int rep) { 250 XAD retVal = this.getTypedField(3, rep); 251 return retVal; 252 } 253 254 /** 255 * Returns a specific repetition of 256 * CTD-3: "Contact Address" - creates it if necessary 257 * 258 * @param rep The repetition index (0-indexed) 259 */ 260 public XAD getCtd3_ContactAddress(int rep) { 261 XAD retVal = this.getTypedField(3, rep); 262 return retVal; 263 } 264 265 /** 266 * Returns a count of the current number of repetitions of Contact Address (CTD-3). 267 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 268 * it will return zero. 269 */ 270 public int getCtd3_ContactAddressReps() { 271 return this.getReps(3); 272 } 273 274 275 /** 276 * Inserts a repetition of 277 * CTD-3: "Contact Address" at a specific index 278 * 279 * @param rep The repetition index (0-indexed) 280 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 281 */ 282 public XAD insertContactAddress(int rep) throws HL7Exception { 283 return (XAD) super.insertRepetition(3, rep); 284 } 285 286 287 /** 288 * Inserts a repetition of 289 * CTD-3: "Contact Address" at a specific index 290 * 291 * @param rep The repetition index (0-indexed) 292 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 293 */ 294 public XAD insertCtd3_ContactAddress(int rep) throws HL7Exception { 295 return (XAD) super.insertRepetition(3, rep); 296 } 297 298 299 /** 300 * Removes a repetition of 301 * CTD-3: "Contact Address" at a specific index 302 * 303 * @param rep The repetition index (0-indexed) 304 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 305 */ 306 public XAD removeContactAddress(int rep) throws HL7Exception { 307 return (XAD) super.removeRepetition(3, rep); 308 } 309 310 311 /** 312 * Removes a repetition of 313 * CTD-3: "Contact Address" at a specific index 314 * 315 * @param rep The repetition index (0-indexed) 316 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 317 */ 318 public XAD removeCtd3_ContactAddress(int rep) throws HL7Exception { 319 return (XAD) super.removeRepetition(3, rep); 320 } 321 322 323 324 325 /** 326 * Returns 327 * CTD-4: "Contact Location" - creates it if necessary 328 */ 329 public PL getContactLocation() { 330 PL retVal = this.getTypedField(4, 0); 331 return retVal; 332 } 333 334 /** 335 * Returns 336 * CTD-4: "Contact Location" - creates it if necessary 337 */ 338 public PL getCtd4_ContactLocation() { 339 PL retVal = this.getTypedField(4, 0); 340 return retVal; 341 } 342 343 344 /** 345 * Returns all repetitions of Contact Communication Information (CTD-5). 346 */ 347 public XTN[] getContactCommunicationInformation() { 348 XTN[] retVal = this.getTypedField(5, new XTN[0]); 349 return retVal; 350 } 351 352 353 /** 354 * Returns all repetitions of Contact Communication Information (CTD-5). 355 */ 356 public XTN[] getCtd5_ContactCommunicationInformation() { 357 XTN[] retVal = this.getTypedField(5, new XTN[0]); 358 return retVal; 359 } 360 361 362 /** 363 * Returns a count of the current number of repetitions of Contact Communication Information (CTD-5). 364 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 365 * it will return zero. 366 */ 367 public int getContactCommunicationInformationReps() { 368 return this.getReps(5); 369 } 370 371 372 /** 373 * Returns a specific repetition of 374 * CTD-5: "Contact Communication Information" - creates it if necessary 375 * 376 * @param rep The repetition index (0-indexed) 377 */ 378 public XTN getContactCommunicationInformation(int rep) { 379 XTN retVal = this.getTypedField(5, rep); 380 return retVal; 381 } 382 383 /** 384 * Returns a specific repetition of 385 * CTD-5: "Contact Communication Information" - creates it if necessary 386 * 387 * @param rep The repetition index (0-indexed) 388 */ 389 public XTN getCtd5_ContactCommunicationInformation(int rep) { 390 XTN retVal = this.getTypedField(5, rep); 391 return retVal; 392 } 393 394 /** 395 * Returns a count of the current number of repetitions of Contact Communication Information (CTD-5). 396 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 397 * it will return zero. 398 */ 399 public int getCtd5_ContactCommunicationInformationReps() { 400 return this.getReps(5); 401 } 402 403 404 /** 405 * Inserts a repetition of 406 * CTD-5: "Contact Communication Information" at a specific index 407 * 408 * @param rep The repetition index (0-indexed) 409 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 410 */ 411 public XTN insertContactCommunicationInformation(int rep) throws HL7Exception { 412 return (XTN) super.insertRepetition(5, rep); 413 } 414 415 416 /** 417 * Inserts a repetition of 418 * CTD-5: "Contact Communication Information" at a specific index 419 * 420 * @param rep The repetition index (0-indexed) 421 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 422 */ 423 public XTN insertCtd5_ContactCommunicationInformation(int rep) throws HL7Exception { 424 return (XTN) super.insertRepetition(5, rep); 425 } 426 427 428 /** 429 * Removes a repetition of 430 * CTD-5: "Contact Communication Information" at a specific index 431 * 432 * @param rep The repetition index (0-indexed) 433 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 434 */ 435 public XTN removeContactCommunicationInformation(int rep) throws HL7Exception { 436 return (XTN) super.removeRepetition(5, rep); 437 } 438 439 440 /** 441 * Removes a repetition of 442 * CTD-5: "Contact Communication Information" at a specific index 443 * 444 * @param rep The repetition index (0-indexed) 445 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 446 */ 447 public XTN removeCtd5_ContactCommunicationInformation(int rep) throws HL7Exception { 448 return (XTN) super.removeRepetition(5, rep); 449 } 450 451 452 453 454 /** 455 * Returns 456 * CTD-6: "Preferred Method of Contact" - creates it if necessary 457 */ 458 public CE getPreferredMethodOfContact() { 459 CE retVal = this.getTypedField(6, 0); 460 return retVal; 461 } 462 463 /** 464 * Returns 465 * CTD-6: "Preferred Method of Contact" - creates it if necessary 466 */ 467 public CE getCtd6_PreferredMethodOfContact() { 468 CE retVal = this.getTypedField(6, 0); 469 return retVal; 470 } 471 472 473 /** 474 * Returns all repetitions of Contact Identifiers (CTD-7). 475 */ 476 public CM_PI[] getContactIdentifiers() { 477 CM_PI[] retVal = this.getTypedField(7, new CM_PI[0]); 478 return retVal; 479 } 480 481 482 /** 483 * Returns all repetitions of Contact Identifiers (CTD-7). 484 */ 485 public CM_PI[] getCtd7_ContactIdentifiers() { 486 CM_PI[] retVal = this.getTypedField(7, new CM_PI[0]); 487 return retVal; 488 } 489 490 491 /** 492 * Returns a count of the current number of repetitions of Contact Identifiers (CTD-7). 493 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 494 * it will return zero. 495 */ 496 public int getContactIdentifiersReps() { 497 return this.getReps(7); 498 } 499 500 501 /** 502 * Returns a specific repetition of 503 * CTD-7: "Contact Identifiers" - creates it if necessary 504 * 505 * @param rep The repetition index (0-indexed) 506 */ 507 public CM_PI getContactIdentifiers(int rep) { 508 CM_PI retVal = this.getTypedField(7, rep); 509 return retVal; 510 } 511 512 /** 513 * Returns a specific repetition of 514 * CTD-7: "Contact Identifiers" - creates it if necessary 515 * 516 * @param rep The repetition index (0-indexed) 517 */ 518 public CM_PI getCtd7_ContactIdentifiers(int rep) { 519 CM_PI retVal = this.getTypedField(7, rep); 520 return retVal; 521 } 522 523 /** 524 * Returns a count of the current number of repetitions of Contact Identifiers (CTD-7). 525 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 526 * it will return zero. 527 */ 528 public int getCtd7_ContactIdentifiersReps() { 529 return this.getReps(7); 530 } 531 532 533 /** 534 * Inserts a repetition of 535 * CTD-7: "Contact Identifiers" at a specific index 536 * 537 * @param rep The repetition index (0-indexed) 538 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 539 */ 540 public CM_PI insertContactIdentifiers(int rep) throws HL7Exception { 541 return (CM_PI) super.insertRepetition(7, rep); 542 } 543 544 545 /** 546 * Inserts a repetition of 547 * CTD-7: "Contact Identifiers" at a specific index 548 * 549 * @param rep The repetition index (0-indexed) 550 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 551 */ 552 public CM_PI insertCtd7_ContactIdentifiers(int rep) throws HL7Exception { 553 return (CM_PI) super.insertRepetition(7, rep); 554 } 555 556 557 /** 558 * Removes a repetition of 559 * CTD-7: "Contact Identifiers" at a specific index 560 * 561 * @param rep The repetition index (0-indexed) 562 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 563 */ 564 public CM_PI removeContactIdentifiers(int rep) throws HL7Exception { 565 return (CM_PI) super.removeRepetition(7, rep); 566 } 567 568 569 /** 570 * Removes a repetition of 571 * CTD-7: "Contact Identifiers" at a specific index 572 * 573 * @param rep The repetition index (0-indexed) 574 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 575 */ 576 public CM_PI removeCtd7_ContactIdentifiers(int rep) throws HL7Exception { 577 return (CM_PI) super.removeRepetition(7, rep); 578 } 579 580 581 582 583 584 585 /** {@inheritDoc} */ 586 protected Type createNewTypeWithoutReflection(int field) { 587 switch (field) { 588 case 0: return new CE(getMessage()); 589 case 1: return new XPN(getMessage()); 590 case 2: return new XAD(getMessage()); 591 case 3: return new PL(getMessage()); 592 case 4: return new XTN(getMessage()); 593 case 5: return new CE(getMessage()); 594 case 6: return new CM_PI(getMessage()); 595 default: return null; 596 } 597 } 598 599 600} 601