001 /*
002 * This class is an auto-generated source file for a HAPI
003 * HL7 v2.x standard structure class.
004 *
005 * For more information, visit: http://hl7api.sourceforge.net/
006 */
007
008 package ca.uhn.hl7v2.model.v24.datatype;
009
010 import ca.uhn.hl7v2.model.Composite;
011 import ca.uhn.hl7v2.model.DataTypeException;
012 import ca.uhn.hl7v2.model.Message;
013 import ca.uhn.hl7v2.model.Type;
014 import ca.uhn.hl7v2.model.AbstractType;
015 import ca.uhn.log.HapiLogFactory;
016
017 /**
018 * <p>Represents an HL7 XON (extended composite name and identification number for organizations) data type.
019 * This type consists of the following components:</p>
020 * <ul>
021 * <li>organization name (ST)
022 * <li>organization name type code (IS)
023 * <li>ID number (NM) (NM)
024 * <li>check digit (NM) (ST)
025 * <li>code identifying the check digit scheme employed (ID)
026 * <li>assigning authority (HD)
027 * <li>identifier type code (IS) (IS)
028 * <li>assigning facility ID (HD)
029 * <li>Name Representation code (ID)
030 * </ul>
031 */
032 public class XON extends AbstractType implements Composite {
033
034 private Type[] data;
035
036 /**
037 * Creates a new XON type
038 */
039 public XON(Message message) {
040 super(message);
041 init();
042 }
043
044 private void init() {
045 data = new Type[9];
046 data[0] = new ST(getMessage());
047 data[1] = new IS(getMessage(), 0);
048 data[2] = new NM(getMessage());
049 data[3] = new ST(getMessage());
050 data[4] = new ID(getMessage(), 0);
051 data[5] = new HD(getMessage());
052 data[6] = new IS(getMessage(), 0);
053 data[7] = new HD(getMessage());
054 data[8] = new ID(getMessage(), 0);
055 }
056
057
058 /**
059 * Returns an array containing the data elements.
060 */
061 public Type[] getComponents() {
062 return this.data;
063 }
064
065 /**
066 * Returns an individual data component.
067 *
068 * @param number The component number (0-indexed)
069 * @throws DataTypeException if the given element number is out of range.
070 */
071 public Type getComponent(int number) throws DataTypeException {
072
073 try {
074 return this.data[number];
075 } catch (ArrayIndexOutOfBoundsException e) {
076 throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)");
077 }
078 }
079
080
081 /**
082 * Returns organization name (component #1). This is a convenience method that saves you from
083 * casting and handling an exception.
084 */
085 public ST getOrganizationName() {
086 ST ret = null;
087 try {
088 ret = (ST)getComponent(0);
089 } catch (DataTypeException e) {
090 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
091 throw new RuntimeException(e);
092 }
093 return ret;
094 }
095
096
097 /**
098 * Returns organization name (component #1). This is a convenience method that saves you from
099 * casting and handling an exception.
100 */
101 public ST getXon1_OrganizationName() {
102 ST ret = null;
103 try {
104 ret = (ST)getComponent(0);
105 } catch (DataTypeException e) {
106 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
107 throw new RuntimeException(e);
108 }
109 return ret;
110 }
111
112
113 /**
114 * Returns organization name type code (component #2). This is a convenience method that saves you from
115 * casting and handling an exception.
116 */
117 public IS getOrganizationNameTypeCode() {
118 IS ret = null;
119 try {
120 ret = (IS)getComponent(1);
121 } catch (DataTypeException e) {
122 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
123 throw new RuntimeException(e);
124 }
125 return ret;
126 }
127
128
129 /**
130 * Returns organization name type code (component #2). This is a convenience method that saves you from
131 * casting and handling an exception.
132 */
133 public IS getXon2_OrganizationNameTypeCode() {
134 IS ret = null;
135 try {
136 ret = (IS)getComponent(1);
137 } catch (DataTypeException e) {
138 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
139 throw new RuntimeException(e);
140 }
141 return ret;
142 }
143
144
145 /**
146 * Returns ID number (NM) (component #3). This is a convenience method that saves you from
147 * casting and handling an exception.
148 */
149 public NM getIDNumber() {
150 NM ret = null;
151 try {
152 ret = (NM)getComponent(2);
153 } catch (DataTypeException e) {
154 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
155 throw new RuntimeException(e);
156 }
157 return ret;
158 }
159
160
161 /**
162 * Returns ID number (NM) (component #3). This is a convenience method that saves you from
163 * casting and handling an exception.
164 */
165 public NM getXon3_IDNumber() {
166 NM ret = null;
167 try {
168 ret = (NM)getComponent(2);
169 } catch (DataTypeException e) {
170 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
171 throw new RuntimeException(e);
172 }
173 return ret;
174 }
175
176
177 /**
178 * Returns check digit (NM) (component #4). This is a convenience method that saves you from
179 * casting and handling an exception.
180 */
181 public ST getCheckDigit() {
182 ST ret = null;
183 try {
184 ret = (ST)getComponent(3);
185 } catch (DataTypeException e) {
186 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
187 throw new RuntimeException(e);
188 }
189 return ret;
190 }
191
192
193 /**
194 * Returns check digit (NM) (component #4). This is a convenience method that saves you from
195 * casting and handling an exception.
196 */
197 public ST getXon4_CheckDigit() {
198 ST ret = null;
199 try {
200 ret = (ST)getComponent(3);
201 } catch (DataTypeException e) {
202 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
203 throw new RuntimeException(e);
204 }
205 return ret;
206 }
207
208
209 /**
210 * Returns code identifying the check digit scheme employed (component #5). This is a convenience method that saves you from
211 * casting and handling an exception.
212 */
213 public ID getCodeIdentifyingTheCheckDigitSchemeEmployed() {
214 ID ret = null;
215 try {
216 ret = (ID)getComponent(4);
217 } catch (DataTypeException e) {
218 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
219 throw new RuntimeException(e);
220 }
221 return ret;
222 }
223
224
225 /**
226 * Returns code identifying the check digit scheme employed (component #5). This is a convenience method that saves you from
227 * casting and handling an exception.
228 */
229 public ID getXon5_CodeIdentifyingTheCheckDigitSchemeEmployed() {
230 ID ret = null;
231 try {
232 ret = (ID)getComponent(4);
233 } catch (DataTypeException e) {
234 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
235 throw new RuntimeException(e);
236 }
237 return ret;
238 }
239
240
241 /**
242 * Returns assigning authority (component #6). This is a convenience method that saves you from
243 * casting and handling an exception.
244 */
245 public HD getAssigningAuthority() {
246 HD ret = null;
247 try {
248 ret = (HD)getComponent(5);
249 } catch (DataTypeException e) {
250 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
251 throw new RuntimeException(e);
252 }
253 return ret;
254 }
255
256
257 /**
258 * Returns assigning authority (component #6). This is a convenience method that saves you from
259 * casting and handling an exception.
260 */
261 public HD getXon6_AssigningAuthority() {
262 HD ret = null;
263 try {
264 ret = (HD)getComponent(5);
265 } catch (DataTypeException e) {
266 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
267 throw new RuntimeException(e);
268 }
269 return ret;
270 }
271
272
273 /**
274 * Returns identifier type code (IS) (component #7). This is a convenience method that saves you from
275 * casting and handling an exception.
276 */
277 public IS getIdentifierTypeCode() {
278 IS ret = null;
279 try {
280 ret = (IS)getComponent(6);
281 } catch (DataTypeException e) {
282 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
283 throw new RuntimeException(e);
284 }
285 return ret;
286 }
287
288
289 /**
290 * Returns identifier type code (IS) (component #7). This is a convenience method that saves you from
291 * casting and handling an exception.
292 */
293 public IS getXon7_IdentifierTypeCode() {
294 IS ret = null;
295 try {
296 ret = (IS)getComponent(6);
297 } catch (DataTypeException e) {
298 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
299 throw new RuntimeException(e);
300 }
301 return ret;
302 }
303
304
305 /**
306 * Returns assigning facility ID (component #8). This is a convenience method that saves you from
307 * casting and handling an exception.
308 */
309 public HD getAssigningFacilityID() {
310 HD ret = null;
311 try {
312 ret = (HD)getComponent(7);
313 } catch (DataTypeException e) {
314 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
315 throw new RuntimeException(e);
316 }
317 return ret;
318 }
319
320
321 /**
322 * Returns assigning facility ID (component #8). This is a convenience method that saves you from
323 * casting and handling an exception.
324 */
325 public HD getXon8_AssigningFacilityID() {
326 HD ret = null;
327 try {
328 ret = (HD)getComponent(7);
329 } catch (DataTypeException e) {
330 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
331 throw new RuntimeException(e);
332 }
333 return ret;
334 }
335
336
337 /**
338 * Returns Name Representation code (component #9). This is a convenience method that saves you from
339 * casting and handling an exception.
340 */
341 public ID getNameRepresentationCode() {
342 ID ret = null;
343 try {
344 ret = (ID)getComponent(8);
345 } catch (DataTypeException e) {
346 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
347 throw new RuntimeException(e);
348 }
349 return ret;
350 }
351
352
353 /**
354 * Returns Name Representation code (component #9). This is a convenience method that saves you from
355 * casting and handling an exception.
356 */
357 public ID getXon9_NameRepresentationCode() {
358 ID ret = null;
359 try {
360 ret = (ID)getComponent(8);
361 } catch (DataTypeException e) {
362 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
363 throw new RuntimeException(e);
364 }
365 return ret;
366 }
367
368
369
370 }
371