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 MSH message segment (MESSAGE HEADER). 049 * This segment has the following fields:</p> 050 * <ul> 051 * <li>MSH-1: FIELD SEPARATOR (ST) <b> </b> 052 * <li>MSH-2: ENCODING CHARACTERS (ST) <b> </b> 053 * <li>MSH-3: SENDING APPLICATION (ST) <b>optional </b> 054 * <li>MSH-4: SENDING FACILITY (ST) <b>optional </b> 055 * <li>MSH-5: RECEIVING APPLICATION (ST) <b>optional </b> 056 * <li>MSH-6: RECEIVING FACILITY (ST) <b>optional </b> 057 * <li>MSH-7: DATE/TIME OF MESSAGE (TS) <b>optional </b> 058 * <li>MSH-8: Security (ST) <b>optional </b> 059 * <li>MSH-9: MESSAGE TYPE (CM_MSG) <b> </b> 060 * <li>MSH-10: MESSAGE CONTROL ID (ST) <b> </b> 061 * <li>MSH-11: PROCESSING ID (ID) <b> </b> 062 * <li>MSH-12: VERSION ID (NM) <b> </b> 063 * <li>MSH-13: SEQUENCE NUMBER (NM) <b>optional </b> 064 * <li>MSH-14: CONTINUATION POINTER (ST) <b>optional </b> 065 * </ul> 066 */ 067@SuppressWarnings("unused") 068public class MSH extends AbstractSegment { 069 070 /** 071 * Creates a new MSH segment 072 */ 073 public MSH(Group parent, ModelClassFactory factory) { 074 super(parent, factory); 075 init(factory); 076 } 077 078 private void init(ModelClassFactory factory) { 079 try { 080 this.add(ST.class, true, 1, 1, new Object[]{ getMessage() }, "FIELD SEPARATOR"); 081 this.add(ST.class, true, 1, 4, new Object[]{ getMessage() }, "ENCODING CHARACTERS"); 082 this.add(ST.class, false, 1, 15, new Object[]{ getMessage() }, "SENDING APPLICATION"); 083 this.add(ST.class, false, 1, 20, new Object[]{ getMessage() }, "SENDING FACILITY"); 084 this.add(ST.class, false, 1, 15, new Object[]{ getMessage() }, "RECEIVING APPLICATION"); 085 this.add(ST.class, false, 1, 30, new Object[]{ getMessage() }, "RECEIVING FACILITY"); 086 this.add(TS.class, false, 1, 19, new Object[]{ getMessage() }, "DATE/TIME OF MESSAGE"); 087 this.add(ST.class, false, 1, 40, new Object[]{ getMessage() }, "Security"); 088 this.add(CM_MSG.class, true, 1, 7, new Object[]{ getMessage() }, "MESSAGE TYPE"); 089 this.add(ST.class, true, 1, 20, new Object[]{ getMessage() }, "MESSAGE CONTROL ID"); 090 this.add(ID.class, true, 1, 1, new Object[]{ getMessage(), new Integer(103) }, "PROCESSING ID"); 091 this.add(NM.class, true, 1, 8, new Object[]{ getMessage() }, "VERSION ID"); 092 this.add(NM.class, false, 1, 15, new Object[]{ getMessage() }, "SEQUENCE NUMBER"); 093 this.add(ST.class, false, 1, 180, new Object[]{ getMessage() }, "CONTINUATION POINTER"); 094 } catch(HL7Exception e) { 095 log.error("Unexpected error creating MSH - this is probably a bug in the source code generator.", e); 096 } 097 } 098 099 100 101 /** 102 * Returns 103 * MSH-1: "FIELD SEPARATOR" - creates it if necessary 104 */ 105 public ST getFIELDSEPARATOR() { 106 ST retVal = this.getTypedField(1, 0); 107 return retVal; 108 } 109 110 /** 111 * Returns 112 * MSH-1: "FIELD SEPARATOR" - creates it if necessary 113 */ 114 public ST getMsh1_FIELDSEPARATOR() { 115 ST retVal = this.getTypedField(1, 0); 116 return retVal; 117 } 118 119 120 121 /** 122 * Returns 123 * MSH-2: "ENCODING CHARACTERS" - creates it if necessary 124 */ 125 public ST getENCODINGCHARACTERS() { 126 ST retVal = this.getTypedField(2, 0); 127 return retVal; 128 } 129 130 /** 131 * Returns 132 * MSH-2: "ENCODING CHARACTERS" - creates it if necessary 133 */ 134 public ST getMsh2_ENCODINGCHARACTERS() { 135 ST retVal = this.getTypedField(2, 0); 136 return retVal; 137 } 138 139 140 141 /** 142 * Returns 143 * MSH-3: "SENDING APPLICATION" - creates it if necessary 144 */ 145 public ST getSENDINGAPPLICATION() { 146 ST retVal = this.getTypedField(3, 0); 147 return retVal; 148 } 149 150 /** 151 * Returns 152 * MSH-3: "SENDING APPLICATION" - creates it if necessary 153 */ 154 public ST getMsh3_SENDINGAPPLICATION() { 155 ST retVal = this.getTypedField(3, 0); 156 return retVal; 157 } 158 159 160 161 /** 162 * Returns 163 * MSH-4: "SENDING FACILITY" - creates it if necessary 164 */ 165 public ST getSENDINGFACILITY() { 166 ST retVal = this.getTypedField(4, 0); 167 return retVal; 168 } 169 170 /** 171 * Returns 172 * MSH-4: "SENDING FACILITY" - creates it if necessary 173 */ 174 public ST getMsh4_SENDINGFACILITY() { 175 ST retVal = this.getTypedField(4, 0); 176 return retVal; 177 } 178 179 180 181 /** 182 * Returns 183 * MSH-5: "RECEIVING APPLICATION" - creates it if necessary 184 */ 185 public ST getRECEIVINGAPPLICATION() { 186 ST retVal = this.getTypedField(5, 0); 187 return retVal; 188 } 189 190 /** 191 * Returns 192 * MSH-5: "RECEIVING APPLICATION" - creates it if necessary 193 */ 194 public ST getMsh5_RECEIVINGAPPLICATION() { 195 ST retVal = this.getTypedField(5, 0); 196 return retVal; 197 } 198 199 200 201 /** 202 * Returns 203 * MSH-6: "RECEIVING FACILITY" - creates it if necessary 204 */ 205 public ST getRECEIVINGFACILITY() { 206 ST retVal = this.getTypedField(6, 0); 207 return retVal; 208 } 209 210 /** 211 * Returns 212 * MSH-6: "RECEIVING FACILITY" - creates it if necessary 213 */ 214 public ST getMsh6_RECEIVINGFACILITY() { 215 ST retVal = this.getTypedField(6, 0); 216 return retVal; 217 } 218 219 220 221 /** 222 * Returns 223 * MSH-7: "DATE/TIME OF MESSAGE" - creates it if necessary 224 */ 225 public TS getDATETIMEOFMESSAGE() { 226 TS retVal = this.getTypedField(7, 0); 227 return retVal; 228 } 229 230 /** 231 * Returns 232 * MSH-7: "DATE/TIME OF MESSAGE" - creates it if necessary 233 */ 234 public TS getMsh7_DATETIMEOFMESSAGE() { 235 TS retVal = this.getTypedField(7, 0); 236 return retVal; 237 } 238 239 240 241 /** 242 * Returns 243 * MSH-8: "Security" - creates it if necessary 244 */ 245 public ST getSecurity() { 246 ST retVal = this.getTypedField(8, 0); 247 return retVal; 248 } 249 250 /** 251 * Returns 252 * MSH-8: "Security" - creates it if necessary 253 */ 254 public ST getMsh8_Security() { 255 ST retVal = this.getTypedField(8, 0); 256 return retVal; 257 } 258 259 260 261 /** 262 * Returns 263 * MSH-9: "MESSAGE TYPE" - creates it if necessary 264 */ 265 public CM_MSG getMESSAGETYPE() { 266 CM_MSG retVal = this.getTypedField(9, 0); 267 return retVal; 268 } 269 270 /** 271 * Returns 272 * MSH-9: "MESSAGE TYPE" - creates it if necessary 273 */ 274 public CM_MSG getMsh9_MESSAGETYPE() { 275 CM_MSG retVal = this.getTypedField(9, 0); 276 return retVal; 277 } 278 279 280 281 /** 282 * Returns 283 * MSH-10: "MESSAGE CONTROL ID" - creates it if necessary 284 */ 285 public ST getMESSAGECONTROLID() { 286 ST retVal = this.getTypedField(10, 0); 287 return retVal; 288 } 289 290 /** 291 * Returns 292 * MSH-10: "MESSAGE CONTROL ID" - creates it if necessary 293 */ 294 public ST getMsh10_MESSAGECONTROLID() { 295 ST retVal = this.getTypedField(10, 0); 296 return retVal; 297 } 298 299 300 301 /** 302 * Returns 303 * MSH-11: "PROCESSING ID" - creates it if necessary 304 */ 305 public ID getPROCESSINGID() { 306 ID retVal = this.getTypedField(11, 0); 307 return retVal; 308 } 309 310 /** 311 * Returns 312 * MSH-11: "PROCESSING ID" - creates it if necessary 313 */ 314 public ID getMsh11_PROCESSINGID() { 315 ID retVal = this.getTypedField(11, 0); 316 return retVal; 317 } 318 319 320 321 /** 322 * Returns 323 * MSH-12: "VERSION ID" - creates it if necessary 324 */ 325 public NM getVERSIONID() { 326 NM retVal = this.getTypedField(12, 0); 327 return retVal; 328 } 329 330 /** 331 * Returns 332 * MSH-12: "VERSION ID" - creates it if necessary 333 */ 334 public NM getMsh12_VERSIONID() { 335 NM retVal = this.getTypedField(12, 0); 336 return retVal; 337 } 338 339 340 341 /** 342 * Returns 343 * MSH-13: "SEQUENCE NUMBER" - creates it if necessary 344 */ 345 public NM getSEQUENCENUMBER() { 346 NM retVal = this.getTypedField(13, 0); 347 return retVal; 348 } 349 350 /** 351 * Returns 352 * MSH-13: "SEQUENCE NUMBER" - creates it if necessary 353 */ 354 public NM getMsh13_SEQUENCENUMBER() { 355 NM retVal = this.getTypedField(13, 0); 356 return retVal; 357 } 358 359 360 361 /** 362 * Returns 363 * MSH-14: "CONTINUATION POINTER" - creates it if necessary 364 */ 365 public ST getCONTINUATIONPOINTER() { 366 ST retVal = this.getTypedField(14, 0); 367 return retVal; 368 } 369 370 /** 371 * Returns 372 * MSH-14: "CONTINUATION POINTER" - creates it if necessary 373 */ 374 public ST getMsh14_CONTINUATIONPOINTER() { 375 ST retVal = this.getTypedField(14, 0); 376 return retVal; 377 } 378 379 380 381 382 383 /** {@inheritDoc} */ 384 protected Type createNewTypeWithoutReflection(int field) { 385 switch (field) { 386 case 0: return new ST(getMessage()); 387 case 1: return new ST(getMessage()); 388 case 2: return new ST(getMessage()); 389 case 3: return new ST(getMessage()); 390 case 4: return new ST(getMessage()); 391 case 5: return new ST(getMessage()); 392 case 6: return new TS(getMessage()); 393 case 7: return new ST(getMessage()); 394 case 8: return new CM_MSG(getMessage()); 395 case 9: return new ST(getMessage()); 396 case 10: return new ID(getMessage(), new Integer( 103 )); 397 case 11: return new NM(getMessage()); 398 case 12: return new NM(getMessage()); 399 case 13: return new ST(getMessage()); 400 default: return null; 401 } 402 } 403 404 405} 406