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 "ED.java".  Description:
15   * "Composite class ED"
16   * 
17   * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
18   * 2013.  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  package ca.uhn.hl7v2.model.v27.datatype;
34  
35  import ca.uhn.hl7v2.model.DataTypeException;
36  import ca.uhn.hl7v2.model.Message;
37  import ca.uhn.hl7v2.model.Type;
38  import ca.uhn.hl7v2.model.AbstractComposite;
39  
40  
41  /**
42   * <p>Represents an HL7 ED (Encapsulated Data) data type. 
43   * This type consists of the following components:</p>
44   * <ul>
45   * <li>Source Application (HD)
46   * <li>Type of Data (ID)
47   * <li>Data Subtype (ID)
48   * <li>Encoding (ID)
49   * <li>Data (TX)
50   * </ul>
51   */
52  @SuppressWarnings("unused")
53  public class ED extends AbstractComposite {
54  
55      private Type[] data;
56  
57      /** 
58       * Creates a new ED type
59       */
60      public ED(Message message) {
61          super(message);
62          init();
63      }
64  
65      private void init() {
66          data = new Type[5];    
67          data[0] = new HD(getMessage());
68          data[1] = new ID(getMessage(), 834);
69          data[2] = new ID(getMessage(), 291);
70          data[3] = new ID(getMessage(), 299);
71          data[4] = new TX(getMessage());
72      }
73  
74  
75      /**
76       * Returns an array containing the data elements.
77       */
78      public Type[] getComponents() { 
79          return this.data; 
80      }
81  
82      /**
83       * Returns an individual data component.
84       *
85       * @param number The component number (0-indexed)
86       * @throws DataTypeException if the given element number is out of range.
87       */
88      public Type getComponent(int number) throws DataTypeException { 
89  
90          try { 
91              return this.data[number]; 
92          } catch (ArrayIndexOutOfBoundsException e) { 
93              throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)"); 
94          } 
95      } 
96  
97  
98      /**
99       * Returns Source Application (component 1).  This is a convenience method that saves you from 
100      * casting and handling an exception.
101      */
102     public HD getSourceApplication() {
103        return getTyped(0, HD.class);
104     }
105 
106     
107     /**
108      * Returns Source Application (component 1).  This is a convenience method that saves you from 
109      * casting and handling an exception.
110      */
111     public HD getEd1_SourceApplication() {
112        return getTyped(0, HD.class);
113     }
114 
115 
116     /**
117      * Returns Type of Data (component 2).  This is a convenience method that saves you from 
118      * casting and handling an exception.
119      */
120     public ID getTypeOfData() {
121        return getTyped(1, ID.class);
122     }
123 
124     
125     /**
126      * Returns Type of Data (component 2).  This is a convenience method that saves you from 
127      * casting and handling an exception.
128      */
129     public ID getEd2_TypeOfData() {
130        return getTyped(1, ID.class);
131     }
132 
133 
134     /**
135      * Returns Data Subtype (component 3).  This is a convenience method that saves you from 
136      * casting and handling an exception.
137      */
138     public ID getDataSubtype() {
139        return getTyped(2, ID.class);
140     }
141 
142     
143     /**
144      * Returns Data Subtype (component 3).  This is a convenience method that saves you from 
145      * casting and handling an exception.
146      */
147     public ID getEd3_DataSubtype() {
148        return getTyped(2, ID.class);
149     }
150 
151 
152     /**
153      * Returns Encoding (component 4).  This is a convenience method that saves you from 
154      * casting and handling an exception.
155      */
156     public ID getEncoding() {
157        return getTyped(3, ID.class);
158     }
159 
160     
161     /**
162      * Returns Encoding (component 4).  This is a convenience method that saves you from 
163      * casting and handling an exception.
164      */
165     public ID getEd4_Encoding() {
166        return getTyped(3, ID.class);
167     }
168 
169 
170     /**
171      * Returns Data (component 5).  This is a convenience method that saves you from 
172      * casting and handling an exception.
173      */
174     public TX getData() {
175        return getTyped(4, TX.class);
176     }
177 
178     
179     /**
180      * Returns Data (component 5).  This is a convenience method that saves you from 
181      * casting and handling an exception.
182      */
183     public TX getEd5_Data() {
184        return getTyped(4, TX.class);
185     }
186 
187 
188 
189 }
190