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 NDL (observing practitioner) data type. 
019     * This type consists of the following components:</p>
020     * <ul>
021     * <li>OP name (CNN)
022     * <li>start date/time (TS)
023     * <li>end date/time (TS)
024     * <li>point of care (IS) (IS)
025     * <li>room (IS)
026     * <li>bed (IS)
027     * <li>facility (HD) (HD)
028     * <li>location status (IS)
029     * <li>person location type (IS)
030     * <li>building (IS)
031     * <li>floor (IS)
032     * </ul>
033     */
034    public class NDL extends AbstractType implements Composite {
035    
036        private Type[] data;
037    
038        /** 
039         * Creates a new NDL type
040         */
041        public NDL(Message message) {
042            super(message);
043            init();
044        }
045    
046        private void init() {
047            data = new Type[11];    
048            data[0] = new CNN(getMessage());
049            data[1] = new TS(getMessage());
050            data[2] = new TS(getMessage());
051            data[3] = new IS(getMessage(), 0);
052            data[4] = new IS(getMessage(), 0);
053            data[5] = new IS(getMessage(), 0);
054            data[6] = new HD(getMessage());
055            data[7] = new IS(getMessage(), 0);
056            data[8] = new IS(getMessage(), 0);
057            data[9] = new IS(getMessage(), 0);
058            data[10] = new IS(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 OP name (component #1).  This is a convenience method that saves you from 
087         * casting and handling an exception.
088         */
089        public CNN getOPName() {
090           CNN ret = null;
091           try {
092              ret = (CNN)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 OP name (component #1).  This is a convenience method that saves you from 
103         * casting and handling an exception.
104         */
105        public CNN getNdl1_OPName() {
106           CNN ret = null;
107           try {
108              ret = (CNN)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 start date/time (component #2).  This is a convenience method that saves you from 
119         * casting and handling an exception.
120         */
121        public TS getStartDateTime() {
122           TS ret = null;
123           try {
124              ret = (TS)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 start date/time (component #2).  This is a convenience method that saves you from 
135         * casting and handling an exception.
136         */
137        public TS getNdl2_StartDateTime() {
138           TS ret = null;
139           try {
140              ret = (TS)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 end date/time (component #3).  This is a convenience method that saves you from 
151         * casting and handling an exception.
152         */
153        public TS getEndDateTime() {
154           TS ret = null;
155           try {
156              ret = (TS)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 end date/time (component #3).  This is a convenience method that saves you from 
167         * casting and handling an exception.
168         */
169        public TS getNdl3_EndDateTime() {
170           TS ret = null;
171           try {
172              ret = (TS)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 point of care (IS) (component #4).  This is a convenience method that saves you from 
183         * casting and handling an exception.
184         */
185        public IS getPointOfCare() {
186           IS ret = null;
187           try {
188              ret = (IS)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 point of care (IS) (component #4).  This is a convenience method that saves you from 
199         * casting and handling an exception.
200         */
201        public IS getNdl4_PointOfCare() {
202           IS ret = null;
203           try {
204              ret = (IS)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 room (component #5).  This is a convenience method that saves you from 
215         * casting and handling an exception.
216         */
217        public IS getRoom() {
218           IS ret = null;
219           try {
220              ret = (IS)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 room (component #5).  This is a convenience method that saves you from 
231         * casting and handling an exception.
232         */
233        public IS getNdl5_Room() {
234           IS ret = null;
235           try {
236              ret = (IS)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 bed (component #6).  This is a convenience method that saves you from 
247         * casting and handling an exception.
248         */
249        public IS getBed() {
250           IS ret = null;
251           try {
252              ret = (IS)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 bed (component #6).  This is a convenience method that saves you from 
263         * casting and handling an exception.
264         */
265        public IS getNdl6_Bed() {
266           IS ret = null;
267           try {
268              ret = (IS)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 facility (HD) (component #7).  This is a convenience method that saves you from 
279         * casting and handling an exception.
280         */
281        public HD getFacility() {
282           HD ret = null;
283           try {
284              ret = (HD)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 facility (HD) (component #7).  This is a convenience method that saves you from 
295         * casting and handling an exception.
296         */
297        public HD getNdl7_Facility() {
298           HD ret = null;
299           try {
300              ret = (HD)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 location status (component #8).  This is a convenience method that saves you from 
311         * casting and handling an exception.
312         */
313        public IS getLocationStatus() {
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 location status (component #8).  This is a convenience method that saves you from 
327         * casting and handling an exception.
328         */
329        public IS getNdl8_LocationStatus() {
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 person location type (component #9).  This is a convenience method that saves you from 
343         * casting and handling an exception.
344         */
345        public IS getPersonLocationType() {
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 person location type (component #9).  This is a convenience method that saves you from 
359         * casting and handling an exception.
360         */
361        public IS getNdl9_PersonLocationType() {
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 building (component #10).  This is a convenience method that saves you from 
375         * casting and handling an exception.
376         */
377        public IS getBuilding() {
378           IS ret = null;
379           try {
380              ret = (IS)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 building (component #10).  This is a convenience method that saves you from 
391         * casting and handling an exception.
392         */
393        public IS getNdl10_Building() {
394           IS ret = null;
395           try {
396              ret = (IS)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 floor (component #11).  This is a convenience method that saves you from 
407         * casting and handling an exception.
408         */
409        public IS getFloor() {
410           IS ret = null;
411           try {
412              ret = (IS)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 floor (component #11).  This is a convenience method that saves you from 
423         * casting and handling an exception.
424         */
425        public IS getNdl11_Floor() {
426           IS ret = null;
427           try {
428              ret = (IS)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