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 "CN_PERSON.java".  Description:
015 * "Composite class CN_PERSON"
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.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/**
042 * <p>Represents an HL7 CN_PERSON (CN für Personen) data type. 
043 * This type consists of the following components:</p>
044 * <ul>
045 * <li>ID number (ID)
046 * <li>family name (ST)
047 * <li>given name (ST)
048 * <li>middle initial or name (ST)
049 * <li>suffix (e.g. JR or III) (ST)
050 * <li>prefix (e.g. DR) (ST)
051 * <li>degree (e.g. MD) (ST)
052 * <li>source table id (ID)
053 * </ul>
054 */
055@SuppressWarnings("unused")
056public class CN_PERSON extends AbstractComposite {
057
058    private Type[] data;
059
060    /** 
061     * Creates a new CN_PERSON type
062     */
063    public CN_PERSON(Message message) {
064        super(message);
065        init();
066    }
067
068    private void init() {
069        data = new Type[8];    
070        data[0] = new ID(getMessage(), 0);
071        data[1] = new ST(getMessage());
072        data[2] = new ST(getMessage());
073        data[3] = new ST(getMessage());
074        data[4] = new ST(getMessage());
075        data[5] = new ST(getMessage());
076        data[6] = new ST(getMessage());
077        data[7] = new ID(getMessage(), 0);
078    }
079
080
081    /**
082     * Returns an array containing the data elements.
083     */
084    public Type[] getComponents() { 
085        return this.data; 
086    }
087
088    /**
089     * Returns an individual data component.
090     *
091     * @param number The component number (0-indexed)
092     * @throws DataTypeException if the given element number is out of range.
093     */
094    public Type getComponent(int number) throws DataTypeException { 
095
096        try { 
097            return this.data[number]; 
098        } catch (ArrayIndexOutOfBoundsException e) { 
099            throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)"); 
100        } 
101    } 
102
103
104    /**
105     * Returns ID number (component 1).  This is a convenience method that saves you from 
106     * casting and handling an exception.
107     */
108    public ID getIDNumber() {
109       return getTyped(0, ID.class);
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 getCn_person1_IDNumber() {
118       return getTyped(0, ID.class);
119    }
120
121
122    /**
123     * Returns family name (component 2).  This is a convenience method that saves you from 
124     * casting and handling an exception.
125     */
126    public ST getFamilyName() {
127       return getTyped(1, ST.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 getCn_person2_FamilyName() {
136       return getTyped(1, ST.class);
137    }
138
139
140    /**
141     * Returns given name (component 3).  This is a convenience method that saves you from 
142     * casting and handling an exception.
143     */
144    public ST getGivenName() {
145       return getTyped(2, 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 getCn_person3_GivenName() {
154       return getTyped(2, ST.class);
155    }
156
157
158    /**
159     * Returns middle initial or name (component 4).  This is a convenience method that saves you from 
160     * casting and handling an exception.
161     */
162    public ST getMiddleInitialOrName() {
163       return getTyped(3, 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 getCn_person4_MiddleInitialOrName() {
172       return getTyped(3, ST.class);
173    }
174
175
176    /**
177     * Returns suffix (e.g. JR or III) (component 5).  This is a convenience method that saves you from 
178     * casting and handling an exception.
179     */
180    public ST getSuffixEgJRorIII() {
181       return getTyped(4, 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 getCn_person5_SuffixEgJRorIII() {
190       return getTyped(4, ST.class);
191    }
192
193
194    /**
195     * Returns prefix (e.g. DR) (component 6).  This is a convenience method that saves you from 
196     * casting and handling an exception.
197     */
198    public ST getPrefixEgDR() {
199       return getTyped(5, 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 getCn_person6_PrefixEgDR() {
208       return getTyped(5, ST.class);
209    }
210
211
212    /**
213     * Returns degree (e.g. MD) (component 7).  This is a convenience method that saves you from 
214     * casting and handling an exception.
215     */
216    public ST getDegreeEgMD() {
217       return getTyped(6, 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 getCn_person7_DegreeEgMD() {
226       return getTyped(6, ST.class);
227    }
228
229
230    /**
231     * Returns source table id (component 8).  This is a convenience method that saves you from 
232     * casting and handling an exception.
233     */
234    public ID getSourceTableId() {
235       return getTyped(7, ID.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 getCn_person8_SourceTableId() {
244       return getTyped(7, ID.class);
245    }
246
247
248
249}
250