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    
008    package ca.uhn.hl7v2.model.v24.datatype;
009    
010    import ca.uhn.hl7v2.model.Composite;
011    import ca.uhn.hl7v2.model.DataTypeException;
012    import ca.uhn.hl7v2.model.Message;
013    import ca.uhn.hl7v2.model.Type;
014    import ca.uhn.hl7v2.model.AbstractType;
015    import ca.uhn.log.HapiLogFactory;
016    
017    /**
018     * <p>Represents an HL7 CNN (composite ID number and name (special DT for NDL)) data type. 
019     * This type consists of the following components:</p>
020     * <ul>
021     * <li>ID number (ST) (ST)
022     * <li>family name (ST)
023     * <li>given name (ST)
024     * <li>second and further given names or initials thereof (ST)
025     * <li>suffix (e.g., JR or III) (ST)
026     * <li>prefix (e.g., DR) (ST)
027     * <li>degree (e.g., MD) (IS)
028     * <li>source table (IS)
029     * <li>assigning authority namespace ID (IS)
030     * <li>assigning authority universal ID (ST)
031     * <li>assigning authority universal ID type (ID)
032     * </ul>
033     */
034    public class CNN extends AbstractType implements Composite {
035    
036        private Type[] data;
037    
038        /** 
039         * Creates a new CNN type
040         */
041        public CNN(Message message) {
042            super(message);
043            init();
044        }
045    
046        private void init() {
047            data = new Type[11];    
048            data[0] = new ST(getMessage());
049            data[1] = new ST(getMessage());
050            data[2] = new ST(getMessage());
051            data[3] = new ST(getMessage());
052            data[4] = new ST(getMessage());
053            data[5] = new ST(getMessage());
054            data[6] = new IS(getMessage(), 0);
055            data[7] = new IS(getMessage(), 0);
056            data[8] = new IS(getMessage(), 0);
057            data[9] = new ST(getMessage());
058            data[10] = new ID(getMessage(), 0);
059        }
060    
061    
062        /**
063         * Returns an array containing the data elements.
064         */
065        public Type[] getComponents() { 
066            return this.data; 
067        }
068    
069        /**
070         * Returns an individual data component.
071         *
072         * @param number The component number (0-indexed)
073         * @throws DataTypeException if the given element number is out of range.
074         */
075        public Type getComponent(int number) throws DataTypeException { 
076    
077            try { 
078                return this.data[number]; 
079            } catch (ArrayIndexOutOfBoundsException e) { 
080                throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)"); 
081            } 
082        } 
083    
084    
085        /**
086         * Returns ID number (ST) (component #1).  This is a convenience method that saves you from 
087         * casting and handling an exception.
088         */
089        public ST getIDNumber() {
090           ST ret = null;
091           try {
092              ret = (ST)getComponent(0);
093           } catch (DataTypeException e) {
094              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
095              throw new RuntimeException(e);
096           }
097           return ret;
098        }
099    
100        
101        /**
102         * Returns ID number (ST) (component #1).  This is a convenience method that saves you from 
103         * casting and handling an exception.
104         */
105        public ST getCnn1_IDNumber() {
106           ST ret = null;
107           try {
108              ret = (ST)getComponent(0);
109           } catch (DataTypeException e) {
110              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
111              throw new RuntimeException(e);
112           }
113           return ret;
114        }
115    
116    
117        /**
118         * Returns family name (component #2).  This is a convenience method that saves you from 
119         * casting and handling an exception.
120         */
121        public ST getFamilyName() {
122           ST ret = null;
123           try {
124              ret = (ST)getComponent(1);
125           } catch (DataTypeException e) {
126              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
127              throw new RuntimeException(e);
128           }
129           return ret;
130        }
131    
132        
133        /**
134         * Returns family name (component #2).  This is a convenience method that saves you from 
135         * casting and handling an exception.
136         */
137        public ST getCnn2_FamilyName() {
138           ST ret = null;
139           try {
140              ret = (ST)getComponent(1);
141           } catch (DataTypeException e) {
142              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
143              throw new RuntimeException(e);
144           }
145           return ret;
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           ST ret = null;
155           try {
156              ret = (ST)getComponent(2);
157           } catch (DataTypeException e) {
158              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
159              throw new RuntimeException(e);
160           }
161           return ret;
162        }
163    
164        
165        /**
166         * Returns given name (component #3).  This is a convenience method that saves you from 
167         * casting and handling an exception.
168         */
169        public ST getCnn3_GivenName() {
170           ST ret = null;
171           try {
172              ret = (ST)getComponent(2);
173           } catch (DataTypeException e) {
174              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
175              throw new RuntimeException(e);
176           }
177           return ret;
178        }
179    
180    
181        /**
182         * Returns second and further given names or initials thereof (component #4).  This is a convenience method that saves you from 
183         * casting and handling an exception.
184         */
185        public ST getSecondAndFurtherGivenNamesOrInitialsThereof() {
186           ST ret = null;
187           try {
188              ret = (ST)getComponent(3);
189           } catch (DataTypeException e) {
190              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
191              throw new RuntimeException(e);
192           }
193           return ret;
194        }
195    
196        
197        /**
198         * Returns second and further given names or initials thereof (component #4).  This is a convenience method that saves you from 
199         * casting and handling an exception.
200         */
201        public ST getCnn4_SecondAndFurtherGivenNamesOrInitialsThereof() {
202           ST ret = null;
203           try {
204              ret = (ST)getComponent(3);
205           } catch (DataTypeException e) {
206              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
207              throw new RuntimeException(e);
208           }
209           return ret;
210        }
211    
212    
213        /**
214         * Returns suffix (e.g., JR or III) (component #5).  This is a convenience method that saves you from 
215         * casting and handling an exception.
216         */
217        public ST getSuffixEgJRorIII() {
218           ST ret = null;
219           try {
220              ret = (ST)getComponent(4);
221           } catch (DataTypeException e) {
222              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
223              throw new RuntimeException(e);
224           }
225           return ret;
226        }
227    
228        
229        /**
230         * Returns suffix (e.g., JR or III) (component #5).  This is a convenience method that saves you from 
231         * casting and handling an exception.
232         */
233        public ST getCnn5_SuffixEgJRorIII() {
234           ST ret = null;
235           try {
236              ret = (ST)getComponent(4);
237           } catch (DataTypeException e) {
238              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
239              throw new RuntimeException(e);
240           }
241           return ret;
242        }
243    
244    
245        /**
246         * Returns prefix (e.g., DR) (component #6).  This is a convenience method that saves you from 
247         * casting and handling an exception.
248         */
249        public ST getPrefixEgDR() {
250           ST ret = null;
251           try {
252              ret = (ST)getComponent(5);
253           } catch (DataTypeException e) {
254              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
255              throw new RuntimeException(e);
256           }
257           return ret;
258        }
259    
260        
261        /**
262         * Returns prefix (e.g., DR) (component #6).  This is a convenience method that saves you from 
263         * casting and handling an exception.
264         */
265        public ST getCnn6_PrefixEgDR() {
266           ST ret = null;
267           try {
268              ret = (ST)getComponent(5);
269           } catch (DataTypeException e) {
270              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
271              throw new RuntimeException(e);
272           }
273           return ret;
274        }
275    
276    
277        /**
278         * Returns degree (e.g., MD) (component #7).  This is a convenience method that saves you from 
279         * casting and handling an exception.
280         */
281        public IS getDegreeEgMD() {
282           IS ret = null;
283           try {
284              ret = (IS)getComponent(6);
285           } catch (DataTypeException e) {
286              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
287              throw new RuntimeException(e);
288           }
289           return ret;
290        }
291    
292        
293        /**
294         * Returns degree (e.g., MD) (component #7).  This is a convenience method that saves you from 
295         * casting and handling an exception.
296         */
297        public IS getCnn7_DegreeEgMD() {
298           IS ret = null;
299           try {
300              ret = (IS)getComponent(6);
301           } catch (DataTypeException e) {
302              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
303              throw new RuntimeException(e);
304           }
305           return ret;
306        }
307    
308    
309        /**
310         * Returns source table (component #8).  This is a convenience method that saves you from 
311         * casting and handling an exception.
312         */
313        public IS getSourceTable() {
314           IS ret = null;
315           try {
316              ret = (IS)getComponent(7);
317           } catch (DataTypeException e) {
318              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
319              throw new RuntimeException(e);
320           }
321           return ret;
322        }
323    
324        
325        /**
326         * Returns source table (component #8).  This is a convenience method that saves you from 
327         * casting and handling an exception.
328         */
329        public IS getCnn8_SourceTable() {
330           IS ret = null;
331           try {
332              ret = (IS)getComponent(7);
333           } catch (DataTypeException e) {
334              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
335              throw new RuntimeException(e);
336           }
337           return ret;
338        }
339    
340    
341        /**
342         * Returns assigning authority namespace ID (component #9).  This is a convenience method that saves you from 
343         * casting and handling an exception.
344         */
345        public IS getAssigningAuthorityNamespaceID() {
346           IS ret = null;
347           try {
348              ret = (IS)getComponent(8);
349           } catch (DataTypeException e) {
350              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
351              throw new RuntimeException(e);
352           }
353           return ret;
354        }
355    
356        
357        /**
358         * Returns assigning authority namespace ID (component #9).  This is a convenience method that saves you from 
359         * casting and handling an exception.
360         */
361        public IS getCnn9_AssigningAuthorityNamespaceID() {
362           IS ret = null;
363           try {
364              ret = (IS)getComponent(8);
365           } catch (DataTypeException e) {
366              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
367              throw new RuntimeException(e);
368           }
369           return ret;
370        }
371    
372    
373        /**
374         * Returns assigning authority universal ID (component #10).  This is a convenience method that saves you from 
375         * casting and handling an exception.
376         */
377        public ST getAssigningAuthorityUniversalID() {
378           ST ret = null;
379           try {
380              ret = (ST)getComponent(9);
381           } catch (DataTypeException e) {
382              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
383              throw new RuntimeException(e);
384           }
385           return ret;
386        }
387    
388        
389        /**
390         * Returns assigning authority universal ID (component #10).  This is a convenience method that saves you from 
391         * casting and handling an exception.
392         */
393        public ST getCnn10_AssigningAuthorityUniversalID() {
394           ST ret = null;
395           try {
396              ret = (ST)getComponent(9);
397           } catch (DataTypeException e) {
398              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
399              throw new RuntimeException(e);
400           }
401           return ret;
402        }
403    
404    
405        /**
406         * Returns assigning authority universal ID type (component #11).  This is a convenience method that saves you from 
407         * casting and handling an exception.
408         */
409        public ID getAssigningAuthorityUniversalIDType() {
410           ID ret = null;
411           try {
412              ret = (ID)getComponent(10);
413           } catch (DataTypeException e) {
414              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
415              throw new RuntimeException(e);
416           }
417           return ret;
418        }
419    
420        
421        /**
422         * Returns assigning authority universal ID type (component #11).  This is a convenience method that saves you from 
423         * casting and handling an exception.
424         */
425        public ID getCnn11_AssigningAuthorityUniversalIDType() {
426           ID ret = null;
427           try {
428              ret = (ID)getComponent(10);
429           } catch (DataTypeException e) {
430              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
431              throw new RuntimeException(e);
432           }
433           return ret;
434        }
435    
436    
437    
438    }
439