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 * The contents of this file are subject to the Mozilla Public License Version 1.1 
008 * (the "License"); you may not use this file except in compliance with the License. 
009 * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
010 * Software distributed under the License is distributed on an "AS IS" basis, 
011 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
012 * specific language governing rights and limitations under the License. 
013 * 
014 * The Original Code is "[file_name]".  Description: 
015 * "[one_line_description]" 
016 * 
017 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
018 * 2012.  All Rights Reserved. 
019 * 
020 * Contributor(s): ______________________________________. 
021 * 
022 * Alternatively, the contents of this file may be used under the terms of the 
023 * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
024 * applicable instead of those above.  If you wish to allow use of your version of this 
025 * file only under the terms of the GPL and not to allow others to use your version 
026 * of this file under the MPL, indicate your decision by deleting  the provisions above 
027 * and replace  them with the notice and other provisions required by the GPL License.  
028 * If you do not delete the provisions above, a recipient may use your version of 
029 * this file under either the MPL or the GPL. 
030 * 
031 */
032
033package ca.uhn.hl7v2.model.v26.datatype;
034
035import ca.uhn.hl7v2.model.DataTypeException;
036import ca.uhn.hl7v2.model.Message;
037import ca.uhn.hl7v2.model.Type;
038import ca.uhn.hl7v2.model.AbstractComposite;
039
040/**
041 * <p>Represents an HL7 XAD (Extended Address) data type. 
042 * This type consists of the following components:</p>
043 * <ul>
044 * <li>Street Address (SAD)
045 * <li>Other Designation (ST)
046 * <li>City (ST)
047 * <li>State or Province (ST)
048 * <li>Zip or Postal Code (ST)
049 * <li>Country (ID)
050 * <li>Address Type (ID)
051 * <li>Other Geographic Designation (ST)
052 * <li>County/Parish Code (IS)
053 * <li>Census Tract (IS)
054 * <li>Address Representation Code (ID)
055 * <li>Address Validity Range (DR)
056 * <li>Effective Date (DTM)
057 * <li>Expiration Date (DTM)
058 * <li>Expiration Reason (CWE)
059 * <li>Temporary Indicator (ID)
060 * <li>Bad Address Indicator (ID)
061 * <li>Address Usage (ID)
062 * <li>Addressee (ST)
063 * <li>Comment (ST)
064 * <li>Preference Order (NM)
065 * <li>Protection Code (CWE)
066 * <li>Address Identifier (EI)
067 * </ul>
068 */
069@SuppressWarnings("unused")
070public class XAD extends AbstractComposite {
071
072    private Type[] data;
073
074    /** 
075     * Creates a new XAD type
076     */
077    public XAD(Message message) {
078        super(message);
079        init();
080    }
081
082    private void init() {
083        data = new Type[23];    
084        data[0] = new SAD(getMessage());
085        data[1] = new ST(getMessage());
086        data[2] = new ST(getMessage());
087        data[3] = new ST(getMessage());
088        data[4] = new ST(getMessage());
089        data[5] = new ID(getMessage(), 399);
090        data[6] = new ID(getMessage(), 190);
091        data[7] = new ST(getMessage());
092        data[8] = new IS(getMessage(), 289);
093        data[9] = new IS(getMessage(), 288);
094        data[10] = new ID(getMessage(), 465);
095        data[11] = new DR(getMessage());
096        data[12] = new DTM(getMessage());
097        data[13] = new DTM(getMessage());
098        data[14] = new CWE(getMessage());
099        data[15] = new ID(getMessage(), 136);
100        data[16] = new ID(getMessage(), 136);
101        data[17] = new ID(getMessage(), 617);
102        data[18] = new ST(getMessage());
103        data[19] = new ST(getMessage());
104        data[20] = new NM(getMessage());
105        data[21] = new CWE(getMessage());
106        data[22] = new EI(getMessage());
107    }
108
109
110    /**
111     * Returns an array containing the data elements.
112     */
113    public Type[] getComponents() { 
114        return this.data; 
115    }
116
117    /**
118     * Returns an individual data component.
119     *
120     * @param number The component number (0-indexed)
121     * @throws DataTypeException if the given element number is out of range.
122     */
123    public Type getComponent(int number) throws DataTypeException { 
124
125        try { 
126            return this.data[number]; 
127        } catch (ArrayIndexOutOfBoundsException e) { 
128            throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)"); 
129        } 
130    } 
131
132
133    /**
134     * Returns Street Address (component 1).  This is a convenience method that saves you from 
135     * casting and handling an exception.
136     */
137    public SAD getStreetAddress() {
138       return getTyped(0, SAD.class);
139    }
140
141    
142    /**
143     * Returns Street Address (component 1).  This is a convenience method that saves you from 
144     * casting and handling an exception.
145     */
146    public SAD getXad1_StreetAddress() {
147       return getTyped(0, SAD.class);
148    }
149
150
151    /**
152     * Returns Other Designation (component 2).  This is a convenience method that saves you from 
153     * casting and handling an exception.
154     */
155    public ST getOtherDesignation() {
156       return getTyped(1, ST.class);
157    }
158
159    
160    /**
161     * Returns Other Designation (component 2).  This is a convenience method that saves you from 
162     * casting and handling an exception.
163     */
164    public ST getXad2_OtherDesignation() {
165       return getTyped(1, ST.class);
166    }
167
168
169    /**
170     * Returns City (component 3).  This is a convenience method that saves you from 
171     * casting and handling an exception.
172     */
173    public ST getCity() {
174       return getTyped(2, ST.class);
175    }
176
177    
178    /**
179     * Returns City (component 3).  This is a convenience method that saves you from 
180     * casting and handling an exception.
181     */
182    public ST getXad3_City() {
183       return getTyped(2, ST.class);
184    }
185
186
187    /**
188     * Returns State or Province (component 4).  This is a convenience method that saves you from 
189     * casting and handling an exception.
190     */
191    public ST getStateOrProvince() {
192       return getTyped(3, ST.class);
193    }
194
195    
196    /**
197     * Returns State or Province (component 4).  This is a convenience method that saves you from 
198     * casting and handling an exception.
199     */
200    public ST getXad4_StateOrProvince() {
201       return getTyped(3, ST.class);
202    }
203
204
205    /**
206     * Returns Zip or Postal Code (component 5).  This is a convenience method that saves you from 
207     * casting and handling an exception.
208     */
209    public ST getZipOrPostalCode() {
210       return getTyped(4, ST.class);
211    }
212
213    
214    /**
215     * Returns Zip or Postal Code (component 5).  This is a convenience method that saves you from 
216     * casting and handling an exception.
217     */
218    public ST getXad5_ZipOrPostalCode() {
219       return getTyped(4, ST.class);
220    }
221
222
223    /**
224     * Returns Country (component 6).  This is a convenience method that saves you from 
225     * casting and handling an exception.
226     */
227    public ID getCountry() {
228       return getTyped(5, ID.class);
229    }
230
231    
232    /**
233     * Returns Country (component 6).  This is a convenience method that saves you from 
234     * casting and handling an exception.
235     */
236    public ID getXad6_Country() {
237       return getTyped(5, ID.class);
238    }
239
240
241    /**
242     * Returns Address Type (component 7).  This is a convenience method that saves you from 
243     * casting and handling an exception.
244     */
245    public ID getAddressType() {
246       return getTyped(6, ID.class);
247    }
248
249    
250    /**
251     * Returns Address Type (component 7).  This is a convenience method that saves you from 
252     * casting and handling an exception.
253     */
254    public ID getXad7_AddressType() {
255       return getTyped(6, ID.class);
256    }
257
258
259    /**
260     * Returns Other Geographic Designation (component 8).  This is a convenience method that saves you from 
261     * casting and handling an exception.
262     */
263    public ST getOtherGeographicDesignation() {
264       return getTyped(7, ST.class);
265    }
266
267    
268    /**
269     * Returns Other Geographic Designation (component 8).  This is a convenience method that saves you from 
270     * casting and handling an exception.
271     */
272    public ST getXad8_OtherGeographicDesignation() {
273       return getTyped(7, ST.class);
274    }
275
276
277    /**
278     * Returns County/Parish Code (component 9).  This is a convenience method that saves you from 
279     * casting and handling an exception.
280     */
281    public IS getCountyParishCode() {
282       return getTyped(8, IS.class);
283    }
284
285    
286    /**
287     * Returns County/Parish Code (component 9).  This is a convenience method that saves you from 
288     * casting and handling an exception.
289     */
290    public IS getXad9_CountyParishCode() {
291       return getTyped(8, IS.class);
292    }
293
294
295    /**
296     * Returns Census Tract (component 10).  This is a convenience method that saves you from 
297     * casting and handling an exception.
298     */
299    public IS getCensusTract() {
300       return getTyped(9, IS.class);
301    }
302
303    
304    /**
305     * Returns Census Tract (component 10).  This is a convenience method that saves you from 
306     * casting and handling an exception.
307     */
308    public IS getXad10_CensusTract() {
309       return getTyped(9, IS.class);
310    }
311
312
313    /**
314     * Returns Address Representation Code (component 11).  This is a convenience method that saves you from 
315     * casting and handling an exception.
316     */
317    public ID getAddressRepresentationCode() {
318       return getTyped(10, ID.class);
319    }
320
321    
322    /**
323     * Returns Address Representation Code (component 11).  This is a convenience method that saves you from 
324     * casting and handling an exception.
325     */
326    public ID getXad11_AddressRepresentationCode() {
327       return getTyped(10, ID.class);
328    }
329
330
331    /**
332     * Returns Address Validity Range (component 12).  This is a convenience method that saves you from 
333     * casting and handling an exception.
334     */
335    public DR getAddressValidityRange() {
336       return getTyped(11, DR.class);
337    }
338
339    
340    /**
341     * Returns Address Validity Range (component 12).  This is a convenience method that saves you from 
342     * casting and handling an exception.
343     */
344    public DR getXad12_AddressValidityRange() {
345       return getTyped(11, DR.class);
346    }
347
348
349    /**
350     * Returns Effective Date (component 13).  This is a convenience method that saves you from 
351     * casting and handling an exception.
352     */
353    public DTM getEffectiveDate() {
354       return getTyped(12, DTM.class);
355    }
356
357    
358    /**
359     * Returns Effective Date (component 13).  This is a convenience method that saves you from 
360     * casting and handling an exception.
361     */
362    public DTM getXad13_EffectiveDate() {
363       return getTyped(12, DTM.class);
364    }
365
366
367    /**
368     * Returns Expiration Date (component 14).  This is a convenience method that saves you from 
369     * casting and handling an exception.
370     */
371    public DTM getExpirationDate() {
372       return getTyped(13, DTM.class);
373    }
374
375    
376    /**
377     * Returns Expiration Date (component 14).  This is a convenience method that saves you from 
378     * casting and handling an exception.
379     */
380    public DTM getXad14_ExpirationDate() {
381       return getTyped(13, DTM.class);
382    }
383
384
385    /**
386     * Returns Expiration Reason (component 15).  This is a convenience method that saves you from 
387     * casting and handling an exception.
388     */
389    public CWE getExpirationReason() {
390       return getTyped(14, CWE.class);
391    }
392
393    
394    /**
395     * Returns Expiration Reason (component 15).  This is a convenience method that saves you from 
396     * casting and handling an exception.
397     */
398    public CWE getXad15_ExpirationReason() {
399       return getTyped(14, CWE.class);
400    }
401
402
403    /**
404     * Returns Temporary Indicator (component 16).  This is a convenience method that saves you from 
405     * casting and handling an exception.
406     */
407    public ID getTemporaryIndicator() {
408       return getTyped(15, ID.class);
409    }
410
411    
412    /**
413     * Returns Temporary Indicator (component 16).  This is a convenience method that saves you from 
414     * casting and handling an exception.
415     */
416    public ID getXad16_TemporaryIndicator() {
417       return getTyped(15, ID.class);
418    }
419
420
421    /**
422     * Returns Bad Address Indicator (component 17).  This is a convenience method that saves you from 
423     * casting and handling an exception.
424     */
425    public ID getBadAddressIndicator() {
426       return getTyped(16, ID.class);
427    }
428
429    
430    /**
431     * Returns Bad Address Indicator (component 17).  This is a convenience method that saves you from 
432     * casting and handling an exception.
433     */
434    public ID getXad17_BadAddressIndicator() {
435       return getTyped(16, ID.class);
436    }
437
438
439    /**
440     * Returns Address Usage (component 18).  This is a convenience method that saves you from 
441     * casting and handling an exception.
442     */
443    public ID getAddressUsage() {
444       return getTyped(17, ID.class);
445    }
446
447    
448    /**
449     * Returns Address Usage (component 18).  This is a convenience method that saves you from 
450     * casting and handling an exception.
451     */
452    public ID getXad18_AddressUsage() {
453       return getTyped(17, ID.class);
454    }
455
456
457    /**
458     * Returns Addressee (component 19).  This is a convenience method that saves you from 
459     * casting and handling an exception.
460     */
461    public ST getAddressee() {
462       return getTyped(18, ST.class);
463    }
464
465    
466    /**
467     * Returns Addressee (component 19).  This is a convenience method that saves you from 
468     * casting and handling an exception.
469     */
470    public ST getXad19_Addressee() {
471       return getTyped(18, ST.class);
472    }
473
474
475    /**
476     * Returns Comment (component 20).  This is a convenience method that saves you from 
477     * casting and handling an exception.
478     */
479    public ST getComment() {
480       return getTyped(19, ST.class);
481    }
482
483    
484    /**
485     * Returns Comment (component 20).  This is a convenience method that saves you from 
486     * casting and handling an exception.
487     */
488    public ST getXad20_Comment() {
489       return getTyped(19, ST.class);
490    }
491
492
493    /**
494     * Returns Preference Order (component 21).  This is a convenience method that saves you from 
495     * casting and handling an exception.
496     */
497    public NM getPreferenceOrder() {
498       return getTyped(20, NM.class);
499    }
500
501    
502    /**
503     * Returns Preference Order (component 21).  This is a convenience method that saves you from 
504     * casting and handling an exception.
505     */
506    public NM getXad21_PreferenceOrder() {
507       return getTyped(20, NM.class);
508    }
509
510
511    /**
512     * Returns Protection Code (component 22).  This is a convenience method that saves you from 
513     * casting and handling an exception.
514     */
515    public CWE getProtectionCode() {
516       return getTyped(21, CWE.class);
517    }
518
519    
520    /**
521     * Returns Protection Code (component 22).  This is a convenience method that saves you from 
522     * casting and handling an exception.
523     */
524    public CWE getXad22_ProtectionCode() {
525       return getTyped(21, CWE.class);
526    }
527
528
529    /**
530     * Returns Address Identifier (component 23).  This is a convenience method that saves you from 
531     * casting and handling an exception.
532     */
533    public EI getAddressIdentifier() {
534       return getTyped(22, EI.class);
535    }
536
537    
538    /**
539     * Returns Address Identifier (component 23).  This is a convenience method that saves you from 
540     * casting and handling an exception.
541     */
542    public EI getXad23_AddressIdentifier() {
543       return getTyped(22, EI.class);
544    }
545
546
547
548}
549