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