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