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.v22.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 CN (CN für Ärzte) data type. 
042 * This type consists of the following components:</p>
043 * <ul>
044 * <li>ID number (ID)
045 * <li>family name (ST)
046 * <li>given name (ST)
047 * <li>middle initial or name (ST)
048 * <li>suffix (e.g. JR or III) (ST)
049 * <li>prefix (e.g. DR) (ST)
050 * <li>degree (e.g. MD) (ST)
051 * <li>source table id (ID)
052 * <li>Adresse (AD)
053 * <li>Telefon (TN)
054 * <li>Faxnummer (TN)
055 * <li>Online-Nummer (TN)
056 * <li>E-Mail (ST)
057 * </ul>
058 */
059@SuppressWarnings("unused")
060public class CN extends AbstractComposite {
061
062    private Type[] data;
063
064    /** 
065     * Creates a new CN type
066     */
067    public CN(Message message) {
068        super(message);
069        init();
070    }
071
072    private void init() {
073        data = new Type[13];    
074        data[0] = new ID(getMessage(), 0);
075        data[1] = new ST(getMessage());
076        data[2] = new ST(getMessage());
077        data[3] = new ST(getMessage());
078        data[4] = new ST(getMessage());
079        data[5] = new ST(getMessage());
080        data[6] = new ST(getMessage());
081        data[7] = new ID(getMessage(), 0);
082        data[8] = new AD(getMessage());
083        data[9] = new TN(getMessage());
084        data[10] = new TN(getMessage());
085        data[11] = new TN(getMessage());
086        data[12] = new ST(getMessage());
087    }
088
089
090    /**
091     * Returns an array containing the data elements.
092     */
093    public Type[] getComponents() { 
094        return this.data; 
095    }
096
097    /**
098     * Returns an individual data component.
099     *
100     * @param number The component number (0-indexed)
101     * @throws DataTypeException if the given element number is out of range.
102     */
103    public Type getComponent(int number) throws DataTypeException { 
104
105        try { 
106            return this.data[number]; 
107        } catch (ArrayIndexOutOfBoundsException e) { 
108            throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)"); 
109        } 
110    } 
111
112
113    /**
114     * Returns ID number (component 1).  This is a convenience method that saves you from 
115     * casting and handling an exception.
116     */
117    public ID getIDNumber() {
118       return getTyped(0, ID.class);
119    }
120
121    
122    /**
123     * Returns ID number (component 1).  This is a convenience method that saves you from 
124     * casting and handling an exception.
125     */
126    public ID getCn1_IDNumber() {
127       return getTyped(0, ID.class);
128    }
129
130
131    /**
132     * Returns family name (component 2).  This is a convenience method that saves you from 
133     * casting and handling an exception.
134     */
135    public ST getFamilyName() {
136       return getTyped(1, ST.class);
137    }
138
139    
140    /**
141     * Returns family name (component 2).  This is a convenience method that saves you from 
142     * casting and handling an exception.
143     */
144    public ST getCn2_FamilyName() {
145       return getTyped(1, ST.class);
146    }
147
148
149    /**
150     * Returns given name (component 3).  This is a convenience method that saves you from 
151     * casting and handling an exception.
152     */
153    public ST getGivenName() {
154       return getTyped(2, ST.class);
155    }
156
157    
158    /**
159     * Returns given name (component 3).  This is a convenience method that saves you from 
160     * casting and handling an exception.
161     */
162    public ST getCn3_GivenName() {
163       return getTyped(2, ST.class);
164    }
165
166
167    /**
168     * Returns middle initial or name (component 4).  This is a convenience method that saves you from 
169     * casting and handling an exception.
170     */
171    public ST getMiddleInitialOrName() {
172       return getTyped(3, ST.class);
173    }
174
175    
176    /**
177     * Returns middle initial or name (component 4).  This is a convenience method that saves you from 
178     * casting and handling an exception.
179     */
180    public ST getCn4_MiddleInitialOrName() {
181       return getTyped(3, ST.class);
182    }
183
184
185    /**
186     * Returns suffix (e.g. JR or III) (component 5).  This is a convenience method that saves you from 
187     * casting and handling an exception.
188     */
189    public ST getSuffixEgJRorIII() {
190       return getTyped(4, ST.class);
191    }
192
193    
194    /**
195     * Returns suffix (e.g. JR or III) (component 5).  This is a convenience method that saves you from 
196     * casting and handling an exception.
197     */
198    public ST getCn5_SuffixEgJRorIII() {
199       return getTyped(4, ST.class);
200    }
201
202
203    /**
204     * Returns prefix (e.g. DR) (component 6).  This is a convenience method that saves you from 
205     * casting and handling an exception.
206     */
207    public ST getPrefixEgDR() {
208       return getTyped(5, ST.class);
209    }
210
211    
212    /**
213     * Returns prefix (e.g. DR) (component 6).  This is a convenience method that saves you from 
214     * casting and handling an exception.
215     */
216    public ST getCn6_PrefixEgDR() {
217       return getTyped(5, ST.class);
218    }
219
220
221    /**
222     * Returns degree (e.g. MD) (component 7).  This is a convenience method that saves you from 
223     * casting and handling an exception.
224     */
225    public ST getDegreeEgMD() {
226       return getTyped(6, ST.class);
227    }
228
229    
230    /**
231     * Returns degree (e.g. MD) (component 7).  This is a convenience method that saves you from 
232     * casting and handling an exception.
233     */
234    public ST getCn7_DegreeEgMD() {
235       return getTyped(6, ST.class);
236    }
237
238
239    /**
240     * Returns source table id (component 8).  This is a convenience method that saves you from 
241     * casting and handling an exception.
242     */
243    public ID getSourceTableId() {
244       return getTyped(7, ID.class);
245    }
246
247    
248    /**
249     * Returns source table id (component 8).  This is a convenience method that saves you from 
250     * casting and handling an exception.
251     */
252    public ID getCn8_SourceTableId() {
253       return getTyped(7, ID.class);
254    }
255
256
257    /**
258     * Returns Adresse (component 9).  This is a convenience method that saves you from 
259     * casting and handling an exception.
260     */
261    public AD getAdresse() {
262       return getTyped(8, AD.class);
263    }
264
265    
266    /**
267     * Returns Adresse (component 9).  This is a convenience method that saves you from 
268     * casting and handling an exception.
269     */
270    public AD getCn9_Adresse() {
271       return getTyped(8, AD.class);
272    }
273
274
275    /**
276     * Returns Telefon (component 10).  This is a convenience method that saves you from 
277     * casting and handling an exception.
278     */
279    public TN getTelefon() {
280       return getTyped(9, TN.class);
281    }
282
283    
284    /**
285     * Returns Telefon (component 10).  This is a convenience method that saves you from 
286     * casting and handling an exception.
287     */
288    public TN getCn10_Telefon() {
289       return getTyped(9, TN.class);
290    }
291
292
293    /**
294     * Returns Faxnummer (component 11).  This is a convenience method that saves you from 
295     * casting and handling an exception.
296     */
297    public TN getFaxnummer() {
298       return getTyped(10, TN.class);
299    }
300
301    
302    /**
303     * Returns Faxnummer (component 11).  This is a convenience method that saves you from 
304     * casting and handling an exception.
305     */
306    public TN getCn11_Faxnummer() {
307       return getTyped(10, TN.class);
308    }
309
310
311    /**
312     * Returns Online-Nummer (component 12).  This is a convenience method that saves you from 
313     * casting and handling an exception.
314     */
315    public TN getOnlineNummer() {
316       return getTyped(11, TN.class);
317    }
318
319    
320    /**
321     * Returns Online-Nummer (component 12).  This is a convenience method that saves you from 
322     * casting and handling an exception.
323     */
324    public TN getCn12_OnlineNummer() {
325       return getTyped(11, TN.class);
326    }
327
328
329    /**
330     * Returns E-Mail (component 13).  This is a convenience method that saves you from 
331     * casting and handling an exception.
332     */
333    public ST getEMail() {
334       return getTyped(12, ST.class);
335    }
336
337    
338    /**
339     * Returns E-Mail (component 13).  This is a convenience method that saves you from 
340     * casting and handling an exception.
341     */
342    public ST getCn13_EMail() {
343       return getTyped(12, ST.class);
344    }
345
346
347
348}
349