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