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