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.v251.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 CX (Extended Composite ID with Check Digit) data type. 
042 * This type consists of the following components:</p>
043 * <ul>
044 * <li>ID Number (ST)
045 * <li>Check Digit (ST)
046 * <li>Check Digit Scheme (ID)
047 * <li>Assigning Authority (HD)
048 * <li>Identifier Type Code (ID)
049 * <li>Assigning Facility (HD)
050 * <li>Effective Date (DT)
051 * <li>Expiration Date (DT)
052 * <li>Assigning Jurisdiction (CWE)
053 * <li>Assigning Agency or Department (CWE)
054 * </ul>
055 */
056@SuppressWarnings("unused")
057public class CX extends AbstractComposite {
058
059    private Type[] data;
060
061    /** 
062     * Creates a new CX type
063     */
064    public CX(Message message) {
065        super(message);
066        init();
067    }
068
069    private void init() {
070        data = new Type[10];    
071        data[0] = new ST(getMessage());
072        data[1] = new ST(getMessage());
073        data[2] = new ID(getMessage(), 61);
074        data[3] = new HD(getMessage());
075        data[4] = new ID(getMessage(), 203);
076        data[5] = new HD(getMessage());
077        data[6] = new DT(getMessage());
078        data[7] = new DT(getMessage());
079        data[8] = new CWE(getMessage());
080        data[9] = new CWE(getMessage());
081    }
082
083
084    /**
085     * Returns an array containing the data elements.
086     */
087    public Type[] getComponents() { 
088        return this.data; 
089    }
090
091    /**
092     * Returns an individual data component.
093     *
094     * @param number The component number (0-indexed)
095     * @throws DataTypeException if the given element number is out of range.
096     */
097    public Type getComponent(int number) throws DataTypeException { 
098
099        try { 
100            return this.data[number]; 
101        } catch (ArrayIndexOutOfBoundsException e) { 
102            throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)"); 
103        } 
104    } 
105
106
107    /**
108     * Returns ID Number (component 1).  This is a convenience method that saves you from 
109     * casting and handling an exception.
110     */
111    public ST getIDNumber() {
112       return getTyped(0, ST.class);
113    }
114
115    
116    /**
117     * Returns ID Number (component 1).  This is a convenience method that saves you from 
118     * casting and handling an exception.
119     */
120    public ST getCx1_IDNumber() {
121       return getTyped(0, ST.class);
122    }
123
124
125    /**
126     * Returns Check Digit (component 2).  This is a convenience method that saves you from 
127     * casting and handling an exception.
128     */
129    public ST getCheckDigit() {
130       return getTyped(1, ST.class);
131    }
132
133    
134    /**
135     * Returns Check Digit (component 2).  This is a convenience method that saves you from 
136     * casting and handling an exception.
137     */
138    public ST getCx2_CheckDigit() {
139       return getTyped(1, ST.class);
140    }
141
142
143    /**
144     * Returns Check Digit Scheme (component 3).  This is a convenience method that saves you from 
145     * casting and handling an exception.
146     */
147    public ID getCheckDigitScheme() {
148       return getTyped(2, ID.class);
149    }
150
151    
152    /**
153     * Returns Check Digit Scheme (component 3).  This is a convenience method that saves you from 
154     * casting and handling an exception.
155     */
156    public ID getCx3_CheckDigitScheme() {
157       return getTyped(2, ID.class);
158    }
159
160
161    /**
162     * Returns Assigning Authority (component 4).  This is a convenience method that saves you from 
163     * casting and handling an exception.
164     */
165    public HD getAssigningAuthority() {
166       return getTyped(3, HD.class);
167    }
168
169    
170    /**
171     * Returns Assigning Authority (component 4).  This is a convenience method that saves you from 
172     * casting and handling an exception.
173     */
174    public HD getCx4_AssigningAuthority() {
175       return getTyped(3, HD.class);
176    }
177
178
179    /**
180     * Returns Identifier Type Code (component 5).  This is a convenience method that saves you from 
181     * casting and handling an exception.
182     */
183    public ID getIdentifierTypeCode() {
184       return getTyped(4, ID.class);
185    }
186
187    
188    /**
189     * Returns Identifier Type Code (component 5).  This is a convenience method that saves you from 
190     * casting and handling an exception.
191     */
192    public ID getCx5_IdentifierTypeCode() {
193       return getTyped(4, ID.class);
194    }
195
196
197    /**
198     * Returns Assigning Facility (component 6).  This is a convenience method that saves you from 
199     * casting and handling an exception.
200     */
201    public HD getAssigningFacility() {
202       return getTyped(5, HD.class);
203    }
204
205    
206    /**
207     * Returns Assigning Facility (component 6).  This is a convenience method that saves you from 
208     * casting and handling an exception.
209     */
210    public HD getCx6_AssigningFacility() {
211       return getTyped(5, HD.class);
212    }
213
214
215    /**
216     * Returns Effective Date (component 7).  This is a convenience method that saves you from 
217     * casting and handling an exception.
218     */
219    public DT getEffectiveDate() {
220       return getTyped(6, DT.class);
221    }
222
223    
224    /**
225     * Returns Effective Date (component 7).  This is a convenience method that saves you from 
226     * casting and handling an exception.
227     */
228    public DT getCx7_EffectiveDate() {
229       return getTyped(6, DT.class);
230    }
231
232
233    /**
234     * Returns Expiration Date (component 8).  This is a convenience method that saves you from 
235     * casting and handling an exception.
236     */
237    public DT getExpirationDate() {
238       return getTyped(7, DT.class);
239    }
240
241    
242    /**
243     * Returns Expiration Date (component 8).  This is a convenience method that saves you from 
244     * casting and handling an exception.
245     */
246    public DT getCx8_ExpirationDate() {
247       return getTyped(7, DT.class);
248    }
249
250
251    /**
252     * Returns Assigning Jurisdiction (component 9).  This is a convenience method that saves you from 
253     * casting and handling an exception.
254     */
255    public CWE getAssigningJurisdiction() {
256       return getTyped(8, CWE.class);
257    }
258
259    
260    /**
261     * Returns Assigning Jurisdiction (component 9).  This is a convenience method that saves you from 
262     * casting and handling an exception.
263     */
264    public CWE getCx9_AssigningJurisdiction() {
265       return getTyped(8, CWE.class);
266    }
267
268
269    /**
270     * Returns Assigning Agency or Department (component 10).  This is a convenience method that saves you from 
271     * casting and handling an exception.
272     */
273    public CWE getAssigningAgencyOrDepartment() {
274       return getTyped(9, CWE.class);
275    }
276
277    
278    /**
279     * Returns Assigning Agency or Department (component 10).  This is a convenience method that saves you from 
280     * casting and handling an exception.
281     */
282    public CWE getCx10_AssigningAgencyOrDepartment() {
283       return getTyped(9, CWE.class);
284    }
285
286
287
288}
289