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   
8   package com.foo.a31.message;
9   
10  import com.foo.a31.segment.*;
11  
12  import ca.uhn.log.HapiLogFactory;
13  import ca.uhn.hl7v2.HL7Exception;
14  import ca.uhn.hl7v2.parser.ModelClassFactory;
15  import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
16  import ca.uhn.hl7v2.model.AbstractMessage;
17  
18  /**
19   * <p>Represents a ADT_A05 message structure (see chapter ). This structure contains the 
20   * following elements: </p>
21   * <ul>
22                   * <li>1: MSH (Message Header) <b> </b></li>
23                   * <li>2: EVN (Event Type) <b> </b></li>
24                   * <li>3: PID (Patient identification) <b> </b></li>
25   * </ul>
26   */
27  public class ADT_A05 extends AbstractMessage  {
28  
29      /** 
30       * Creates a new ADT_A05 message with custom ModelClassFactory.
31       */
32      public ADT_A05(ModelClassFactory factory) {
33         super(factory);
34         init(factory);
35      }
36  
37      /**
38       * Creates a new ADT_A05 message with DefaultModelClassFactory. 
39       */ 
40      public ADT_A05() { 
41         super(new DefaultModelClassFactory());
42         init(new DefaultModelClassFactory());
43      }
44  
45      private void init(ModelClassFactory factory) {
46         try {
47                            this.add(MSH.class, true, false);
48                            this.add(EVN.class, true, false);
49                            this.add(PID.class, true, false);
50         } catch(HL7Exception e) {
51            HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating ADT_A05 - this is probably a bug in the source code generator.", e);
52         }
53      }
54  
55      /** 
56       * Returns "2.4"
57       */
58      public String getVersion() {
59         return "2.4";
60      }
61  
62  
63  
64      /**
65       * Returns
66       * MSH (Message Header) - creates it if necessary
67       */
68      public MSH getMSH() { 
69         MSH ret = null;
70         try {
71            ret = (MSH)this.get("MSH");
72         } catch(HL7Exception e) {
73            HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
74            throw new RuntimeException(e);
75         }
76         return ret;
77      }
78  
79  
80  
81  
82      /**
83       * Returns
84       * EVN (Event Type) - creates it if necessary
85       */
86      public EVN getEVN() { 
87         EVN ret = null;
88         try {
89            ret = (EVN)this.get("EVN");
90         } catch(HL7Exception e) {
91            HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
92            throw new RuntimeException(e);
93         }
94         return ret;
95      }
96  
97  
98  
99  
100     /**
101      * Returns
102      * PID (Patient identification) - creates it if necessary
103      */
104     public PID getPID() { 
105        PID ret = null;
106        try {
107           ret = (PID)this.get("PID");
108        } catch(HL7Exception e) {
109           HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
110           throw new RuntimeException(e);
111        }
112        return ret;
113     }
114 
115 
116 
117 
118 }
119