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.v24.segment; 035 036// import ca.uhn.hl7v2.model.v24.group.*; 037import ca.uhn.hl7v2.model.v24.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 EVN message segment (Event Type). 049 * This segment has the following fields:</p> 050 * <ul> 051 * <li>EVN-1: Event Type Code (ID) <b>optional </b> 052 * <li>EVN-2: Recorded Date/Time (TS) <b> </b> 053 * <li>EVN-3: Date/Time Planned Event (TS) <b>optional </b> 054 * <li>EVN-4: Event Reason Code (IS) <b>optional </b> 055 * <li>EVN-5: Operator ID (XCN) <b>optional repeating</b> 056 * <li>EVN-6: Event Occurred (TS) <b>optional </b> 057 * <li>EVN-7: Event Facility (HD) <b>optional </b> 058 * </ul> 059 */ 060@SuppressWarnings("unused") 061public class EVN extends AbstractSegment { 062 063 /** 064 * Creates a new EVN segment 065 */ 066 public EVN(Group parent, ModelClassFactory factory) { 067 super(parent, factory); 068 init(factory); 069 } 070 071 private void init(ModelClassFactory factory) { 072 try { 073 this.add(ID.class, false, 1, 3, new Object[]{ getMessage(), new Integer(3) }, "Event Type Code"); 074 this.add(TS.class, true, 1, 26, new Object[]{ getMessage() }, "Recorded Date/Time"); 075 this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Date/Time Planned Event"); 076 this.add(IS.class, false, 1, 3, new Object[]{ getMessage(), new Integer(62) }, "Event Reason Code"); 077 this.add(XCN.class, false, 0, 250, new Object[]{ getMessage() }, "Operator ID"); 078 this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Event Occurred"); 079 this.add(HD.class, false, 1, 180, new Object[]{ getMessage() }, "Event Facility"); 080 } catch(HL7Exception e) { 081 log.error("Unexpected error creating EVN - this is probably a bug in the source code generator.", e); 082 } 083 } 084 085 086 087 /** 088 * Returns 089 * EVN-1: "Event Type Code" - creates it if necessary 090 */ 091 public ID getEventTypeCode() { 092 ID retVal = this.getTypedField(1, 0); 093 return retVal; 094 } 095 096 /** 097 * Returns 098 * EVN-1: "Event Type Code" - creates it if necessary 099 */ 100 public ID getEvn1_EventTypeCode() { 101 ID retVal = this.getTypedField(1, 0); 102 return retVal; 103 } 104 105 106 107 /** 108 * Returns 109 * EVN-2: "Recorded Date/Time" - creates it if necessary 110 */ 111 public TS getRecordedDateTime() { 112 TS retVal = this.getTypedField(2, 0); 113 return retVal; 114 } 115 116 /** 117 * Returns 118 * EVN-2: "Recorded Date/Time" - creates it if necessary 119 */ 120 public TS getEvn2_RecordedDateTime() { 121 TS retVal = this.getTypedField(2, 0); 122 return retVal; 123 } 124 125 126 127 /** 128 * Returns 129 * EVN-3: "Date/Time Planned Event" - creates it if necessary 130 */ 131 public TS getDateTimePlannedEvent() { 132 TS retVal = this.getTypedField(3, 0); 133 return retVal; 134 } 135 136 /** 137 * Returns 138 * EVN-3: "Date/Time Planned Event" - creates it if necessary 139 */ 140 public TS getEvn3_DateTimePlannedEvent() { 141 TS retVal = this.getTypedField(3, 0); 142 return retVal; 143 } 144 145 146 147 /** 148 * Returns 149 * EVN-4: "Event Reason Code" - creates it if necessary 150 */ 151 public IS getEventReasonCode() { 152 IS retVal = this.getTypedField(4, 0); 153 return retVal; 154 } 155 156 /** 157 * Returns 158 * EVN-4: "Event Reason Code" - creates it if necessary 159 */ 160 public IS getEvn4_EventReasonCode() { 161 IS retVal = this.getTypedField(4, 0); 162 return retVal; 163 } 164 165 166 /** 167 * Returns all repetitions of Operator ID (EVN-5). 168 */ 169 public XCN[] getOperatorID() { 170 XCN[] retVal = this.getTypedField(5, new XCN[0]); 171 return retVal; 172 } 173 174 175 /** 176 * Returns all repetitions of Operator ID (EVN-5). 177 */ 178 public XCN[] getEvn5_OperatorID() { 179 XCN[] retVal = this.getTypedField(5, new XCN[0]); 180 return retVal; 181 } 182 183 184 /** 185 * Returns a count of the current number of repetitions of Operator ID (EVN-5). 186 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 187 * it will return zero. 188 */ 189 public int getOperatorIDReps() { 190 return this.getReps(5); 191 } 192 193 194 /** 195 * Returns a specific repetition of 196 * EVN-5: "Operator ID" - creates it if necessary 197 * 198 * @param rep The repetition index (0-indexed) 199 */ 200 public XCN getOperatorID(int rep) { 201 XCN retVal = this.getTypedField(5, rep); 202 return retVal; 203 } 204 205 /** 206 * Returns a specific repetition of 207 * EVN-5: "Operator ID" - creates it if necessary 208 * 209 * @param rep The repetition index (0-indexed) 210 */ 211 public XCN getEvn5_OperatorID(int rep) { 212 XCN retVal = this.getTypedField(5, rep); 213 return retVal; 214 } 215 216 /** 217 * Returns a count of the current number of repetitions of Operator ID (EVN-5). 218 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 219 * it will return zero. 220 */ 221 public int getEvn5_OperatorIDReps() { 222 return this.getReps(5); 223 } 224 225 226 /** 227 * Inserts a repetition of 228 * EVN-5: "Operator ID" at a specific index 229 * 230 * @param rep The repetition index (0-indexed) 231 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 232 */ 233 public XCN insertOperatorID(int rep) throws HL7Exception { 234 return (XCN) super.insertRepetition(5, rep); 235 } 236 237 238 /** 239 * Inserts a repetition of 240 * EVN-5: "Operator ID" at a specific index 241 * 242 * @param rep The repetition index (0-indexed) 243 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 244 */ 245 public XCN insertEvn5_OperatorID(int rep) throws HL7Exception { 246 return (XCN) super.insertRepetition(5, rep); 247 } 248 249 250 /** 251 * Removes a repetition of 252 * EVN-5: "Operator ID" at a specific index 253 * 254 * @param rep The repetition index (0-indexed) 255 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 256 */ 257 public XCN removeOperatorID(int rep) throws HL7Exception { 258 return (XCN) super.removeRepetition(5, rep); 259 } 260 261 262 /** 263 * Removes a repetition of 264 * EVN-5: "Operator ID" at a specific index 265 * 266 * @param rep The repetition index (0-indexed) 267 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 268 */ 269 public XCN removeEvn5_OperatorID(int rep) throws HL7Exception { 270 return (XCN) super.removeRepetition(5, rep); 271 } 272 273 274 275 276 /** 277 * Returns 278 * EVN-6: "Event Occurred" - creates it if necessary 279 */ 280 public TS getEventOccurred() { 281 TS retVal = this.getTypedField(6, 0); 282 return retVal; 283 } 284 285 /** 286 * Returns 287 * EVN-6: "Event Occurred" - creates it if necessary 288 */ 289 public TS getEvn6_EventOccurred() { 290 TS retVal = this.getTypedField(6, 0); 291 return retVal; 292 } 293 294 295 296 /** 297 * Returns 298 * EVN-7: "Event Facility" - creates it if necessary 299 */ 300 public HD getEventFacility() { 301 HD retVal = this.getTypedField(7, 0); 302 return retVal; 303 } 304 305 /** 306 * Returns 307 * EVN-7: "Event Facility" - creates it if necessary 308 */ 309 public HD getEvn7_EventFacility() { 310 HD retVal = this.getTypedField(7, 0); 311 return retVal; 312 } 313 314 315 316 317 318 /** {@inheritDoc} */ 319 protected Type createNewTypeWithoutReflection(int field) { 320 switch (field) { 321 case 0: return new ID(getMessage(), new Integer( 3 )); 322 case 1: return new TS(getMessage()); 323 case 2: return new TS(getMessage()); 324 case 3: return new IS(getMessage(), new Integer( 62 )); 325 case 4: return new XCN(getMessage()); 326 case 5: return new TS(getMessage()); 327 case 6: return new HD(getMessage()); 328 default: return null; 329 } 330 } 331 332 333} 334