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 OSD (order sequence) data type. 
019     * This type consists of the following components:</p>
020     * <ul>
021     * <li>sequence/results flag (ID)
022     * <li>placer order number: entity identifier (ST)
023     * <li>placer order number: namespace ID (IS)
024     * <li>filler order number: entity identifier (ST)
025     * <li>filler order number: namespace ID (IS)
026     * <li>sequence condition value (ST)
027     * <li>maximum number of repeats (NM)
028     * <li>placer order number: universal ID (ST)
029     * <li>placer order number; universal ID type (ID)
030     * <li>filler order number: universal ID (ST)
031     * <li>filler order number: universal ID type (ID)
032     * </ul>
033     */
034    public class OSD extends AbstractType implements Composite {
035    
036        private Type[] data;
037    
038        /** 
039         * Creates a new OSD type
040         */
041        public OSD(Message message) {
042            super(message);
043            init();
044        }
045    
046        private void init() {
047            data = new Type[11];    
048            data[0] = new ID(getMessage(), 0);
049            data[1] = new ST(getMessage());
050            data[2] = new IS(getMessage(), 0);
051            data[3] = new ST(getMessage());
052            data[4] = new IS(getMessage(), 0);
053            data[5] = new ST(getMessage());
054            data[6] = new NM(getMessage());
055            data[7] = new ST(getMessage());
056            data[8] = new ID(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 sequence/results flag (component #1).  This is a convenience method that saves you from 
087         * casting and handling an exception.
088         */
089        public ID getSequenceResultsFlag() {
090           ID ret = null;
091           try {
092              ret = (ID)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 sequence/results flag (component #1).  This is a convenience method that saves you from 
103         * casting and handling an exception.
104         */
105        public ID getOsd1_SequenceResultsFlag() {
106           ID ret = null;
107           try {
108              ret = (ID)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 placer order number: entity identifier (component #2).  This is a convenience method that saves you from 
119         * casting and handling an exception.
120         */
121        public ST getPlacerOrderNumberEntityIdentifier() {
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 placer order number: entity identifier (component #2).  This is a convenience method that saves you from 
135         * casting and handling an exception.
136         */
137        public ST getOsd2_PlacerOrderNumberEntityIdentifier() {
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 placer order number: namespace ID (component #3).  This is a convenience method that saves you from 
151         * casting and handling an exception.
152         */
153        public IS getPlacerOrderNumberNamespaceID() {
154           IS ret = null;
155           try {
156              ret = (IS)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 placer order number: namespace ID (component #3).  This is a convenience method that saves you from 
167         * casting and handling an exception.
168         */
169        public IS getOsd3_PlacerOrderNumberNamespaceID() {
170           IS ret = null;
171           try {
172              ret = (IS)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 filler order number: entity identifier (component #4).  This is a convenience method that saves you from 
183         * casting and handling an exception.
184         */
185        public ST getFillerOrderNumberEntityIdentifier() {
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 filler order number: entity identifier (component #4).  This is a convenience method that saves you from 
199         * casting and handling an exception.
200         */
201        public ST getOsd4_FillerOrderNumberEntityIdentifier() {
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 filler order number: namespace ID (component #5).  This is a convenience method that saves you from 
215         * casting and handling an exception.
216         */
217        public IS getFillerOrderNumberNamespaceID() {
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 filler order number: namespace ID (component #5).  This is a convenience method that saves you from 
231         * casting and handling an exception.
232         */
233        public IS getOsd5_FillerOrderNumberNamespaceID() {
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 sequence condition value (component #6).  This is a convenience method that saves you from 
247         * casting and handling an exception.
248         */
249        public ST getSequenceConditionValue() {
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 sequence condition value (component #6).  This is a convenience method that saves you from 
263         * casting and handling an exception.
264         */
265        public ST getOsd6_SequenceConditionValue() {
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 maximum number of repeats (component #7).  This is a convenience method that saves you from 
279         * casting and handling an exception.
280         */
281        public NM getMaximumNumberOfRepeats() {
282           NM ret = null;
283           try {
284              ret = (NM)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 maximum number of repeats (component #7).  This is a convenience method that saves you from 
295         * casting and handling an exception.
296         */
297        public NM getOsd7_MaximumNumberOfRepeats() {
298           NM ret = null;
299           try {
300              ret = (NM)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 placer order number: universal ID (component #8).  This is a convenience method that saves you from 
311         * casting and handling an exception.
312         */
313        public ST getPlacerOrderNumberUniversalID() {
314           ST ret = null;
315           try {
316              ret = (ST)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 placer order number: universal ID (component #8).  This is a convenience method that saves you from 
327         * casting and handling an exception.
328         */
329        public ST getOsd8_PlacerOrderNumberUniversalID() {
330           ST ret = null;
331           try {
332              ret = (ST)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 placer order number; universal ID type (component #9).  This is a convenience method that saves you from 
343         * casting and handling an exception.
344         */
345        public ID getPlacerOrderNumberUniversalIDType() {
346           ID ret = null;
347           try {
348              ret = (ID)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 placer order number; universal ID type (component #9).  This is a convenience method that saves you from 
359         * casting and handling an exception.
360         */
361        public ID getOsd9_PlacerOrderNumberUniversalIDType() {
362           ID ret = null;
363           try {
364              ret = (ID)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 filler order number: universal ID (component #10).  This is a convenience method that saves you from 
375         * casting and handling an exception.
376         */
377        public ST getFillerOrderNumberUniversalID() {
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 filler order number: universal ID (component #10).  This is a convenience method that saves you from 
391         * casting and handling an exception.
392         */
393        public ST getOsd10_FillerOrderNumberUniversalID() {
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 filler order number: universal ID type (component #11).  This is a convenience method that saves you from 
407         * casting and handling an exception.
408         */
409        public ID getFillerOrderNumberUniversalIDType() {
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 filler order number: universal ID type (component #11).  This is a convenience method that saves you from 
423         * casting and handling an exception.
424         */
425        public ID getOsd11_FillerOrderNumberUniversalIDType() {
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