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.v21.segment; 035 036// import ca.uhn.hl7v2.model.v21.group.*; 037import ca.uhn.hl7v2.model.v21.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 URS message segment (UNSOLICITED SELECTION). 049 * This segment has the following fields:</p> 050 * <ul> 051 * <li>URS-1: R/U WHERE SUBJECT DEFINITION (ST) <b> repeating</b> 052 * <li>URS-2: R/U WHEN DATA START DATE/TIME (TS) <b>optional </b> 053 * <li>URS-3: R/U WHEN DATA END DATE/TIME (TS) <b>optional </b> 054 * <li>URS-4: R/U WHAT USER QUALIFIER (ST) <b>optional repeating</b> 055 * <li>URS-5: R/U OTHER RESULTS SUBJECT DEFINI (ST) <b>optional repeating</b> 056 * </ul> 057 */ 058@SuppressWarnings("unused") 059public class URS extends AbstractSegment { 060 061 /** 062 * Creates a new URS segment 063 */ 064 public URS(Group parent, ModelClassFactory factory) { 065 super(parent, factory); 066 init(factory); 067 } 068 069 private void init(ModelClassFactory factory) { 070 try { 071 this.add(ST.class, true, 0, 20, new Object[]{ getMessage() }, "R/U WHERE SUBJECT DEFINITION"); 072 this.add(TS.class, false, 1, 19, new Object[]{ getMessage() }, "R/U WHEN DATA START DATE/TIME"); 073 this.add(TS.class, false, 1, 19, new Object[]{ getMessage() }, "R/U WHEN DATA END DATE/TIME"); 074 this.add(ST.class, false, 0, 20, new Object[]{ getMessage() }, "R/U WHAT USER QUALIFIER"); 075 this.add(ST.class, false, 0, 20, new Object[]{ getMessage() }, "R/U OTHER RESULTS SUBJECT DEFINI"); 076 } catch(HL7Exception e) { 077 log.error("Unexpected error creating URS - this is probably a bug in the source code generator.", e); 078 } 079 } 080 081 082 /** 083 * Returns all repetitions of R/U WHERE SUBJECT DEFINITION (URS-1). 084 */ 085 public ST[] getRUWHERESUBJECTDEFINITION() { 086 ST[] retVal = this.getTypedField(1, new ST[0]); 087 return retVal; 088 } 089 090 091 /** 092 * Returns all repetitions of R/U WHERE SUBJECT DEFINITION (URS-1). 093 */ 094 public ST[] getUrs1_RUWHERESUBJECTDEFINITION() { 095 ST[] retVal = this.getTypedField(1, new ST[0]); 096 return retVal; 097 } 098 099 100 /** 101 * Returns a count of the current number of repetitions of R/U WHERE SUBJECT DEFINITION (URS-1). 102 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 103 * it will return zero. 104 */ 105 public int getRUWHERESUBJECTDEFINITIONReps() { 106 return this.getReps(1); 107 } 108 109 110 /** 111 * Returns a specific repetition of 112 * URS-1: "R/U WHERE SUBJECT DEFINITION" - creates it if necessary 113 * 114 * @param rep The repetition index (0-indexed) 115 */ 116 public ST getRUWHERESUBJECTDEFINITION(int rep) { 117 ST retVal = this.getTypedField(1, rep); 118 return retVal; 119 } 120 121 /** 122 * Returns a specific repetition of 123 * URS-1: "R/U WHERE SUBJECT DEFINITION" - creates it if necessary 124 * 125 * @param rep The repetition index (0-indexed) 126 */ 127 public ST getUrs1_RUWHERESUBJECTDEFINITION(int rep) { 128 ST retVal = this.getTypedField(1, rep); 129 return retVal; 130 } 131 132 /** 133 * Returns a count of the current number of repetitions of R/U WHERE SUBJECT DEFINITION (URS-1). 134 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 135 * it will return zero. 136 */ 137 public int getUrs1_RUWHERESUBJECTDEFINITIONReps() { 138 return this.getReps(1); 139 } 140 141 142 /** 143 * Inserts a repetition of 144 * URS-1: "R/U WHERE SUBJECT DEFINITION" at a specific index 145 * 146 * @param rep The repetition index (0-indexed) 147 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 148 */ 149 public ST insertRUWHERESUBJECTDEFINITION(int rep) throws HL7Exception { 150 return (ST) super.insertRepetition(1, rep); 151 } 152 153 154 /** 155 * Inserts a repetition of 156 * URS-1: "R/U WHERE SUBJECT DEFINITION" at a specific index 157 * 158 * @param rep The repetition index (0-indexed) 159 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 160 */ 161 public ST insertUrs1_RUWHERESUBJECTDEFINITION(int rep) throws HL7Exception { 162 return (ST) super.insertRepetition(1, rep); 163 } 164 165 166 /** 167 * Removes a repetition of 168 * URS-1: "R/U WHERE SUBJECT DEFINITION" 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 ST removeRUWHERESUBJECTDEFINITION(int rep) throws HL7Exception { 174 return (ST) super.removeRepetition(1, rep); 175 } 176 177 178 /** 179 * Removes a repetition of 180 * URS-1: "R/U WHERE SUBJECT DEFINITION" 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 ST removeUrs1_RUWHERESUBJECTDEFINITION(int rep) throws HL7Exception { 186 return (ST) super.removeRepetition(1, rep); 187 } 188 189 190 191 192 /** 193 * Returns 194 * URS-2: "R/U WHEN DATA START DATE/TIME" - creates it if necessary 195 */ 196 public TS getRUWHENDATASTARTDATETIME() { 197 TS retVal = this.getTypedField(2, 0); 198 return retVal; 199 } 200 201 /** 202 * Returns 203 * URS-2: "R/U WHEN DATA START DATE/TIME" - creates it if necessary 204 */ 205 public TS getUrs2_RUWHENDATASTARTDATETIME() { 206 TS retVal = this.getTypedField(2, 0); 207 return retVal; 208 } 209 210 211 212 /** 213 * Returns 214 * URS-3: "R/U WHEN DATA END DATE/TIME" - creates it if necessary 215 */ 216 public TS getRUWHENDATAENDDATETIME() { 217 TS retVal = this.getTypedField(3, 0); 218 return retVal; 219 } 220 221 /** 222 * Returns 223 * URS-3: "R/U WHEN DATA END DATE/TIME" - creates it if necessary 224 */ 225 public TS getUrs3_RUWHENDATAENDDATETIME() { 226 TS retVal = this.getTypedField(3, 0); 227 return retVal; 228 } 229 230 231 /** 232 * Returns all repetitions of R/U WHAT USER QUALIFIER (URS-4). 233 */ 234 public ST[] getRUWHATUSERQUALIFIER() { 235 ST[] retVal = this.getTypedField(4, new ST[0]); 236 return retVal; 237 } 238 239 240 /** 241 * Returns all repetitions of R/U WHAT USER QUALIFIER (URS-4). 242 */ 243 public ST[] getUrs4_RUWHATUSERQUALIFIER() { 244 ST[] retVal = this.getTypedField(4, new ST[0]); 245 return retVal; 246 } 247 248 249 /** 250 * Returns a count of the current number of repetitions of R/U WHAT USER QUALIFIER (URS-4). 251 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 252 * it will return zero. 253 */ 254 public int getRUWHATUSERQUALIFIERReps() { 255 return this.getReps(4); 256 } 257 258 259 /** 260 * Returns a specific repetition of 261 * URS-4: "R/U WHAT USER QUALIFIER" - creates it if necessary 262 * 263 * @param rep The repetition index (0-indexed) 264 */ 265 public ST getRUWHATUSERQUALIFIER(int rep) { 266 ST retVal = this.getTypedField(4, rep); 267 return retVal; 268 } 269 270 /** 271 * Returns a specific repetition of 272 * URS-4: "R/U WHAT USER QUALIFIER" - creates it if necessary 273 * 274 * @param rep The repetition index (0-indexed) 275 */ 276 public ST getUrs4_RUWHATUSERQUALIFIER(int rep) { 277 ST retVal = this.getTypedField(4, rep); 278 return retVal; 279 } 280 281 /** 282 * Returns a count of the current number of repetitions of R/U WHAT USER QUALIFIER (URS-4). 283 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 284 * it will return zero. 285 */ 286 public int getUrs4_RUWHATUSERQUALIFIERReps() { 287 return this.getReps(4); 288 } 289 290 291 /** 292 * Inserts a repetition of 293 * URS-4: "R/U WHAT USER QUALIFIER" 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 ST insertRUWHATUSERQUALIFIER(int rep) throws HL7Exception { 299 return (ST) super.insertRepetition(4, rep); 300 } 301 302 303 /** 304 * Inserts a repetition of 305 * URS-4: "R/U WHAT USER QUALIFIER" at a specific index 306 * 307 * @param rep The repetition index (0-indexed) 308 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 309 */ 310 public ST insertUrs4_RUWHATUSERQUALIFIER(int rep) throws HL7Exception { 311 return (ST) super.insertRepetition(4, rep); 312 } 313 314 315 /** 316 * Removes a repetition of 317 * URS-4: "R/U WHAT USER QUALIFIER" at a specific index 318 * 319 * @param rep The repetition index (0-indexed) 320 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 321 */ 322 public ST removeRUWHATUSERQUALIFIER(int rep) throws HL7Exception { 323 return (ST) super.removeRepetition(4, rep); 324 } 325 326 327 /** 328 * Removes a repetition of 329 * URS-4: "R/U WHAT USER QUALIFIER" at a specific index 330 * 331 * @param rep The repetition index (0-indexed) 332 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 333 */ 334 public ST removeUrs4_RUWHATUSERQUALIFIER(int rep) throws HL7Exception { 335 return (ST) super.removeRepetition(4, rep); 336 } 337 338 339 340 /** 341 * Returns all repetitions of R/U OTHER RESULTS SUBJECT DEFINI (URS-5). 342 */ 343 public ST[] getRUOTHERRESULTSSUBJECTDEFINI() { 344 ST[] retVal = this.getTypedField(5, new ST[0]); 345 return retVal; 346 } 347 348 349 /** 350 * Returns all repetitions of R/U OTHER RESULTS SUBJECT DEFINI (URS-5). 351 */ 352 public ST[] getUrs5_RUOTHERRESULTSSUBJECTDEFINI() { 353 ST[] retVal = this.getTypedField(5, new ST[0]); 354 return retVal; 355 } 356 357 358 /** 359 * Returns a count of the current number of repetitions of R/U OTHER RESULTS SUBJECT DEFINI (URS-5). 360 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 361 * it will return zero. 362 */ 363 public int getRUOTHERRESULTSSUBJECTDEFINIReps() { 364 return this.getReps(5); 365 } 366 367 368 /** 369 * Returns a specific repetition of 370 * URS-5: "R/U OTHER RESULTS SUBJECT DEFINI" - creates it if necessary 371 * 372 * @param rep The repetition index (0-indexed) 373 */ 374 public ST getRUOTHERRESULTSSUBJECTDEFINI(int rep) { 375 ST retVal = this.getTypedField(5, rep); 376 return retVal; 377 } 378 379 /** 380 * Returns a specific repetition of 381 * URS-5: "R/U OTHER RESULTS SUBJECT DEFINI" - creates it if necessary 382 * 383 * @param rep The repetition index (0-indexed) 384 */ 385 public ST getUrs5_RUOTHERRESULTSSUBJECTDEFINI(int rep) { 386 ST retVal = this.getTypedField(5, rep); 387 return retVal; 388 } 389 390 /** 391 * Returns a count of the current number of repetitions of R/U OTHER RESULTS SUBJECT DEFINI (URS-5). 392 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 393 * it will return zero. 394 */ 395 public int getUrs5_RUOTHERRESULTSSUBJECTDEFINIReps() { 396 return this.getReps(5); 397 } 398 399 400 /** 401 * Inserts a repetition of 402 * URS-5: "R/U OTHER RESULTS SUBJECT DEFINI" 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 ST insertRUOTHERRESULTSSUBJECTDEFINI(int rep) throws HL7Exception { 408 return (ST) super.insertRepetition(5, rep); 409 } 410 411 412 /** 413 * Inserts a repetition of 414 * URS-5: "R/U OTHER RESULTS SUBJECT DEFINI" at a specific index 415 * 416 * @param rep The repetition index (0-indexed) 417 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 418 */ 419 public ST insertUrs5_RUOTHERRESULTSSUBJECTDEFINI(int rep) throws HL7Exception { 420 return (ST) super.insertRepetition(5, rep); 421 } 422 423 424 /** 425 * Removes a repetition of 426 * URS-5: "R/U OTHER RESULTS SUBJECT DEFINI" at a specific index 427 * 428 * @param rep The repetition index (0-indexed) 429 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 430 */ 431 public ST removeRUOTHERRESULTSSUBJECTDEFINI(int rep) throws HL7Exception { 432 return (ST) super.removeRepetition(5, rep); 433 } 434 435 436 /** 437 * Removes a repetition of 438 * URS-5: "R/U OTHER RESULTS SUBJECT DEFINI" at a specific index 439 * 440 * @param rep The repetition index (0-indexed) 441 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 442 */ 443 public ST removeUrs5_RUOTHERRESULTSSUBJECTDEFINI(int rep) throws HL7Exception { 444 return (ST) super.removeRepetition(5, rep); 445 } 446 447 448 449 450 451 452 /** {@inheritDoc} */ 453 protected Type createNewTypeWithoutReflection(int field) { 454 switch (field) { 455 case 0: return new ST(getMessage()); 456 case 1: return new TS(getMessage()); 457 case 2: return new TS(getMessage()); 458 case 3: return new ST(getMessage()); 459 case 4: return new ST(getMessage()); 460 default: return null; 461 } 462 } 463 464 465} 466