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.v231.segment;
35  
36  // import ca.uhn.hl7v2.model.v231.group.*;
37  import ca.uhn.hl7v2.model.v231.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 (MSH - 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 (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 (VID) <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 Acknowledgment Type (ID) <b>optional </b>
67       * <li>MSH-16: Application Acknowledgment Type (ID) <b>optional </b>
68       * <li>MSH-17: Country Code (ID) <b>optional </b>
69       * <li>MSH-18: Character Set (ID) <b>optional repeating</b>
70       * <li>MSH-19: Principal Language Of Message (CE) <b>optional </b>
71       * <li>MSH-20: Alternate Character Set Handling Scheme (ID) <b>optional </b>
72   * </ul>
73   */
74  @SuppressWarnings("unused")
75  public class MSH extends AbstractSegment {
76  
77      /** 
78       * Creates a new MSH segment
79       */
80      public MSH(Group parent, ModelClassFactory factory) {
81         super(parent, factory);
82         init(factory);
83      }
84  
85      private void init(ModelClassFactory factory) {
86         try {
87                                    this.add(ST.class, true, 1, 1, new Object[]{ getMessage() }, "Field Separator");
88                                    this.add(ST.class, true, 1, 4, new Object[]{ getMessage() }, "Encoding Characters");
89                                    this.add(HD.class, false, 1, 180, new Object[]{ getMessage() }, "Sending Application");
90                                    this.add(HD.class, false, 1, 180, new Object[]{ getMessage() }, "Sending Facility");
91                                    this.add(HD.class, false, 1, 180, new Object[]{ getMessage() }, "Receiving Application");
92                                    this.add(HD.class, false, 1, 180, new Object[]{ getMessage() }, "Receiving Facility");
93                                    this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Date/Time Of Message");
94                                    this.add(ST.class, false, 1, 40, new Object[]{ getMessage() }, "Security");
95                                    this.add(MSG.class, true, 1, 7, new Object[]{ getMessage() }, "Message Type");
96                                    this.add(ST.class, true, 1, 20, new Object[]{ getMessage() }, "Message Control ID");
97                                    this.add(PT.class, true, 1, 3, new Object[]{ getMessage() }, "Processing ID");
98                                    this.add(VID.class, true, 1, 60, new Object[]{ getMessage() }, "Version ID");
99                                    this.add(NM.class, false, 1, 15, new Object[]{ getMessage() }, "Sequence Number");
100                                   this.add(ST.class, false, 1, 180, new Object[]{ getMessage() }, "Continuation Pointer");
101                                               this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(155) }, "Accept Acknowledgment Type");
102                                               this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(155) }, "Application Acknowledgment Type");
103                                               this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(0) }, "Country Code");
104                                               this.add(ID.class, false, 0, 16, new Object[]{ getMessage(), new Integer(211) }, "Character Set");
105                                   this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Principal Language Of Message");
106                                               this.add(ID.class, false, 1, 20, new Object[]{ getMessage(), new Integer(356) }, "Alternate Character Set Handling Scheme");
107        } catch(HL7Exception e) {
108           log.error("Unexpected error creating MSH - this is probably a bug in the source code generator.", e);
109        }
110     }
111 
112 
113 
114     /**
115      * Returns
116      * MSH-1: "Field Separator" - creates it if necessary
117      */
118     public ST getFieldSeparator() { 
119 		ST retVal = this.getTypedField(1, 0);
120 		return retVal;
121     }
122     
123     /**
124      * Returns
125      * MSH-1: "Field Separator" - creates it if necessary
126      */
127     public ST getMsh1_FieldSeparator() { 
128 		ST retVal = this.getTypedField(1, 0);
129 		return retVal;
130     }
131 
132 
133 
134     /**
135      * Returns
136      * MSH-2: "Encoding Characters" - creates it if necessary
137      */
138     public ST getEncodingCharacters() { 
139 		ST retVal = this.getTypedField(2, 0);
140 		return retVal;
141     }
142     
143     /**
144      * Returns
145      * MSH-2: "Encoding Characters" - creates it if necessary
146      */
147     public ST getMsh2_EncodingCharacters() { 
148 		ST retVal = this.getTypedField(2, 0);
149 		return retVal;
150     }
151 
152 
153 
154     /**
155      * Returns
156      * MSH-3: "Sending Application" - creates it if necessary
157      */
158     public HD getSendingApplication() { 
159 		HD retVal = this.getTypedField(3, 0);
160 		return retVal;
161     }
162     
163     /**
164      * Returns
165      * MSH-3: "Sending Application" - creates it if necessary
166      */
167     public HD getMsh3_SendingApplication() { 
168 		HD retVal = this.getTypedField(3, 0);
169 		return retVal;
170     }
171 
172 
173 
174     /**
175      * Returns
176      * MSH-4: "Sending Facility" - creates it if necessary
177      */
178     public HD getSendingFacility() { 
179 		HD retVal = this.getTypedField(4, 0);
180 		return retVal;
181     }
182     
183     /**
184      * Returns
185      * MSH-4: "Sending Facility" - creates it if necessary
186      */
187     public HD getMsh4_SendingFacility() { 
188 		HD retVal = this.getTypedField(4, 0);
189 		return retVal;
190     }
191 
192 
193 
194     /**
195      * Returns
196      * MSH-5: "Receiving Application" - creates it if necessary
197      */
198     public HD getReceivingApplication() { 
199 		HD retVal = this.getTypedField(5, 0);
200 		return retVal;
201     }
202     
203     /**
204      * Returns
205      * MSH-5: "Receiving Application" - creates it if necessary
206      */
207     public HD getMsh5_ReceivingApplication() { 
208 		HD retVal = this.getTypedField(5, 0);
209 		return retVal;
210     }
211 
212 
213 
214     /**
215      * Returns
216      * MSH-6: "Receiving Facility" - creates it if necessary
217      */
218     public HD getReceivingFacility() { 
219 		HD retVal = this.getTypedField(6, 0);
220 		return retVal;
221     }
222     
223     /**
224      * Returns
225      * MSH-6: "Receiving Facility" - creates it if necessary
226      */
227     public HD getMsh6_ReceivingFacility() { 
228 		HD retVal = this.getTypedField(6, 0);
229 		return retVal;
230     }
231 
232 
233 
234     /**
235      * Returns
236      * MSH-7: "Date/Time Of Message" - creates it if necessary
237      */
238     public TS getDateTimeOfMessage() { 
239 		TS retVal = this.getTypedField(7, 0);
240 		return retVal;
241     }
242     
243     /**
244      * Returns
245      * MSH-7: "Date/Time Of Message" - creates it if necessary
246      */
247     public TS getMsh7_DateTimeOfMessage() { 
248 		TS retVal = this.getTypedField(7, 0);
249 		return retVal;
250     }
251 
252 
253 
254     /**
255      * Returns
256      * MSH-8: "Security" - creates it if necessary
257      */
258     public ST getSecurity() { 
259 		ST retVal = this.getTypedField(8, 0);
260 		return retVal;
261     }
262     
263     /**
264      * Returns
265      * MSH-8: "Security" - creates it if necessary
266      */
267     public ST getMsh8_Security() { 
268 		ST retVal = this.getTypedField(8, 0);
269 		return retVal;
270     }
271 
272 
273 
274     /**
275      * Returns
276      * MSH-9: "Message Type" - creates it if necessary
277      */
278     public MSG getMessageType() { 
279 		MSG retVal = this.getTypedField(9, 0);
280 		return retVal;
281     }
282     
283     /**
284      * Returns
285      * MSH-9: "Message Type" - creates it if necessary
286      */
287     public MSG getMsh9_MessageType() { 
288 		MSG retVal = this.getTypedField(9, 0);
289 		return retVal;
290     }
291 
292 
293 
294     /**
295      * Returns
296      * MSH-10: "Message Control ID" - creates it if necessary
297      */
298     public ST getMessageControlID() { 
299 		ST retVal = this.getTypedField(10, 0);
300 		return retVal;
301     }
302     
303     /**
304      * Returns
305      * MSH-10: "Message Control ID" - creates it if necessary
306      */
307     public ST getMsh10_MessageControlID() { 
308 		ST retVal = this.getTypedField(10, 0);
309 		return retVal;
310     }
311 
312 
313 
314     /**
315      * Returns
316      * MSH-11: "Processing ID" - creates it if necessary
317      */
318     public PT getProcessingID() { 
319 		PT retVal = this.getTypedField(11, 0);
320 		return retVal;
321     }
322     
323     /**
324      * Returns
325      * MSH-11: "Processing ID" - creates it if necessary
326      */
327     public PT getMsh11_ProcessingID() { 
328 		PT retVal = this.getTypedField(11, 0);
329 		return retVal;
330     }
331 
332 
333 
334     /**
335      * Returns
336      * MSH-12: "Version ID" - creates it if necessary
337      */
338     public VID getVersionID() { 
339 		VID retVal = this.getTypedField(12, 0);
340 		return retVal;
341     }
342     
343     /**
344      * Returns
345      * MSH-12: "Version ID" - creates it if necessary
346      */
347     public VID getMsh12_VersionID() { 
348 		VID retVal = this.getTypedField(12, 0);
349 		return retVal;
350     }
351 
352 
353 
354     /**
355      * Returns
356      * MSH-13: "Sequence Number" - creates it if necessary
357      */
358     public NM getSequenceNumber() { 
359 		NM retVal = this.getTypedField(13, 0);
360 		return retVal;
361     }
362     
363     /**
364      * Returns
365      * MSH-13: "Sequence Number" - creates it if necessary
366      */
367     public NM getMsh13_SequenceNumber() { 
368 		NM retVal = this.getTypedField(13, 0);
369 		return retVal;
370     }
371 
372 
373 
374     /**
375      * Returns
376      * MSH-14: "Continuation Pointer" - creates it if necessary
377      */
378     public ST getContinuationPointer() { 
379 		ST retVal = this.getTypedField(14, 0);
380 		return retVal;
381     }
382     
383     /**
384      * Returns
385      * MSH-14: "Continuation Pointer" - creates it if necessary
386      */
387     public ST getMsh14_ContinuationPointer() { 
388 		ST retVal = this.getTypedField(14, 0);
389 		return retVal;
390     }
391 
392 
393 
394     /**
395      * Returns
396      * MSH-15: "Accept Acknowledgment Type" - creates it if necessary
397      */
398     public ID getAcceptAcknowledgmentType() { 
399 		ID retVal = this.getTypedField(15, 0);
400 		return retVal;
401     }
402     
403     /**
404      * Returns
405      * MSH-15: "Accept Acknowledgment Type" - creates it if necessary
406      */
407     public ID getMsh15_AcceptAcknowledgmentType() { 
408 		ID retVal = this.getTypedField(15, 0);
409 		return retVal;
410     }
411 
412 
413 
414     /**
415      * Returns
416      * MSH-16: "Application Acknowledgment Type" - creates it if necessary
417      */
418     public ID getApplicationAcknowledgmentType() { 
419 		ID retVal = this.getTypedField(16, 0);
420 		return retVal;
421     }
422     
423     /**
424      * Returns
425      * MSH-16: "Application Acknowledgment Type" - creates it if necessary
426      */
427     public ID getMsh16_ApplicationAcknowledgmentType() { 
428 		ID retVal = this.getTypedField(16, 0);
429 		return retVal;
430     }
431 
432 
433 
434     /**
435      * Returns
436      * MSH-17: "Country Code" - creates it if necessary
437      */
438     public ID getCountryCode() { 
439 		ID retVal = this.getTypedField(17, 0);
440 		return retVal;
441     }
442     
443     /**
444      * Returns
445      * MSH-17: "Country Code" - creates it if necessary
446      */
447     public ID getMsh17_CountryCode() { 
448 		ID retVal = this.getTypedField(17, 0);
449 		return retVal;
450     }
451 
452 
453     /**
454      * Returns all repetitions of Character Set (MSH-18).
455      */
456     public ID[] getCharacterSet() {
457     	ID[] retVal = this.getTypedField(18, new ID[0]);
458     	return retVal;
459     }
460 
461 
462     /**
463      * Returns all repetitions of Character Set (MSH-18).
464      */
465     public ID[] getMsh18_CharacterSet() {
466     	ID[] retVal = this.getTypedField(18, new ID[0]);
467     	return retVal;
468     }
469 
470 
471     /**
472      * Returns a count of the current number of repetitions of Character Set (MSH-18).
473      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
474      * it will return zero.
475      */
476     public int getCharacterSetReps() {
477     	return this.getReps(18);
478     }
479 
480 
481     /**
482      * Returns a specific repetition of
483      * MSH-18: "Character Set" - creates it if necessary
484      *
485      * @param rep The repetition index (0-indexed)
486      */
487     public ID getCharacterSet(int rep) { 
488 		ID retVal = this.getTypedField(18, rep);
489 		return retVal;
490     }
491 
492     /**
493      * Returns a specific repetition of
494      * MSH-18: "Character Set" - creates it if necessary
495      *
496      * @param rep The repetition index (0-indexed)
497      */
498     public ID getMsh18_CharacterSet(int rep) { 
499 		ID retVal = this.getTypedField(18, rep);
500 		return retVal;
501     }
502 
503     /**
504      * Returns a count of the current number of repetitions of Character Set (MSH-18).
505      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
506      * it will return zero.
507      */
508     public int getMsh18_CharacterSetReps() {
509     	return this.getReps(18);
510     }
511 
512 
513     /**
514      * Inserts a repetition of
515      * MSH-18: "Character Set" at a specific index
516      *
517      * @param rep The repetition index (0-indexed)
518      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
519      */
520     public ID insertCharacterSet(int rep) throws HL7Exception { 
521         return (ID) super.insertRepetition(18, rep);
522     }
523 
524 
525     /**
526      * Inserts a repetition of
527      * MSH-18: "Character Set" at a specific index
528      *
529      * @param rep The repetition index (0-indexed)
530      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
531      */
532     public ID insertMsh18_CharacterSet(int rep) throws HL7Exception { 
533         return (ID) super.insertRepetition(18, rep);
534     }
535 
536 
537     /**
538      * Removes a repetition of
539      * MSH-18: "Character Set" at a specific index
540      *
541      * @param rep The repetition index (0-indexed)
542      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
543      */
544     public ID removeCharacterSet(int rep) throws HL7Exception { 
545         return (ID) super.removeRepetition(18, rep);
546     }
547 
548 
549     /**
550      * Removes a repetition of
551      * MSH-18: "Character Set" at a specific index
552      *
553      * @param rep The repetition index (0-indexed)
554      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
555      */
556     public ID removeMsh18_CharacterSet(int rep) throws HL7Exception { 
557         return (ID) super.removeRepetition(18, rep);
558     }
559 
560 
561 
562 
563     /**
564      * Returns
565      * MSH-19: "Principal Language Of Message" - creates it if necessary
566      */
567     public CE getPrincipalLanguageOfMessage() { 
568 		CE retVal = this.getTypedField(19, 0);
569 		return retVal;
570     }
571     
572     /**
573      * Returns
574      * MSH-19: "Principal Language Of Message" - creates it if necessary
575      */
576     public CE getMsh19_PrincipalLanguageOfMessage() { 
577 		CE retVal = this.getTypedField(19, 0);
578 		return retVal;
579     }
580 
581 
582 
583     /**
584      * Returns
585      * MSH-20: "Alternate Character Set Handling Scheme" - creates it if necessary
586      */
587     public ID getAlternateCharacterSetHandlingScheme() { 
588 		ID retVal = this.getTypedField(20, 0);
589 		return retVal;
590     }
591     
592     /**
593      * Returns
594      * MSH-20: "Alternate Character Set Handling Scheme" - creates it if necessary
595      */
596     public ID getMsh20_AlternateCharacterSetHandlingScheme() { 
597 		ID retVal = this.getTypedField(20, 0);
598 		return retVal;
599     }
600 
601 
602 
603 
604 
605     /** {@inheritDoc} */   
606     protected Type createNewTypeWithoutReflection(int field) {
607        switch (field) {
608           case 0: return new ST(getMessage());
609           case 1: return new ST(getMessage());
610           case 2: return new HD(getMessage());
611           case 3: return new HD(getMessage());
612           case 4: return new HD(getMessage());
613           case 5: return new HD(getMessage());
614           case 6: return new TS(getMessage());
615           case 7: return new ST(getMessage());
616           case 8: return new MSG(getMessage());
617           case 9: return new ST(getMessage());
618           case 10: return new PT(getMessage());
619           case 11: return new VID(getMessage());
620           case 12: return new NM(getMessage());
621           case 13: return new ST(getMessage());
622           case 14: return new ID(getMessage(), new Integer( 155 ));
623           case 15: return new ID(getMessage(), new Integer( 155 ));
624           case 16: return new ID(getMessage(), new Integer( 0 ));
625           case 17: return new ID(getMessage(), new Integer( 211 ));
626           case 18: return new CE(getMessage());
627           case 19: return new ID(getMessage(), new Integer( 356 ));
628           default: return null;
629        }
630    }
631 
632 
633 }
634