1 /* 2 * This class is an auto-generated source file for a HAPI 3 * HL7 v2.x standard structure class. 4 * 5 * For more information, visit: http://hl7api.sourceforge.net/ 6 * 7 * The contents of this file are subject to the Mozilla Public License Version 1.1 8 * (the "License"); you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 10 * Software distributed under the License is distributed on an "AS IS" basis, 11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 12 * specific language governing rights and limitations under the License. 13 * 14 * The Original Code is "[file_name]". Description: 15 * "[one_line_description]" 16 * 17 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 18 * 2012. All Rights Reserved. 19 * 20 * Contributor(s): ______________________________________. 21 * 22 * Alternatively, the contents of this file may be used under the terms of the 23 * GNU General Public License (the "GPL"), in which case the provisions of the GPL are 24 * applicable instead of those above. If you wish to allow use of your version of this 25 * file only under the terms of the GPL and not to allow others to use your version 26 * of this file under the MPL, indicate your decision by deleting the provisions above 27 * and replace them with the notice and other provisions required by the GPL License. 28 * If you do not delete the provisions above, a recipient may use your version of 29 * this file under either the MPL or the GPL. 30 * 31 */ 32 33 34 package ca.uhn.hl7v2.test.nodt.conf.segment; 35 36 // import ca.uhn.hl7v2.test.nodt.conf.group.*; 37 import ca.uhn.hl7v2.model.v25.datatype.*; 38 import ca.uhn.hl7v2.HL7Exception; 39 import ca.uhn.hl7v2.parser.ModelClassFactory; 40 import ca.uhn.hl7v2.parser.DefaultModelClassFactory; 41 import ca.uhn.hl7v2.model.AbstractMessage; 42 import ca.uhn.hl7v2.model.Group; 43 import ca.uhn.hl7v2.model.Type; 44 import ca.uhn.hl7v2.model.AbstractSegment; 45 import ca.uhn.hl7v2.model.Varies; 46 47 48 /** 49 *<p>Represents an HL7 EVN message segment (Event Type). 50 * This segment has the following fields:</p> 51 * <ul> 52 * <li>EVN-1: Event Type Code (ID) <b>optional repeating</b> 53 * <li>EVN-2: Recorded Date/Time (TS) <b> </b> 54 * <li>EVN-3: Date/Time Planned Event (TS) <b>optional </b> 55 * <li>EVN-4: Event Reason Code (IS) <b>optional </b> 56 * <li>EVN-5: Operator ID (XCN) <b>optional repeating</b> 57 * <li>EVN-6: Event Occurred (TS) <b>optional </b> 58 * <li>EVN-7: Event Facility (HD) <b>optional </b> 59 * </ul> 60 */ 61 @SuppressWarnings("unused") 62 public class EVN extends AbstractSegment { 63 64 /** 65 * Creates a new EVN segment 66 */ 67 public EVN(Group parent, ModelClassFactory factory) { 68 super(parent, factory); 69 init(factory); 70 } 71 72 private void init(ModelClassFactory factory) { 73 try { 74 this.add(ID.class, false, -1, 3, new Object[]{ getMessage(), new Integer(3) }, "Event Type Code"); 75 this.add(TS.class, true, 1, 26, new Object[]{ getMessage() }, "Recorded Date/Time"); 76 this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Date/Time Planned Event"); 77 this.add(IS.class, false, 1, 3, new Object[]{ getMessage(), new Integer(62) }, "Event Reason Code"); 78 this.add(XCN.class, false, -1, 309, new Object[]{ getMessage() }, "Operator ID"); 79 this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Event Occurred"); 80 this.add(HD.class, false, 1, 241, new Object[]{ getMessage() }, "Event Facility"); 81 } catch(HL7Exception e) { 82 log.error("Unexpected error creating EVN - this is probably a bug in the source code generator.", e); 83 } 84 } 85 86 87 /** 88 * Returns all repetitions of Event Type Code (EVN-1). 89 */ 90 public ID[] getEventTypeCode() { 91 ID[] retVal = this.getTypedField(1, new ID[0]); 92 return retVal; 93 } 94 95 96 /** 97 * Returns all repetitions of Event Type Code (EVN-1). 98 */ 99 public ID[] getEvn1_EventTypeCode() { 100 ID[] retVal = this.getTypedField(1, new ID[0]); 101 return retVal; 102 } 103 104 105 /** 106 * Returns a count of the current number of repetitions of Event Type Code (EVN-1). 107 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 108 * it will return zero. 109 */ 110 public int getEventTypeCodeReps() { 111 return this.getReps(1); 112 } 113 114 115 /** 116 * Returns a specific repetition of 117 * EVN-1: "Event Type Code" - creates it if necessary 118 * 119 * @param rep The repetition index (0-indexed) 120 */ 121 public ID getEventTypeCode(int rep) { 122 ID retVal = this.getTypedField(1, rep); 123 return retVal; 124 } 125 126 /** 127 * Returns a specific repetition of 128 * EVN-1: "Event Type Code" - creates it if necessary 129 * 130 * @param rep The repetition index (0-indexed) 131 */ 132 public ID getEvn1_EventTypeCode(int rep) { 133 ID retVal = this.getTypedField(1, rep); 134 return retVal; 135 } 136 137 /** 138 * Returns a count of the current number of repetitions of Event Type Code (EVN-1). 139 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 140 * it will return zero. 141 */ 142 public int getEvn1_EventTypeCodeReps() { 143 return this.getReps(1); 144 } 145 146 147 /** 148 * Inserts a repetition of 149 * EVN-1: "Event Type Code" at a specific index 150 * 151 * @param rep The repetition index (0-indexed) 152 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 153 */ 154 public ID insertEventTypeCode(int rep) throws HL7Exception { 155 return (ID) super.insertRepetition(1, rep); 156 } 157 158 159 /** 160 * Inserts a repetition of 161 * EVN-1: "Event Type Code" at a specific index 162 * 163 * @param rep The repetition index (0-indexed) 164 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 165 */ 166 public ID insertEvn1_EventTypeCode(int rep) throws HL7Exception { 167 return (ID) super.insertRepetition(1, rep); 168 } 169 170 171 /** 172 * Removes a repetition of 173 * EVN-1: "Event Type Code" at a specific index 174 * 175 * @param rep The repetition index (0-indexed) 176 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 177 */ 178 public ID removeEventTypeCode(int rep) throws HL7Exception { 179 return (ID) super.removeRepetition(1, rep); 180 } 181 182 183 /** 184 * Removes a repetition of 185 * EVN-1: "Event Type Code" at a specific index 186 * 187 * @param rep The repetition index (0-indexed) 188 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 189 */ 190 public ID removeEvn1_EventTypeCode(int rep) throws HL7Exception { 191 return (ID) super.removeRepetition(1, rep); 192 } 193 194 195 196 197 /** 198 * Returns 199 * EVN-2: "Recorded Date/Time" - creates it if necessary 200 */ 201 public TS getRecordedDateTime() { 202 TS retVal = this.getTypedField(2, 0); 203 return retVal; 204 } 205 206 /** 207 * Returns 208 * EVN-2: "Recorded Date/Time" - creates it if necessary 209 */ 210 public TS getEvn2_RecordedDateTime() { 211 TS retVal = this.getTypedField(2, 0); 212 return retVal; 213 } 214 215 216 217 /** 218 * Returns 219 * EVN-3: "Date/Time Planned Event" - creates it if necessary 220 */ 221 public TS getDateTimePlannedEvent() { 222 TS retVal = this.getTypedField(3, 0); 223 return retVal; 224 } 225 226 /** 227 * Returns 228 * EVN-3: "Date/Time Planned Event" - creates it if necessary 229 */ 230 public TS getEvn3_DateTimePlannedEvent() { 231 TS retVal = this.getTypedField(3, 0); 232 return retVal; 233 } 234 235 236 237 /** 238 * Returns 239 * EVN-4: "Event Reason Code" - creates it if necessary 240 */ 241 public IS getEventReasonCode() { 242 IS retVal = this.getTypedField(4, 0); 243 return retVal; 244 } 245 246 /** 247 * Returns 248 * EVN-4: "Event Reason Code" - creates it if necessary 249 */ 250 public IS getEvn4_EventReasonCode() { 251 IS retVal = this.getTypedField(4, 0); 252 return retVal; 253 } 254 255 256 /** 257 * Returns all repetitions of Operator ID (EVN-5). 258 */ 259 public XCN[] getOperatorID() { 260 XCN[] retVal = this.getTypedField(5, new XCN[0]); 261 return retVal; 262 } 263 264 265 /** 266 * Returns all repetitions of Operator ID (EVN-5). 267 */ 268 public XCN[] getEvn5_OperatorID() { 269 XCN[] retVal = this.getTypedField(5, new XCN[0]); 270 return retVal; 271 } 272 273 274 /** 275 * Returns a count of the current number of repetitions of Operator ID (EVN-5). 276 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 277 * it will return zero. 278 */ 279 public int getOperatorIDReps() { 280 return this.getReps(5); 281 } 282 283 284 /** 285 * Returns a specific repetition of 286 * EVN-5: "Operator ID" - creates it if necessary 287 * 288 * @param rep The repetition index (0-indexed) 289 */ 290 public XCN getOperatorID(int rep) { 291 XCN retVal = this.getTypedField(5, rep); 292 return retVal; 293 } 294 295 /** 296 * Returns a specific repetition of 297 * EVN-5: "Operator ID" - creates it if necessary 298 * 299 * @param rep The repetition index (0-indexed) 300 */ 301 public XCN getEvn5_OperatorID(int rep) { 302 XCN retVal = this.getTypedField(5, rep); 303 return retVal; 304 } 305 306 /** 307 * Returns a count of the current number of repetitions of Operator ID (EVN-5). 308 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 309 * it will return zero. 310 */ 311 public int getEvn5_OperatorIDReps() { 312 return this.getReps(5); 313 } 314 315 316 /** 317 * Inserts a repetition of 318 * EVN-5: "Operator ID" at a specific index 319 * 320 * @param rep The repetition index (0-indexed) 321 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 322 */ 323 public XCN insertOperatorID(int rep) throws HL7Exception { 324 return (XCN) super.insertRepetition(5, rep); 325 } 326 327 328 /** 329 * Inserts a repetition of 330 * EVN-5: "Operator ID" at a specific index 331 * 332 * @param rep The repetition index (0-indexed) 333 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 334 */ 335 public XCN insertEvn5_OperatorID(int rep) throws HL7Exception { 336 return (XCN) super.insertRepetition(5, rep); 337 } 338 339 340 /** 341 * Removes a repetition of 342 * EVN-5: "Operator ID" at a specific index 343 * 344 * @param rep The repetition index (0-indexed) 345 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 346 */ 347 public XCN removeOperatorID(int rep) throws HL7Exception { 348 return (XCN) super.removeRepetition(5, rep); 349 } 350 351 352 /** 353 * Removes a repetition of 354 * EVN-5: "Operator ID" at a specific index 355 * 356 * @param rep The repetition index (0-indexed) 357 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 358 */ 359 public XCN removeEvn5_OperatorID(int rep) throws HL7Exception { 360 return (XCN) super.removeRepetition(5, rep); 361 } 362 363 364 365 366 /** 367 * Returns 368 * EVN-6: "Event Occurred" - creates it if necessary 369 */ 370 public TS getEventOccurred() { 371 TS retVal = this.getTypedField(6, 0); 372 return retVal; 373 } 374 375 /** 376 * Returns 377 * EVN-6: "Event Occurred" - creates it if necessary 378 */ 379 public TS getEvn6_EventOccurred() { 380 TS retVal = this.getTypedField(6, 0); 381 return retVal; 382 } 383 384 385 386 /** 387 * Returns 388 * EVN-7: "Event Facility" - creates it if necessary 389 */ 390 public HD getEventFacility() { 391 HD retVal = this.getTypedField(7, 0); 392 return retVal; 393 } 394 395 /** 396 * Returns 397 * EVN-7: "Event Facility" - creates it if necessary 398 */ 399 public HD getEvn7_EventFacility() { 400 HD retVal = this.getTypedField(7, 0); 401 return retVal; 402 } 403 404 405 406 407 408 /** {@inheritDoc} */ 409 protected Type createNewTypeWithoutReflection(int field) { 410 switch (field) { 411 case 0: return new ID(getMessage(), new Integer( 3 )); 412 case 1: return new TS(getMessage()); 413 case 2: return new TS(getMessage()); 414 case 3: return new IS(getMessage(), new Integer( 62 )); 415 case 4: return new XCN(getMessage()); 416 case 5: return new TS(getMessage()); 417 case 6: return new HD(getMessage()); 418 default: return null; 419 } 420 } 421 422 423 } 424