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