View Javadoc
1   /*
2    * This class is an auto-generated source file for a HAPI
3    * HL7 v2.x standard structure class.
4    *
5    * For more information, visit: http://hl7api.sourceforge.net/
6    * 
7    * The contents of this file are subject to the Mozilla Public License Version 1.1 
8    * (the "License"); you may not use this file except in compliance with the License. 
9    * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
10   * Software distributed under the License is distributed on an "AS IS" basis, 
11   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
12   * specific language governing rights and limitations under the License. 
13   * 
14   * The Original Code is "[file_name]".  Description: 
15   * "[one_line_description]" 
16   * 
17   * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
18   * 2012.  All Rights Reserved. 
19   * 
20   * Contributor(s): ______________________________________. 
21   * 
22   * Alternatively, the contents of this file may be used under the terms of the 
23   * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
24   * applicable instead of those above.  If you wish to allow use of your version of this 
25   * file only under the terms of the GPL and not to allow others to use your version 
26   * of this file under the MPL, indicate your decision by deleting  the provisions above 
27   * and replace  them with the notice and other provisions required by the GPL License.  
28   * If you do not delete the provisions above, a recipient may use your version of 
29   * this file under either the MPL or the GPL. 
30   * 
31   */
32  
33  
34  package ca.uhn.hl7v2.model.v23.segment;
35  
36  // import ca.uhn.hl7v2.model.v23.group.*;
37  import ca.uhn.hl7v2.model.v23.datatype.*;
38  import ca.uhn.hl7v2.HL7Exception;
39  import ca.uhn.hl7v2.parser.ModelClassFactory;
40  import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
41  import ca.uhn.hl7v2.model.AbstractMessage;
42  import ca.uhn.hl7v2.model.Group;
43  import ca.uhn.hl7v2.model.Type;
44  import ca.uhn.hl7v2.model.AbstractSegment;
45  import ca.uhn.hl7v2.model.Varies;
46  
47  
48  /**
49   *<p>Represents an HL7 MSH message segment (Message header segment). 
50   * This segment has the following fields:</p>
51   * <ul>
52       * <li>MSH-1: Field Separator (ST) <b> </b>
53       * <li>MSH-2: Encoding Characters (ST) <b> </b>
54       * <li>MSH-3: Sending Application (HD) <b>optional </b>
55       * <li>MSH-4: Sending Facility (HD) <b>optional </b>
56       * <li>MSH-5: Receiving Application (HD) <b>optional </b>
57       * <li>MSH-6: Receiving Facility (HD) <b>optional </b>
58       * <li>MSH-7: Date / Time of Message (TS) <b>optional </b>
59       * <li>MSH-8: Security (ST) <b>optional </b>
60       * <li>MSH-9: Message Type (CM_MSG) <b> </b>
61       * <li>MSH-10: Message Control ID (ST) <b> </b>
62       * <li>MSH-11: Processing ID (PT) <b> </b>
63       * <li>MSH-12: Version ID (ID) <b> </b>
64       * <li>MSH-13: Sequence Number (NM) <b>optional </b>
65       * <li>MSH-14: Continuation Pointer (ST) <b>optional </b>
66       * <li>MSH-15: Accept Acknowledgement Type (ID) <b>optional </b>
67       * <li>MSH-16: Application Acknowledgement Type (ID) <b>optional </b>
68       * <li>MSH-17: Country Code (ID) <b>optional </b>
69       * <li>MSH-18: Character Set (ID) <b>optional </b>
70       * <li>MSH-19: Principal Language of Message (CE) <b>optional </b>
71   * </ul>
72   */
73  @SuppressWarnings("unused")
74  public class MSH extends AbstractSegment {
75  
76      /** 
77       * Creates a new MSH segment
78       */
79      public MSH(Group parent, ModelClassFactory factory) {
80         super(parent, factory);
81         init(factory);
82      }
83  
84      private void init(ModelClassFactory factory) {
85         try {
86                                    this.add(ST.class, true, 1, 1, new Object[]{ getMessage() }, "Field Separator");
87                                    this.add(ST.class, true, 1, 4, new Object[]{ getMessage() }, "Encoding Characters");
88                                    this.add(HD.class, false, 1, 180, new Object[]{ getMessage() }, "Sending Application");
89                                    this.add(HD.class, false, 1, 180, new Object[]{ getMessage() }, "Sending Facility");
90                                    this.add(HD.class, false, 1, 180, new Object[]{ getMessage() }, "Receiving Application");
91                                    this.add(HD.class, false, 1, 180, new Object[]{ getMessage() }, "Receiving Facility");
92                                    this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Date / Time of Message");
93                                    this.add(ST.class, false, 1, 40, new Object[]{ getMessage() }, "Security");
94                                    this.add(CM_MSG.class, true, 1, 7, new Object[]{ getMessage() }, "Message Type");
95                                    this.add(ST.class, true, 1, 20, new Object[]{ getMessage() }, "Message Control ID");
96                                    this.add(PT.class, true, 1, 3, new Object[]{ getMessage() }, "Processing ID");
97                                                this.add(ID.class, true, 1, 8, new Object[]{ getMessage(), new Integer(104) }, "Version ID");
98                                    this.add(NM.class, false, 1, 15, new Object[]{ getMessage() }, "Sequence Number");
99                                    this.add(ST.class, false, 1, 180, new Object[]{ getMessage() }, "Continuation Pointer");
100                                               this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(155) }, "Accept Acknowledgement Type");
101                                               this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(155) }, "Application Acknowledgement Type");
102                                               this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(0) }, "Country Code");
103                                               this.add(ID.class, false, 1, 6, new Object[]{ getMessage(), new Integer(211) }, "Character Set");
104                                   this.add(CE.class, false, 1, 3, new Object[]{ getMessage() }, "Principal Language of Message");
105        } catch(HL7Exception e) {
106           log.error("Unexpected error creating MSH - this is probably a bug in the source code generator.", e);
107        }
108     }
109 
110 
111 
112     /**
113      * Returns
114      * MSH-1: "Field Separator" - creates it if necessary
115      */
116     public ST getFieldSeparator() { 
117 		ST retVal = this.getTypedField(1, 0);
118 		return retVal;
119     }
120     
121     /**
122      * Returns
123      * MSH-1: "Field Separator" - creates it if necessary
124      */
125     public ST getMsh1_FieldSeparator() { 
126 		ST retVal = this.getTypedField(1, 0);
127 		return retVal;
128     }
129 
130 
131 
132     /**
133      * Returns
134      * MSH-2: "Encoding Characters" - creates it if necessary
135      */
136     public ST getEncodingCharacters() { 
137 		ST retVal = this.getTypedField(2, 0);
138 		return retVal;
139     }
140     
141     /**
142      * Returns
143      * MSH-2: "Encoding Characters" - creates it if necessary
144      */
145     public ST getMsh2_EncodingCharacters() { 
146 		ST retVal = this.getTypedField(2, 0);
147 		return retVal;
148     }
149 
150 
151 
152     /**
153      * Returns
154      * MSH-3: "Sending Application" - creates it if necessary
155      */
156     public HD getSendingApplication() { 
157 		HD retVal = this.getTypedField(3, 0);
158 		return retVal;
159     }
160     
161     /**
162      * Returns
163      * MSH-3: "Sending Application" - creates it if necessary
164      */
165     public HD getMsh3_SendingApplication() { 
166 		HD retVal = this.getTypedField(3, 0);
167 		return retVal;
168     }
169 
170 
171 
172     /**
173      * Returns
174      * MSH-4: "Sending Facility" - creates it if necessary
175      */
176     public HD getSendingFacility() { 
177 		HD retVal = this.getTypedField(4, 0);
178 		return retVal;
179     }
180     
181     /**
182      * Returns
183      * MSH-4: "Sending Facility" - creates it if necessary
184      */
185     public HD getMsh4_SendingFacility() { 
186 		HD retVal = this.getTypedField(4, 0);
187 		return retVal;
188     }
189 
190 
191 
192     /**
193      * Returns
194      * MSH-5: "Receiving Application" - creates it if necessary
195      */
196     public HD getReceivingApplication() { 
197 		HD retVal = this.getTypedField(5, 0);
198 		return retVal;
199     }
200     
201     /**
202      * Returns
203      * MSH-5: "Receiving Application" - creates it if necessary
204      */
205     public HD getMsh5_ReceivingApplication() { 
206 		HD retVal = this.getTypedField(5, 0);
207 		return retVal;
208     }
209 
210 
211 
212     /**
213      * Returns
214      * MSH-6: "Receiving Facility" - creates it if necessary
215      */
216     public HD getReceivingFacility() { 
217 		HD retVal = this.getTypedField(6, 0);
218 		return retVal;
219     }
220     
221     /**
222      * Returns
223      * MSH-6: "Receiving Facility" - creates it if necessary
224      */
225     public HD getMsh6_ReceivingFacility() { 
226 		HD retVal = this.getTypedField(6, 0);
227 		return retVal;
228     }
229 
230 
231 
232     /**
233      * Returns
234      * MSH-7: "Date / Time of Message" - creates it if necessary
235      */
236     public TS getDateTimeOfMessage() { 
237 		TS retVal = this.getTypedField(7, 0);
238 		return retVal;
239     }
240     
241     /**
242      * Returns
243      * MSH-7: "Date / Time of Message" - creates it if necessary
244      */
245     public TS getMsh7_DateTimeOfMessage() { 
246 		TS retVal = this.getTypedField(7, 0);
247 		return retVal;
248     }
249 
250 
251 
252     /**
253      * Returns
254      * MSH-8: "Security" - creates it if necessary
255      */
256     public ST getSecurity() { 
257 		ST retVal = this.getTypedField(8, 0);
258 		return retVal;
259     }
260     
261     /**
262      * Returns
263      * MSH-8: "Security" - creates it if necessary
264      */
265     public ST getMsh8_Security() { 
266 		ST retVal = this.getTypedField(8, 0);
267 		return retVal;
268     }
269 
270 
271 
272     /**
273      * Returns
274      * MSH-9: "Message Type" - creates it if necessary
275      */
276     public CM_MSG getMessageType() { 
277 		CM_MSG retVal = this.getTypedField(9, 0);
278 		return retVal;
279     }
280     
281     /**
282      * Returns
283      * MSH-9: "Message Type" - creates it if necessary
284      */
285     public CM_MSG getMsh9_MessageType() { 
286 		CM_MSG retVal = this.getTypedField(9, 0);
287 		return retVal;
288     }
289 
290 
291 
292     /**
293      * Returns
294      * MSH-10: "Message Control ID" - creates it if necessary
295      */
296     public ST getMessageControlID() { 
297 		ST retVal = this.getTypedField(10, 0);
298 		return retVal;
299     }
300     
301     /**
302      * Returns
303      * MSH-10: "Message Control ID" - creates it if necessary
304      */
305     public ST getMsh10_MessageControlID() { 
306 		ST retVal = this.getTypedField(10, 0);
307 		return retVal;
308     }
309 
310 
311 
312     /**
313      * Returns
314      * MSH-11: "Processing ID" - creates it if necessary
315      */
316     public PT getProcessingID() { 
317 		PT retVal = this.getTypedField(11, 0);
318 		return retVal;
319     }
320     
321     /**
322      * Returns
323      * MSH-11: "Processing ID" - creates it if necessary
324      */
325     public PT getMsh11_ProcessingID() { 
326 		PT retVal = this.getTypedField(11, 0);
327 		return retVal;
328     }
329 
330 
331 
332     /**
333      * Returns
334      * MSH-12: "Version ID" - creates it if necessary
335      */
336     public ID getVersionID() { 
337 		ID retVal = this.getTypedField(12, 0);
338 		return retVal;
339     }
340     
341     /**
342      * Returns
343      * MSH-12: "Version ID" - creates it if necessary
344      */
345     public ID getMsh12_VersionID() { 
346 		ID retVal = this.getTypedField(12, 0);
347 		return retVal;
348     }
349 
350 
351 
352     /**
353      * Returns
354      * MSH-13: "Sequence Number" - creates it if necessary
355      */
356     public NM getSequenceNumber() { 
357 		NM retVal = this.getTypedField(13, 0);
358 		return retVal;
359     }
360     
361     /**
362      * Returns
363      * MSH-13: "Sequence Number" - creates it if necessary
364      */
365     public NM getMsh13_SequenceNumber() { 
366 		NM retVal = this.getTypedField(13, 0);
367 		return retVal;
368     }
369 
370 
371 
372     /**
373      * Returns
374      * MSH-14: "Continuation Pointer" - creates it if necessary
375      */
376     public ST getContinuationPointer() { 
377 		ST retVal = this.getTypedField(14, 0);
378 		return retVal;
379     }
380     
381     /**
382      * Returns
383      * MSH-14: "Continuation Pointer" - creates it if necessary
384      */
385     public ST getMsh14_ContinuationPointer() { 
386 		ST retVal = this.getTypedField(14, 0);
387 		return retVal;
388     }
389 
390 
391 
392     /**
393      * Returns
394      * MSH-15: "Accept Acknowledgement Type" - creates it if necessary
395      */
396     public ID getAcceptAcknowledgementType() { 
397 		ID retVal = this.getTypedField(15, 0);
398 		return retVal;
399     }
400     
401     /**
402      * Returns
403      * MSH-15: "Accept Acknowledgement Type" - creates it if necessary
404      */
405     public ID getMsh15_AcceptAcknowledgementType() { 
406 		ID retVal = this.getTypedField(15, 0);
407 		return retVal;
408     }
409 
410 
411 
412     /**
413      * Returns
414      * MSH-16: "Application Acknowledgement Type" - creates it if necessary
415      */
416     public ID getApplicationAcknowledgementType() { 
417 		ID retVal = this.getTypedField(16, 0);
418 		return retVal;
419     }
420     
421     /**
422      * Returns
423      * MSH-16: "Application Acknowledgement Type" - creates it if necessary
424      */
425     public ID getMsh16_ApplicationAcknowledgementType() { 
426 		ID retVal = this.getTypedField(16, 0);
427 		return retVal;
428     }
429 
430 
431 
432     /**
433      * Returns
434      * MSH-17: "Country Code" - creates it if necessary
435      */
436     public ID getCountryCode() { 
437 		ID retVal = this.getTypedField(17, 0);
438 		return retVal;
439     }
440     
441     /**
442      * Returns
443      * MSH-17: "Country Code" - creates it if necessary
444      */
445     public ID getMsh17_CountryCode() { 
446 		ID retVal = this.getTypedField(17, 0);
447 		return retVal;
448     }
449 
450 
451 
452     /**
453      * Returns
454      * MSH-18: "Character Set" - creates it if necessary
455      */
456     public ID getCharacterSet() { 
457 		ID retVal = this.getTypedField(18, 0);
458 		return retVal;
459     }
460     
461     /**
462      * Returns
463      * MSH-18: "Character Set" - creates it if necessary
464      */
465     public ID getMsh18_CharacterSet() { 
466 		ID retVal = this.getTypedField(18, 0);
467 		return retVal;
468     }
469 
470 
471 
472     /**
473      * Returns
474      * MSH-19: "Principal Language of Message" - creates it if necessary
475      */
476     public CE getPrincipalLanguageOfMessage() { 
477 		CE retVal = this.getTypedField(19, 0);
478 		return retVal;
479     }
480     
481     /**
482      * Returns
483      * MSH-19: "Principal Language of Message" - creates it if necessary
484      */
485     public CE getMsh19_PrincipalLanguageOfMessage() { 
486 		CE retVal = this.getTypedField(19, 0);
487 		return retVal;
488     }
489 
490 
491 
492 
493 
494     /** {@inheritDoc} */   
495     protected Type createNewTypeWithoutReflection(int field) {
496        switch (field) {
497           case 0: return new ST(getMessage());
498           case 1: return new ST(getMessage());
499           case 2: return new HD(getMessage());
500           case 3: return new HD(getMessage());
501           case 4: return new HD(getMessage());
502           case 5: return new HD(getMessage());
503           case 6: return new TS(getMessage());
504           case 7: return new ST(getMessage());
505           case 8: return new CM_MSG(getMessage());
506           case 9: return new ST(getMessage());
507           case 10: return new PT(getMessage());
508           case 11: return new ID(getMessage(), new Integer( 104 ));
509           case 12: return new NM(getMessage());
510           case 13: return new ST(getMessage());
511           case 14: return new ID(getMessage(), new Integer( 155 ));
512           case 15: return new ID(getMessage(), new Integer( 155 ));
513           case 16: return new ID(getMessage(), new Integer( 0 ));
514           case 17: return new ID(getMessage(), new Integer( 211 ));
515           case 18: return new CE(getMessage());
516           default: return null;
517        }
518    }
519 
520 
521 }
522