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