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.v27.segment; 035 036// import ca.uhn.hl7v2.model.v27.group.*; 037import ca.uhn.hl7v2.model.v27.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 PAC message segment (Shipment Package). 050 * This segment has the following fields:</p> 051 * <ul> 052 * <li>PAC-1: Set Id - PAC (SI) <b> </b> 053 * <li>PAC-2: Package ID (EI) <b>optional </b> 054 * <li>PAC-3: Parent Package ID (EI) <b>optional </b> 055 * <li>PAC-4: Position in Parent Package (NA) <b>optional </b> 056 * <li>PAC-5: Package Type (CWE) <b> </b> 057 * <li>PAC-6: Package Condition (CWE) <b>optional repeating</b> 058 * <li>PAC-7: Package Handling Code (CWE) <b>optional repeating</b> 059 * <li>PAC-8: Package Risk Code (CWE) <b>optional repeating</b> 060 * </ul> 061 */ 062@SuppressWarnings("unused") 063public class PAC extends AbstractSegment { 064 065 /** 066 * Creates a new PAC segment 067 */ 068 public PAC(Group parent, ModelClassFactory factory) { 069 super(parent, factory); 070 init(factory); 071 } 072 073 private void init(ModelClassFactory factory) { 074 try { 075 this.add(SI.class, true, 1, 4, new Object[]{ getMessage() }, "Set Id - PAC"); 076 this.add(EI.class, false, 1, 0, new Object[]{ getMessage() }, "Package ID"); 077 this.add(EI.class, false, 1, 0, new Object[]{ getMessage() }, "Parent Package ID"); 078 this.add(NA.class, false, 1, 0, new Object[]{ getMessage() }, "Position in Parent Package"); 079 this.add(CWE.class, true, 1, 0, new Object[]{ getMessage() }, "Package Type"); 080 this.add(CWE.class, false, 0, 0, new Object[]{ getMessage() }, "Package Condition"); 081 this.add(CWE.class, false, 0, 0, new Object[]{ getMessage() }, "Package Handling Code"); 082 this.add(CWE.class, false, 0, 0, new Object[]{ getMessage() }, "Package Risk Code"); 083 } catch(HL7Exception e) { 084 log.error("Unexpected error creating PAC - this is probably a bug in the source code generator.", e); 085 } 086 } 087 088 089 090 /** 091 * Returns 092 * PAC-1: "Set Id - PAC" - creates it if necessary 093 */ 094 public SI getSetIdPAC() { 095 SI retVal = this.getTypedField(1, 0); 096 return retVal; 097 } 098 099 /** 100 * Returns 101 * PAC-1: "Set Id - PAC" - creates it if necessary 102 */ 103 public SI getPac1_SetIdPAC() { 104 SI retVal = this.getTypedField(1, 0); 105 return retVal; 106 } 107 108 109 110 /** 111 * Returns 112 * PAC-2: "Package ID" - creates it if necessary 113 */ 114 public EI getPackageID() { 115 EI retVal = this.getTypedField(2, 0); 116 return retVal; 117 } 118 119 /** 120 * Returns 121 * PAC-2: "Package ID" - creates it if necessary 122 */ 123 public EI getPac2_PackageID() { 124 EI retVal = this.getTypedField(2, 0); 125 return retVal; 126 } 127 128 129 130 /** 131 * Returns 132 * PAC-3: "Parent Package ID" - creates it if necessary 133 */ 134 public EI getParentPackageID() { 135 EI retVal = this.getTypedField(3, 0); 136 return retVal; 137 } 138 139 /** 140 * Returns 141 * PAC-3: "Parent Package ID" - creates it if necessary 142 */ 143 public EI getPac3_ParentPackageID() { 144 EI retVal = this.getTypedField(3, 0); 145 return retVal; 146 } 147 148 149 150 /** 151 * Returns 152 * PAC-4: "Position in Parent Package" - creates it if necessary 153 */ 154 public NA getPositionInParentPackage() { 155 NA retVal = this.getTypedField(4, 0); 156 return retVal; 157 } 158 159 /** 160 * Returns 161 * PAC-4: "Position in Parent Package" - creates it if necessary 162 */ 163 public NA getPac4_PositionInParentPackage() { 164 NA retVal = this.getTypedField(4, 0); 165 return retVal; 166 } 167 168 169 170 /** 171 * Returns 172 * PAC-5: "Package Type" - creates it if necessary 173 */ 174 public CWE getPackageType() { 175 CWE retVal = this.getTypedField(5, 0); 176 return retVal; 177 } 178 179 /** 180 * Returns 181 * PAC-5: "Package Type" - creates it if necessary 182 */ 183 public CWE getPac5_PackageType() { 184 CWE retVal = this.getTypedField(5, 0); 185 return retVal; 186 } 187 188 189 /** 190 * Returns all repetitions of Package Condition (PAC-6). 191 */ 192 public CWE[] getPackageCondition() { 193 CWE[] retVal = this.getTypedField(6, new CWE[0]); 194 return retVal; 195 } 196 197 198 /** 199 * Returns all repetitions of Package Condition (PAC-6). 200 */ 201 public CWE[] getPac6_PackageCondition() { 202 CWE[] retVal = this.getTypedField(6, new CWE[0]); 203 return retVal; 204 } 205 206 207 /** 208 * Returns a count of the current number of repetitions of Package Condition (PAC-6). 209 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 210 * it will return zero. 211 */ 212 public int getPackageConditionReps() { 213 return this.getReps(6); 214 } 215 216 217 /** 218 * Returns a specific repetition of 219 * PAC-6: "Package Condition" - creates it if necessary 220 * 221 * @param rep The repetition index (0-indexed) 222 */ 223 public CWE getPackageCondition(int rep) { 224 CWE retVal = this.getTypedField(6, rep); 225 return retVal; 226 } 227 228 /** 229 * Returns a specific repetition of 230 * PAC-6: "Package Condition" - creates it if necessary 231 * 232 * @param rep The repetition index (0-indexed) 233 */ 234 public CWE getPac6_PackageCondition(int rep) { 235 CWE retVal = this.getTypedField(6, rep); 236 return retVal; 237 } 238 239 /** 240 * Returns a count of the current number of repetitions of Package Condition (PAC-6). 241 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 242 * it will return zero. 243 */ 244 public int getPac6_PackageConditionReps() { 245 return this.getReps(6); 246 } 247 248 249 /** 250 * Inserts a repetition of 251 * PAC-6: "Package Condition" at a specific index 252 * 253 * @param rep The repetition index (0-indexed) 254 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 255 */ 256 public CWE insertPackageCondition(int rep) throws HL7Exception { 257 return (CWE) super.insertRepetition(6, rep); 258 } 259 260 261 /** 262 * Inserts a repetition of 263 * PAC-6: "Package Condition" at a specific index 264 * 265 * @param rep The repetition index (0-indexed) 266 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 267 */ 268 public CWE insertPac6_PackageCondition(int rep) throws HL7Exception { 269 return (CWE) super.insertRepetition(6, rep); 270 } 271 272 273 /** 274 * Removes a repetition of 275 * PAC-6: "Package Condition" at a specific index 276 * 277 * @param rep The repetition index (0-indexed) 278 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 279 */ 280 public CWE removePackageCondition(int rep) throws HL7Exception { 281 return (CWE) super.removeRepetition(6, rep); 282 } 283 284 285 /** 286 * Removes a repetition of 287 * PAC-6: "Package Condition" at a specific index 288 * 289 * @param rep The repetition index (0-indexed) 290 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 291 */ 292 public CWE removePac6_PackageCondition(int rep) throws HL7Exception { 293 return (CWE) super.removeRepetition(6, rep); 294 } 295 296 297 298 /** 299 * Returns all repetitions of Package Handling Code (PAC-7). 300 */ 301 public CWE[] getPackageHandlingCode() { 302 CWE[] retVal = this.getTypedField(7, new CWE[0]); 303 return retVal; 304 } 305 306 307 /** 308 * Returns all repetitions of Package Handling Code (PAC-7). 309 */ 310 public CWE[] getPac7_PackageHandlingCode() { 311 CWE[] retVal = this.getTypedField(7, new CWE[0]); 312 return retVal; 313 } 314 315 316 /** 317 * Returns a count of the current number of repetitions of Package Handling Code (PAC-7). 318 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 319 * it will return zero. 320 */ 321 public int getPackageHandlingCodeReps() { 322 return this.getReps(7); 323 } 324 325 326 /** 327 * Returns a specific repetition of 328 * PAC-7: "Package Handling Code" - creates it if necessary 329 * 330 * @param rep The repetition index (0-indexed) 331 */ 332 public CWE getPackageHandlingCode(int rep) { 333 CWE retVal = this.getTypedField(7, rep); 334 return retVal; 335 } 336 337 /** 338 * Returns a specific repetition of 339 * PAC-7: "Package Handling Code" - creates it if necessary 340 * 341 * @param rep The repetition index (0-indexed) 342 */ 343 public CWE getPac7_PackageHandlingCode(int rep) { 344 CWE retVal = this.getTypedField(7, rep); 345 return retVal; 346 } 347 348 /** 349 * Returns a count of the current number of repetitions of Package Handling Code (PAC-7). 350 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 351 * it will return zero. 352 */ 353 public int getPac7_PackageHandlingCodeReps() { 354 return this.getReps(7); 355 } 356 357 358 /** 359 * Inserts a repetition of 360 * PAC-7: "Package Handling Code" at a specific index 361 * 362 * @param rep The repetition index (0-indexed) 363 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 364 */ 365 public CWE insertPackageHandlingCode(int rep) throws HL7Exception { 366 return (CWE) super.insertRepetition(7, rep); 367 } 368 369 370 /** 371 * Inserts a repetition of 372 * PAC-7: "Package Handling Code" at a specific index 373 * 374 * @param rep The repetition index (0-indexed) 375 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 376 */ 377 public CWE insertPac7_PackageHandlingCode(int rep) throws HL7Exception { 378 return (CWE) super.insertRepetition(7, rep); 379 } 380 381 382 /** 383 * Removes a repetition of 384 * PAC-7: "Package Handling Code" at a specific index 385 * 386 * @param rep The repetition index (0-indexed) 387 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 388 */ 389 public CWE removePackageHandlingCode(int rep) throws HL7Exception { 390 return (CWE) super.removeRepetition(7, rep); 391 } 392 393 394 /** 395 * Removes a repetition of 396 * PAC-7: "Package Handling Code" at a specific index 397 * 398 * @param rep The repetition index (0-indexed) 399 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 400 */ 401 public CWE removePac7_PackageHandlingCode(int rep) throws HL7Exception { 402 return (CWE) super.removeRepetition(7, rep); 403 } 404 405 406 407 /** 408 * Returns all repetitions of Package Risk Code (PAC-8). 409 */ 410 public CWE[] getPackageRiskCode() { 411 CWE[] retVal = this.getTypedField(8, new CWE[0]); 412 return retVal; 413 } 414 415 416 /** 417 * Returns all repetitions of Package Risk Code (PAC-8). 418 */ 419 public CWE[] getPac8_PackageRiskCode() { 420 CWE[] retVal = this.getTypedField(8, new CWE[0]); 421 return retVal; 422 } 423 424 425 /** 426 * Returns a count of the current number of repetitions of Package Risk Code (PAC-8). 427 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 428 * it will return zero. 429 */ 430 public int getPackageRiskCodeReps() { 431 return this.getReps(8); 432 } 433 434 435 /** 436 * Returns a specific repetition of 437 * PAC-8: "Package Risk Code" - creates it if necessary 438 * 439 * @param rep The repetition index (0-indexed) 440 */ 441 public CWE getPackageRiskCode(int rep) { 442 CWE retVal = this.getTypedField(8, rep); 443 return retVal; 444 } 445 446 /** 447 * Returns a specific repetition of 448 * PAC-8: "Package Risk Code" - creates it if necessary 449 * 450 * @param rep The repetition index (0-indexed) 451 */ 452 public CWE getPac8_PackageRiskCode(int rep) { 453 CWE retVal = this.getTypedField(8, rep); 454 return retVal; 455 } 456 457 /** 458 * Returns a count of the current number of repetitions of Package Risk Code (PAC-8). 459 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 460 * it will return zero. 461 */ 462 public int getPac8_PackageRiskCodeReps() { 463 return this.getReps(8); 464 } 465 466 467 /** 468 * Inserts a repetition of 469 * PAC-8: "Package Risk Code" at a specific index 470 * 471 * @param rep The repetition index (0-indexed) 472 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 473 */ 474 public CWE insertPackageRiskCode(int rep) throws HL7Exception { 475 return (CWE) super.insertRepetition(8, rep); 476 } 477 478 479 /** 480 * Inserts a repetition of 481 * PAC-8: "Package Risk Code" at a specific index 482 * 483 * @param rep The repetition index (0-indexed) 484 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 485 */ 486 public CWE insertPac8_PackageRiskCode(int rep) throws HL7Exception { 487 return (CWE) super.insertRepetition(8, rep); 488 } 489 490 491 /** 492 * Removes a repetition of 493 * PAC-8: "Package Risk Code" at a specific index 494 * 495 * @param rep The repetition index (0-indexed) 496 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 497 */ 498 public CWE removePackageRiskCode(int rep) throws HL7Exception { 499 return (CWE) super.removeRepetition(8, rep); 500 } 501 502 503 /** 504 * Removes a repetition of 505 * PAC-8: "Package Risk Code" at a specific index 506 * 507 * @param rep The repetition index (0-indexed) 508 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 509 */ 510 public CWE removePac8_PackageRiskCode(int rep) throws HL7Exception { 511 return (CWE) super.removeRepetition(8, rep); 512 } 513 514 515 516 517 518 519 /** {@inheritDoc} */ 520 protected Type createNewTypeWithoutReflection(int field) { 521 switch (field) { 522 case 0: return new SI(getMessage()); 523 case 1: return new EI(getMessage()); 524 case 2: return new EI(getMessage()); 525 case 3: return new NA(getMessage()); 526 case 4: return new CWE(getMessage()); 527 case 5: return new CWE(getMessage()); 528 case 6: return new CWE(getMessage()); 529 case 7: return new CWE(getMessage()); 530 default: return null; 531 } 532 } 533 534 535} 536