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.segment;
009    
010    // import ca.uhn.hl7v2.model.v24.group.*;
011    import ca.uhn.hl7v2.model.v24.datatype.*;
012    import ca.uhn.log.HapiLogFactory;
013    import ca.uhn.hl7v2.HL7Exception;
014    import ca.uhn.hl7v2.parser.ModelClassFactory;
015    import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
016    import ca.uhn.hl7v2.model.AbstractMessage;
017    import ca.uhn.hl7v2.model.Group;
018    import ca.uhn.hl7v2.model.Type;
019    import ca.uhn.hl7v2.model.AbstractSegment;
020    import ca.uhn.hl7v2.model.Varies;
021    
022    /**
023     *<p>Represents an HL7 RQ1 message segment (Requisition Detail-1). 
024     * This segment has the following fields:</p>
025     * <ul>
026         * <li>RQ1-1: Anticipated Price (ST) <b>optional </b>
027         * <li>RQ1-2: Manufacturer Identifier (CE) <b>optional </b>
028         * <li>RQ1-3: Manufacturer's Catalog (ST) <b>optional </b>
029         * <li>RQ1-4: Vendor ID (CE) <b>optional </b>
030         * <li>RQ1-5: Vendor Catalog (ST) <b>optional </b>
031         * <li>RQ1-6: Taxable (ID) <b>optional </b>
032         * <li>RQ1-7: Substitute Allowed (ID) <b>optional </b>
033     * </ul>
034     */
035    public class RQ1 extends AbstractSegment {
036    
037        /** 
038         * Creates a new RQ1 segment
039         */
040        public RQ1(Group parent, ModelClassFactory factory) {
041           super(parent, factory);
042           init(factory);
043        }
044    
045        private void init(ModelClassFactory factory) {
046           try {
047                                      this.add(ST.class, false, 1, 10, new Object[]{ getMessage(), new Integer(0) }, "Anticipated Price");
048                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(385) }, "Manufacturer Identifier");
049                                      this.add(ST.class, false, 1, 16, new Object[]{ getMessage(), new Integer(0) }, "Manufacturer's Catalog");
050                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Vendor ID");
051                                      this.add(ST.class, false, 1, 16, new Object[]{ getMessage(), new Integer(0) }, "Vendor Catalog");
052                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Taxable");
053                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Substitute Allowed");
054           } catch(HL7Exception e) {
055              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating RQ1 - this is probably a bug in the source code generator.", e);
056           }
057        }
058    
059    
060    
061        /**
062         * Returns
063         * RQ1-1: "Anticipated Price" - creates it if necessary
064         */
065        public ST getAnticipatedPrice() { 
066            ST ret = null;
067            try {
068                Type t = this.getField(1, 0);
069                ret = (ST)t;
070            } catch (ClassCastException cce) {
071                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
072                throw new RuntimeException(cce);
073            } catch (HL7Exception he) {
074                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
075                throw new RuntimeException(he);
076            }
077            return ret;
078        }
079    
080    
081        /**
082         * Returns
083         * RQ1-1: "Anticipated Price" - creates it if necessary
084         */
085        public ST getRq11_AnticipatedPrice() { 
086            ST ret = null;
087            try {
088                Type t = this.getField(1, 0);
089                ret = (ST)t;
090            } catch (ClassCastException cce) {
091                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
092                throw new RuntimeException(cce);
093            } catch (HL7Exception he) {
094                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
095                throw new RuntimeException(he);
096            }
097            return ret;
098        }
099    
100    
101    
102        /**
103         * Returns
104         * RQ1-2: "Manufacturer Identifier" - creates it if necessary
105         */
106        public CE getManufacturerIdentifier() { 
107            CE ret = null;
108            try {
109                Type t = this.getField(2, 0);
110                ret = (CE)t;
111            } catch (ClassCastException cce) {
112                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
113                throw new RuntimeException(cce);
114            } catch (HL7Exception he) {
115                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
116                throw new RuntimeException(he);
117            }
118            return ret;
119        }
120    
121    
122        /**
123         * Returns
124         * RQ1-2: "Manufacturer Identifier" - creates it if necessary
125         */
126        public CE getRq12_ManufacturerIdentifier() { 
127            CE ret = null;
128            try {
129                Type t = this.getField(2, 0);
130                ret = (CE)t;
131            } catch (ClassCastException cce) {
132                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
133                throw new RuntimeException(cce);
134            } catch (HL7Exception he) {
135                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
136                throw new RuntimeException(he);
137            }
138            return ret;
139        }
140    
141    
142    
143        /**
144         * Returns
145         * RQ1-3: "Manufacturer's Catalog" - creates it if necessary
146         */
147        public ST getManufacturerSCatalog() { 
148            ST ret = null;
149            try {
150                Type t = this.getField(3, 0);
151                ret = (ST)t;
152            } catch (ClassCastException cce) {
153                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
154                throw new RuntimeException(cce);
155            } catch (HL7Exception he) {
156                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
157                throw new RuntimeException(he);
158            }
159            return ret;
160        }
161    
162    
163        /**
164         * Returns
165         * RQ1-3: "Manufacturer's Catalog" - creates it if necessary
166         */
167        public ST getRq13_ManufacturerSCatalog() { 
168            ST ret = null;
169            try {
170                Type t = this.getField(3, 0);
171                ret = (ST)t;
172            } catch (ClassCastException cce) {
173                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
174                throw new RuntimeException(cce);
175            } catch (HL7Exception he) {
176                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
177                throw new RuntimeException(he);
178            }
179            return ret;
180        }
181    
182    
183    
184        /**
185         * Returns
186         * RQ1-4: "Vendor ID" - creates it if necessary
187         */
188        public CE getVendorID() { 
189            CE ret = null;
190            try {
191                Type t = this.getField(4, 0);
192                ret = (CE)t;
193            } catch (ClassCastException cce) {
194                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
195                throw new RuntimeException(cce);
196            } catch (HL7Exception he) {
197                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
198                throw new RuntimeException(he);
199            }
200            return ret;
201        }
202    
203    
204        /**
205         * Returns
206         * RQ1-4: "Vendor ID" - creates it if necessary
207         */
208        public CE getRq14_VendorID() { 
209            CE ret = null;
210            try {
211                Type t = this.getField(4, 0);
212                ret = (CE)t;
213            } catch (ClassCastException cce) {
214                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
215                throw new RuntimeException(cce);
216            } catch (HL7Exception he) {
217                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
218                throw new RuntimeException(he);
219            }
220            return ret;
221        }
222    
223    
224    
225        /**
226         * Returns
227         * RQ1-5: "Vendor Catalog" - creates it if necessary
228         */
229        public ST getVendorCatalog() { 
230            ST ret = null;
231            try {
232                Type t = this.getField(5, 0);
233                ret = (ST)t;
234            } catch (ClassCastException cce) {
235                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
236                throw new RuntimeException(cce);
237            } catch (HL7Exception he) {
238                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
239                throw new RuntimeException(he);
240            }
241            return ret;
242        }
243    
244    
245        /**
246         * Returns
247         * RQ1-5: "Vendor Catalog" - creates it if necessary
248         */
249        public ST getRq15_VendorCatalog() { 
250            ST ret = null;
251            try {
252                Type t = this.getField(5, 0);
253                ret = (ST)t;
254            } catch (ClassCastException cce) {
255                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
256                throw new RuntimeException(cce);
257            } catch (HL7Exception he) {
258                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
259                throw new RuntimeException(he);
260            }
261            return ret;
262        }
263    
264    
265    
266        /**
267         * Returns
268         * RQ1-6: "Taxable" - creates it if necessary
269         */
270        public ID getTaxable() { 
271            ID ret = null;
272            try {
273                Type t = this.getField(6, 0);
274                ret = (ID)t;
275            } catch (ClassCastException cce) {
276                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
277                throw new RuntimeException(cce);
278            } catch (HL7Exception he) {
279                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
280                throw new RuntimeException(he);
281            }
282            return ret;
283        }
284    
285    
286        /**
287         * Returns
288         * RQ1-6: "Taxable" - creates it if necessary
289         */
290        public ID getRq16_Taxable() { 
291            ID ret = null;
292            try {
293                Type t = this.getField(6, 0);
294                ret = (ID)t;
295            } catch (ClassCastException cce) {
296                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
297                throw new RuntimeException(cce);
298            } catch (HL7Exception he) {
299                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
300                throw new RuntimeException(he);
301            }
302            return ret;
303        }
304    
305    
306    
307        /**
308         * Returns
309         * RQ1-7: "Substitute Allowed" - creates it if necessary
310         */
311        public ID getSubstituteAllowed() { 
312            ID ret = null;
313            try {
314                Type t = this.getField(7, 0);
315                ret = (ID)t;
316            } catch (ClassCastException cce) {
317                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
318                throw new RuntimeException(cce);
319            } catch (HL7Exception he) {
320                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
321                throw new RuntimeException(he);
322            }
323            return ret;
324        }
325    
326    
327        /**
328         * Returns
329         * RQ1-7: "Substitute Allowed" - creates it if necessary
330         */
331        public ID getRq17_SubstituteAllowed() { 
332            ID ret = null;
333            try {
334                Type t = this.getField(7, 0);
335                ret = (ID)t;
336            } catch (ClassCastException cce) {
337                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
338                throw new RuntimeException(cce);
339            } catch (HL7Exception he) {
340                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
341                throw new RuntimeException(he);
342            }
343            return ret;
344        }
345    
346    
347    
348    
349    
350        /** {@inheritDoc} */   
351        protected Type createNewTypeWithoutReflection(int field) {
352           switch (field) {
353              case 0: return new ST(getMessage());
354              case 1: return new CE(getMessage());
355              case 2: return new ST(getMessage());
356              case 3: return new CE(getMessage());
357              case 4: return new ST(getMessage());
358              case 5: return new ID(getMessage(), new Integer( 136 ));
359              case 6: return new ID(getMessage(), new Integer( 136 ));
360              default: return null;
361           }
362       }
363    
364    
365    }
366