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 LOC message segment (Location Identification). 049 * This segment has the following fields:</p> 050 * <ul> 051 * <li>LOC-1: Primary Key Value (PL) <b> </b> 052 * <li>LOC-2: Location Description (ST) <b>optional </b> 053 * <li>LOC-3: Location Type (IS) <b> repeating</b> 054 * <li>LOC-4: Organization Name (XON) <b>optional </b> 055 * <li>LOC-5: Location Address (XAD) <b>optional </b> 056 * <li>LOC-6: Location Phone (XTN) <b>optional repeating</b> 057 * <li>LOC-7: License Number (CE) <b>optional repeating</b> 058 * <li>LOC-8: Location Equipment (ID) <b>optional repeating</b> 059 * </ul> 060 */ 061@SuppressWarnings("unused") 062public class LOC extends AbstractSegment { 063 064 /** 065 * Creates a new LOC segment 066 */ 067 public LOC(Group parent, ModelClassFactory factory) { 068 super(parent, factory); 069 init(factory); 070 } 071 072 private void init(ModelClassFactory factory) { 073 try { 074 this.add(PL.class, true, 1, 20, new Object[]{ getMessage() }, "Primary Key Value"); 075 this.add(ST.class, false, 1, 48, new Object[]{ getMessage() }, "Location Description"); 076 this.add(IS.class, true, 0, 2, new Object[]{ getMessage(), new Integer(260) }, "Location Type"); 077 this.add(XON.class, false, 1, 90, new Object[]{ getMessage() }, "Organization Name"); 078 this.add(XAD.class, false, 1, 106, new Object[]{ getMessage() }, "Location Address"); 079 this.add(XTN.class, false, 0, 40, new Object[]{ getMessage() }, "Location Phone"); 080 this.add(CE.class, false, 0, 60, new Object[]{ getMessage() }, "License Number"); 081 this.add(ID.class, false, 0, 3, new Object[]{ getMessage(), new Integer(261) }, "Location Equipment"); 082 } catch(HL7Exception e) { 083 log.error("Unexpected error creating LOC - this is probably a bug in the source code generator.", e); 084 } 085 } 086 087 088 089 /** 090 * Returns 091 * LOC-1: "Primary Key Value" - creates it if necessary 092 */ 093 public PL getPrimaryKeyValue() { 094 PL retVal = this.getTypedField(1, 0); 095 return retVal; 096 } 097 098 /** 099 * Returns 100 * LOC-1: "Primary Key Value" - creates it if necessary 101 */ 102 public PL getLoc1_PrimaryKeyValue() { 103 PL retVal = this.getTypedField(1, 0); 104 return retVal; 105 } 106 107 108 109 /** 110 * Returns 111 * LOC-2: "Location Description" - creates it if necessary 112 */ 113 public ST getLocationDescription() { 114 ST retVal = this.getTypedField(2, 0); 115 return retVal; 116 } 117 118 /** 119 * Returns 120 * LOC-2: "Location Description" - creates it if necessary 121 */ 122 public ST getLoc2_LocationDescription() { 123 ST retVal = this.getTypedField(2, 0); 124 return retVal; 125 } 126 127 128 /** 129 * Returns all repetitions of Location Type (LOC-3). 130 */ 131 public IS[] getLocationType() { 132 IS[] retVal = this.getTypedField(3, new IS[0]); 133 return retVal; 134 } 135 136 137 /** 138 * Returns all repetitions of Location Type (LOC-3). 139 */ 140 public IS[] getLoc3_LocationType() { 141 IS[] retVal = this.getTypedField(3, new IS[0]); 142 return retVal; 143 } 144 145 146 /** 147 * Returns a count of the current number of repetitions of Location Type (LOC-3). 148 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 149 * it will return zero. 150 */ 151 public int getLocationTypeReps() { 152 return this.getReps(3); 153 } 154 155 156 /** 157 * Returns a specific repetition of 158 * LOC-3: "Location Type" - creates it if necessary 159 * 160 * @param rep The repetition index (0-indexed) 161 */ 162 public IS getLocationType(int rep) { 163 IS retVal = this.getTypedField(3, rep); 164 return retVal; 165 } 166 167 /** 168 * Returns a specific repetition of 169 * LOC-3: "Location Type" - creates it if necessary 170 * 171 * @param rep The repetition index (0-indexed) 172 */ 173 public IS getLoc3_LocationType(int rep) { 174 IS retVal = this.getTypedField(3, rep); 175 return retVal; 176 } 177 178 /** 179 * Returns a count of the current number of repetitions of Location Type (LOC-3). 180 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 181 * it will return zero. 182 */ 183 public int getLoc3_LocationTypeReps() { 184 return this.getReps(3); 185 } 186 187 188 /** 189 * Inserts a repetition of 190 * LOC-3: "Location Type" at a specific index 191 * 192 * @param rep The repetition index (0-indexed) 193 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 194 */ 195 public IS insertLocationType(int rep) throws HL7Exception { 196 return (IS) super.insertRepetition(3, rep); 197 } 198 199 200 /** 201 * Inserts a repetition of 202 * LOC-3: "Location Type" at a specific index 203 * 204 * @param rep The repetition index (0-indexed) 205 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 206 */ 207 public IS insertLoc3_LocationType(int rep) throws HL7Exception { 208 return (IS) super.insertRepetition(3, rep); 209 } 210 211 212 /** 213 * Removes a repetition of 214 * LOC-3: "Location Type" at a specific index 215 * 216 * @param rep The repetition index (0-indexed) 217 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 218 */ 219 public IS removeLocationType(int rep) throws HL7Exception { 220 return (IS) super.removeRepetition(3, rep); 221 } 222 223 224 /** 225 * Removes a repetition of 226 * LOC-3: "Location Type" at a specific index 227 * 228 * @param rep The repetition index (0-indexed) 229 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 230 */ 231 public IS removeLoc3_LocationType(int rep) throws HL7Exception { 232 return (IS) super.removeRepetition(3, rep); 233 } 234 235 236 237 238 /** 239 * Returns 240 * LOC-4: "Organization Name" - creates it if necessary 241 */ 242 public XON getOrganizationName() { 243 XON retVal = this.getTypedField(4, 0); 244 return retVal; 245 } 246 247 /** 248 * Returns 249 * LOC-4: "Organization Name" - creates it if necessary 250 */ 251 public XON getLoc4_OrganizationName() { 252 XON retVal = this.getTypedField(4, 0); 253 return retVal; 254 } 255 256 257 258 /** 259 * Returns 260 * LOC-5: "Location Address" - creates it if necessary 261 */ 262 public XAD getLocationAddress() { 263 XAD retVal = this.getTypedField(5, 0); 264 return retVal; 265 } 266 267 /** 268 * Returns 269 * LOC-5: "Location Address" - creates it if necessary 270 */ 271 public XAD getLoc5_LocationAddress() { 272 XAD retVal = this.getTypedField(5, 0); 273 return retVal; 274 } 275 276 277 /** 278 * Returns all repetitions of Location Phone (LOC-6). 279 */ 280 public XTN[] getLocationPhone() { 281 XTN[] retVal = this.getTypedField(6, new XTN[0]); 282 return retVal; 283 } 284 285 286 /** 287 * Returns all repetitions of Location Phone (LOC-6). 288 */ 289 public XTN[] getLoc6_LocationPhone() { 290 XTN[] retVal = this.getTypedField(6, new XTN[0]); 291 return retVal; 292 } 293 294 295 /** 296 * Returns a count of the current number of repetitions of Location Phone (LOC-6). 297 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 298 * it will return zero. 299 */ 300 public int getLocationPhoneReps() { 301 return this.getReps(6); 302 } 303 304 305 /** 306 * Returns a specific repetition of 307 * LOC-6: "Location Phone" - creates it if necessary 308 * 309 * @param rep The repetition index (0-indexed) 310 */ 311 public XTN getLocationPhone(int rep) { 312 XTN retVal = this.getTypedField(6, rep); 313 return retVal; 314 } 315 316 /** 317 * Returns a specific repetition of 318 * LOC-6: "Location Phone" - creates it if necessary 319 * 320 * @param rep The repetition index (0-indexed) 321 */ 322 public XTN getLoc6_LocationPhone(int rep) { 323 XTN retVal = this.getTypedField(6, rep); 324 return retVal; 325 } 326 327 /** 328 * Returns a count of the current number of repetitions of Location Phone (LOC-6). 329 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 330 * it will return zero. 331 */ 332 public int getLoc6_LocationPhoneReps() { 333 return this.getReps(6); 334 } 335 336 337 /** 338 * Inserts a repetition of 339 * LOC-6: "Location Phone" at a specific index 340 * 341 * @param rep The repetition index (0-indexed) 342 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 343 */ 344 public XTN insertLocationPhone(int rep) throws HL7Exception { 345 return (XTN) super.insertRepetition(6, rep); 346 } 347 348 349 /** 350 * Inserts a repetition of 351 * LOC-6: "Location Phone" at a specific index 352 * 353 * @param rep The repetition index (0-indexed) 354 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 355 */ 356 public XTN insertLoc6_LocationPhone(int rep) throws HL7Exception { 357 return (XTN) super.insertRepetition(6, rep); 358 } 359 360 361 /** 362 * Removes a repetition of 363 * LOC-6: "Location Phone" at a specific index 364 * 365 * @param rep The repetition index (0-indexed) 366 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 367 */ 368 public XTN removeLocationPhone(int rep) throws HL7Exception { 369 return (XTN) super.removeRepetition(6, rep); 370 } 371 372 373 /** 374 * Removes a repetition of 375 * LOC-6: "Location Phone" at a specific index 376 * 377 * @param rep The repetition index (0-indexed) 378 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 379 */ 380 public XTN removeLoc6_LocationPhone(int rep) throws HL7Exception { 381 return (XTN) super.removeRepetition(6, rep); 382 } 383 384 385 386 /** 387 * Returns all repetitions of License Number (LOC-7). 388 */ 389 public CE[] getLicenseNumber() { 390 CE[] retVal = this.getTypedField(7, new CE[0]); 391 return retVal; 392 } 393 394 395 /** 396 * Returns all repetitions of License Number (LOC-7). 397 */ 398 public CE[] getLoc7_LicenseNumber() { 399 CE[] retVal = this.getTypedField(7, new CE[0]); 400 return retVal; 401 } 402 403 404 /** 405 * Returns a count of the current number of repetitions of License Number (LOC-7). 406 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 407 * it will return zero. 408 */ 409 public int getLicenseNumberReps() { 410 return this.getReps(7); 411 } 412 413 414 /** 415 * Returns a specific repetition of 416 * LOC-7: "License Number" - creates it if necessary 417 * 418 * @param rep The repetition index (0-indexed) 419 */ 420 public CE getLicenseNumber(int rep) { 421 CE retVal = this.getTypedField(7, rep); 422 return retVal; 423 } 424 425 /** 426 * Returns a specific repetition of 427 * LOC-7: "License Number" - creates it if necessary 428 * 429 * @param rep The repetition index (0-indexed) 430 */ 431 public CE getLoc7_LicenseNumber(int rep) { 432 CE retVal = this.getTypedField(7, rep); 433 return retVal; 434 } 435 436 /** 437 * Returns a count of the current number of repetitions of License Number (LOC-7). 438 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 439 * it will return zero. 440 */ 441 public int getLoc7_LicenseNumberReps() { 442 return this.getReps(7); 443 } 444 445 446 /** 447 * Inserts a repetition of 448 * LOC-7: "License Number" 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 CE insertLicenseNumber(int rep) throws HL7Exception { 454 return (CE) super.insertRepetition(7, rep); 455 } 456 457 458 /** 459 * Inserts a repetition of 460 * LOC-7: "License Number" at a specific index 461 * 462 * @param rep The repetition index (0-indexed) 463 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 464 */ 465 public CE insertLoc7_LicenseNumber(int rep) throws HL7Exception { 466 return (CE) super.insertRepetition(7, rep); 467 } 468 469 470 /** 471 * Removes a repetition of 472 * LOC-7: "License Number" at a specific index 473 * 474 * @param rep The repetition index (0-indexed) 475 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 476 */ 477 public CE removeLicenseNumber(int rep) throws HL7Exception { 478 return (CE) super.removeRepetition(7, rep); 479 } 480 481 482 /** 483 * Removes a repetition of 484 * LOC-7: "License Number" at a specific index 485 * 486 * @param rep The repetition index (0-indexed) 487 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 488 */ 489 public CE removeLoc7_LicenseNumber(int rep) throws HL7Exception { 490 return (CE) super.removeRepetition(7, rep); 491 } 492 493 494 495 /** 496 * Returns all repetitions of Location Equipment (LOC-8). 497 */ 498 public ID[] getLocationEquipment() { 499 ID[] retVal = this.getTypedField(8, new ID[0]); 500 return retVal; 501 } 502 503 504 /** 505 * Returns all repetitions of Location Equipment (LOC-8). 506 */ 507 public ID[] getLoc8_LocationEquipment() { 508 ID[] retVal = this.getTypedField(8, new ID[0]); 509 return retVal; 510 } 511 512 513 /** 514 * Returns a count of the current number of repetitions of Location Equipment (LOC-8). 515 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 516 * it will return zero. 517 */ 518 public int getLocationEquipmentReps() { 519 return this.getReps(8); 520 } 521 522 523 /** 524 * Returns a specific repetition of 525 * LOC-8: "Location Equipment" - creates it if necessary 526 * 527 * @param rep The repetition index (0-indexed) 528 */ 529 public ID getLocationEquipment(int rep) { 530 ID retVal = this.getTypedField(8, rep); 531 return retVal; 532 } 533 534 /** 535 * Returns a specific repetition of 536 * LOC-8: "Location Equipment" - creates it if necessary 537 * 538 * @param rep The repetition index (0-indexed) 539 */ 540 public ID getLoc8_LocationEquipment(int rep) { 541 ID retVal = this.getTypedField(8, rep); 542 return retVal; 543 } 544 545 /** 546 * Returns a count of the current number of repetitions of Location Equipment (LOC-8). 547 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 548 * it will return zero. 549 */ 550 public int getLoc8_LocationEquipmentReps() { 551 return this.getReps(8); 552 } 553 554 555 /** 556 * Inserts a repetition of 557 * LOC-8: "Location Equipment" at a specific index 558 * 559 * @param rep The repetition index (0-indexed) 560 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 561 */ 562 public ID insertLocationEquipment(int rep) throws HL7Exception { 563 return (ID) super.insertRepetition(8, rep); 564 } 565 566 567 /** 568 * Inserts a repetition of 569 * LOC-8: "Location Equipment" at a specific index 570 * 571 * @param rep The repetition index (0-indexed) 572 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 573 */ 574 public ID insertLoc8_LocationEquipment(int rep) throws HL7Exception { 575 return (ID) super.insertRepetition(8, rep); 576 } 577 578 579 /** 580 * Removes a repetition of 581 * LOC-8: "Location Equipment" at a specific index 582 * 583 * @param rep The repetition index (0-indexed) 584 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 585 */ 586 public ID removeLocationEquipment(int rep) throws HL7Exception { 587 return (ID) super.removeRepetition(8, rep); 588 } 589 590 591 /** 592 * Removes a repetition of 593 * LOC-8: "Location Equipment" at a specific index 594 * 595 * @param rep The repetition index (0-indexed) 596 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 597 */ 598 public ID removeLoc8_LocationEquipment(int rep) throws HL7Exception { 599 return (ID) super.removeRepetition(8, rep); 600 } 601 602 603 604 605 606 607 /** {@inheritDoc} */ 608 protected Type createNewTypeWithoutReflection(int field) { 609 switch (field) { 610 case 0: return new PL(getMessage()); 611 case 1: return new ST(getMessage()); 612 case 2: return new IS(getMessage(), new Integer( 260 )); 613 case 3: return new XON(getMessage()); 614 case 4: return new XAD(getMessage()); 615 case 5: return new XTN(getMessage()); 616 case 6: return new CE(getMessage()); 617 case 7: return new ID(getMessage(), new Integer( 261 )); 618 default: return null; 619 } 620 } 621 622 623} 624