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.v22.segment; 035 036// import ca.uhn.hl7v2.model.v22.group.*; 037import ca.uhn.hl7v2.model.v22.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 MSH message segment (MESSAGE HEADER). 050 * This segment has the following fields:</p> 051 * <ul> 052 * <li>MSH-1: Field separator (ST) <b> </b> 053 * <li>MSH-2: Encoding characters (ST) <b> </b> 054 * <li>MSH-3: Sending application (ST) <b>optional </b> 055 * <li>MSH-4: Sending facility (ST) <b>optional </b> 056 * <li>MSH-5: Receiving application (ST) <b>optional </b> 057 * <li>MSH-6: Receiving facility (ST) <b>optional </b> 058 * <li>MSH-7: Date / Time of message (TS) <b>optional </b> 059 * <li>MSH-8: Security (ST) <b>optional </b> 060 * <li>MSH-9: Message type (CM_MSG) <b> </b> 061 * <li>MSH-10: Message Control ID (ST) <b> </b> 062 * <li>MSH-11: Processing ID (ID) <b> </b> 063 * <li>MSH-12: Version ID (ID) <b> </b> 064 * <li>MSH-13: Sequence number (NM) <b>optional </b> 065 * <li>MSH-14: Continuation pointer (ST) <b>optional </b> 066 * <li>MSH-15: Accept acknowledgement type (ID) <b>optional </b> 067 * <li>MSH-16: Application acknowledgement type (ID) <b>optional </b> 068 * <li>MSH-17: Country code (ID) <b>optional </b> 069 * </ul> 070 */ 071@SuppressWarnings("unused") 072public class MSH extends AbstractSegment { 073 074 /** 075 * Creates a new MSH segment 076 */ 077 public MSH(Group parent, ModelClassFactory factory) { 078 super(parent, factory); 079 init(factory); 080 } 081 082 private void init(ModelClassFactory factory) { 083 try { 084 this.add(ST.class, true, 1, 1, new Object[]{ getMessage() }, "Field separator"); 085 this.add(ST.class, true, 1, 4, new Object[]{ getMessage() }, "Encoding characters"); 086 this.add(ST.class, false, 1, 15, new Object[]{ getMessage() }, "Sending application"); 087 this.add(ST.class, false, 1, 20, new Object[]{ getMessage() }, "Sending facility"); 088 this.add(ST.class, false, 1, 30, new Object[]{ getMessage() }, "Receiving application"); 089 this.add(ST.class, false, 1, 30, new Object[]{ getMessage() }, "Receiving facility"); 090 this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Date / Time of message"); 091 this.add(ST.class, false, 1, 40, new Object[]{ getMessage() }, "Security"); 092 this.add(CM_MSG.class, true, 1, 7, new Object[]{ getMessage() }, "Message type"); 093 this.add(ST.class, true, 1, 20, new Object[]{ getMessage() }, "Message Control ID"); 094 this.add(ID.class, true, 1, 1, new Object[]{ getMessage(), new Integer(103) }, "Processing ID"); 095 this.add(ID.class, true, 1, 8, new Object[]{ getMessage(), new Integer(104) }, "Version ID"); 096 this.add(NM.class, false, 1, 15, new Object[]{ getMessage() }, "Sequence number"); 097 this.add(ST.class, false, 1, 180, new Object[]{ getMessage() }, "Continuation pointer"); 098 this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(155) }, "Accept acknowledgement type"); 099 this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(155) }, "Application acknowledgement type"); 100 this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(0) }, "Country code"); 101 } catch(HL7Exception e) { 102 log.error("Unexpected error creating MSH - this is probably a bug in the source code generator.", e); 103 } 104 } 105 106 107 108 /** 109 * Returns 110 * MSH-1: "Field separator" - creates it if necessary 111 */ 112 public ST getFieldSeparator() { 113 ST retVal = this.getTypedField(1, 0); 114 return retVal; 115 } 116 117 /** 118 * Returns 119 * MSH-1: "Field separator" - creates it if necessary 120 */ 121 public ST getMsh1_FieldSeparator() { 122 ST retVal = this.getTypedField(1, 0); 123 return retVal; 124 } 125 126 127 128 /** 129 * Returns 130 * MSH-2: "Encoding characters" - creates it if necessary 131 */ 132 public ST getEncodingCharacters() { 133 ST retVal = this.getTypedField(2, 0); 134 return retVal; 135 } 136 137 /** 138 * Returns 139 * MSH-2: "Encoding characters" - creates it if necessary 140 */ 141 public ST getMsh2_EncodingCharacters() { 142 ST retVal = this.getTypedField(2, 0); 143 return retVal; 144 } 145 146 147 148 /** 149 * Returns 150 * MSH-3: "Sending application" - creates it if necessary 151 */ 152 public ST getSendingApplication() { 153 ST retVal = this.getTypedField(3, 0); 154 return retVal; 155 } 156 157 /** 158 * Returns 159 * MSH-3: "Sending application" - creates it if necessary 160 */ 161 public ST getMsh3_SendingApplication() { 162 ST retVal = this.getTypedField(3, 0); 163 return retVal; 164 } 165 166 167 168 /** 169 * Returns 170 * MSH-4: "Sending facility" - creates it if necessary 171 */ 172 public ST getSendingFacility() { 173 ST retVal = this.getTypedField(4, 0); 174 return retVal; 175 } 176 177 /** 178 * Returns 179 * MSH-4: "Sending facility" - creates it if necessary 180 */ 181 public ST getMsh4_SendingFacility() { 182 ST retVal = this.getTypedField(4, 0); 183 return retVal; 184 } 185 186 187 188 /** 189 * Returns 190 * MSH-5: "Receiving application" - creates it if necessary 191 */ 192 public ST getReceivingApplication() { 193 ST retVal = this.getTypedField(5, 0); 194 return retVal; 195 } 196 197 /** 198 * Returns 199 * MSH-5: "Receiving application" - creates it if necessary 200 */ 201 public ST getMsh5_ReceivingApplication() { 202 ST retVal = this.getTypedField(5, 0); 203 return retVal; 204 } 205 206 207 208 /** 209 * Returns 210 * MSH-6: "Receiving facility" - creates it if necessary 211 */ 212 public ST getReceivingFacility() { 213 ST retVal = this.getTypedField(6, 0); 214 return retVal; 215 } 216 217 /** 218 * Returns 219 * MSH-6: "Receiving facility" - creates it if necessary 220 */ 221 public ST getMsh6_ReceivingFacility() { 222 ST retVal = this.getTypedField(6, 0); 223 return retVal; 224 } 225 226 227 228 /** 229 * Returns 230 * MSH-7: "Date / Time of message" - creates it if necessary 231 */ 232 public TS getDateTimeOfMessage() { 233 TS retVal = this.getTypedField(7, 0); 234 return retVal; 235 } 236 237 /** 238 * Returns 239 * MSH-7: "Date / Time of message" - creates it if necessary 240 */ 241 public TS getMsh7_DateTimeOfMessage() { 242 TS retVal = this.getTypedField(7, 0); 243 return retVal; 244 } 245 246 247 248 /** 249 * Returns 250 * MSH-8: "Security" - creates it if necessary 251 */ 252 public ST getSecurity() { 253 ST retVal = this.getTypedField(8, 0); 254 return retVal; 255 } 256 257 /** 258 * Returns 259 * MSH-8: "Security" - creates it if necessary 260 */ 261 public ST getMsh8_Security() { 262 ST retVal = this.getTypedField(8, 0); 263 return retVal; 264 } 265 266 267 268 /** 269 * Returns 270 * MSH-9: "Message type" - creates it if necessary 271 */ 272 public CM_MSG getMessageType() { 273 CM_MSG retVal = this.getTypedField(9, 0); 274 return retVal; 275 } 276 277 /** 278 * Returns 279 * MSH-9: "Message type" - creates it if necessary 280 */ 281 public CM_MSG getMsh9_MessageType() { 282 CM_MSG retVal = this.getTypedField(9, 0); 283 return retVal; 284 } 285 286 287 288 /** 289 * Returns 290 * MSH-10: "Message Control ID" - creates it if necessary 291 */ 292 public ST getMessageControlID() { 293 ST retVal = this.getTypedField(10, 0); 294 return retVal; 295 } 296 297 /** 298 * Returns 299 * MSH-10: "Message Control ID" - creates it if necessary 300 */ 301 public ST getMsh10_MessageControlID() { 302 ST retVal = this.getTypedField(10, 0); 303 return retVal; 304 } 305 306 307 308 /** 309 * Returns 310 * MSH-11: "Processing ID" - creates it if necessary 311 */ 312 public ID getProcessingID() { 313 ID retVal = this.getTypedField(11, 0); 314 return retVal; 315 } 316 317 /** 318 * Returns 319 * MSH-11: "Processing ID" - creates it if necessary 320 */ 321 public ID getMsh11_ProcessingID() { 322 ID retVal = this.getTypedField(11, 0); 323 return retVal; 324 } 325 326 327 328 /** 329 * Returns 330 * MSH-12: "Version ID" - creates it if necessary 331 */ 332 public ID getVersionID() { 333 ID retVal = this.getTypedField(12, 0); 334 return retVal; 335 } 336 337 /** 338 * Returns 339 * MSH-12: "Version ID" - creates it if necessary 340 */ 341 public ID getMsh12_VersionID() { 342 ID retVal = this.getTypedField(12, 0); 343 return retVal; 344 } 345 346 347 348 /** 349 * Returns 350 * MSH-13: "Sequence number" - creates it if necessary 351 */ 352 public NM getSequenceNumber() { 353 NM retVal = this.getTypedField(13, 0); 354 return retVal; 355 } 356 357 /** 358 * Returns 359 * MSH-13: "Sequence number" - creates it if necessary 360 */ 361 public NM getMsh13_SequenceNumber() { 362 NM retVal = this.getTypedField(13, 0); 363 return retVal; 364 } 365 366 367 368 /** 369 * Returns 370 * MSH-14: "Continuation pointer" - creates it if necessary 371 */ 372 public ST getContinuationPointer() { 373 ST retVal = this.getTypedField(14, 0); 374 return retVal; 375 } 376 377 /** 378 * Returns 379 * MSH-14: "Continuation pointer" - creates it if necessary 380 */ 381 public ST getMsh14_ContinuationPointer() { 382 ST retVal = this.getTypedField(14, 0); 383 return retVal; 384 } 385 386 387 388 /** 389 * Returns 390 * MSH-15: "Accept acknowledgement type" - creates it if necessary 391 */ 392 public ID getAcceptAcknowledgementType() { 393 ID retVal = this.getTypedField(15, 0); 394 return retVal; 395 } 396 397 /** 398 * Returns 399 * MSH-15: "Accept acknowledgement type" - creates it if necessary 400 */ 401 public ID getMsh15_AcceptAcknowledgementType() { 402 ID retVal = this.getTypedField(15, 0); 403 return retVal; 404 } 405 406 407 408 /** 409 * Returns 410 * MSH-16: "Application acknowledgement type" - creates it if necessary 411 */ 412 public ID getApplicationAcknowledgementType() { 413 ID retVal = this.getTypedField(16, 0); 414 return retVal; 415 } 416 417 /** 418 * Returns 419 * MSH-16: "Application acknowledgement type" - creates it if necessary 420 */ 421 public ID getMsh16_ApplicationAcknowledgementType() { 422 ID retVal = this.getTypedField(16, 0); 423 return retVal; 424 } 425 426 427 428 /** 429 * Returns 430 * MSH-17: "Country code" - creates it if necessary 431 */ 432 public ID getCountryCode() { 433 ID retVal = this.getTypedField(17, 0); 434 return retVal; 435 } 436 437 /** 438 * Returns 439 * MSH-17: "Country code" - creates it if necessary 440 */ 441 public ID getMsh17_CountryCode() { 442 ID retVal = this.getTypedField(17, 0); 443 return retVal; 444 } 445 446 447 448 449 450 /** {@inheritDoc} */ 451 protected Type createNewTypeWithoutReflection(int field) { 452 switch (field) { 453 case 0: return new ST(getMessage()); 454 case 1: return new ST(getMessage()); 455 case 2: return new ST(getMessage()); 456 case 3: return new ST(getMessage()); 457 case 4: return new ST(getMessage()); 458 case 5: return new ST(getMessage()); 459 case 6: return new TS(getMessage()); 460 case 7: return new ST(getMessage()); 461 case 8: return new CM_MSG(getMessage()); 462 case 9: return new ST(getMessage()); 463 case 10: return new ID(getMessage(), new Integer( 103 )); 464 case 11: return new ID(getMessage(), new Integer( 104 )); 465 case 12: return new NM(getMessage()); 466 case 13: return new ST(getMessage()); 467 case 14: return new ID(getMessage(), new Integer( 155 )); 468 case 15: return new ID(getMessage(), new Integer( 155 )); 469 case 16: return new ID(getMessage(), new Integer( 0 )); 470 default: return null; 471 } 472 } 473 474 475} 476