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 "[file_name]".  Description: 
015 * "[one_line_description]" 
016 * 
017 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
018 * 2012.  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
033
034package ca.uhn.hl7v2.model.v28.segment;
035
036// import ca.uhn.hl7v2.model.v28.group.*;
037import ca.uhn.hl7v2.model.v28.datatype.*;
038import ca.uhn.hl7v2.HL7Exception;
039import ca.uhn.hl7v2.parser.ModelClassFactory;
040import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
041import ca.uhn.hl7v2.model.AbstractMessage;
042import ca.uhn.hl7v2.model.Group;
043import ca.uhn.hl7v2.model.Type;
044import ca.uhn.hl7v2.model.AbstractSegment;
045import ca.uhn.hl7v2.model.Varies;
046
047
048/**
049 *<p>Represents an HL7 RXC message segment (Pharmacy/Treatment Component Order). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>RXC-1: RX Component Type (ID) <b> </b>
053     * <li>RXC-2: Component Code (CWE) <b> </b>
054     * <li>RXC-3: Component Amount (NM) <b> </b>
055     * <li>RXC-4: Component Units (CWE) <b> </b>
056     * <li>RXC-5: Component Strength (NM) <b>optional </b>
057     * <li>RXC-6: Component Strength Units (CWE) <b>optional </b>
058     * <li>RXC-7: Supplementary Code (CWE) <b>optional repeating</b>
059     * <li>RXC-8: Component Drug Strength Volume (NM) <b>optional </b>
060     * <li>RXC-9: Component Drug Strength Volume Units (CWE) <b>optional </b>
061     * <li>RXC-10: Dispense Amount (NM) <b>optional </b>
062     * <li>RXC-11: Dispense Units (CWE) <b>optional </b>
063 * </ul>
064 */
065@SuppressWarnings("unused")
066public class RXC extends AbstractSegment {
067
068    /** 
069     * Creates a new RXC segment
070     */
071    public RXC(Group parent, ModelClassFactory factory) {
072       super(parent, factory);
073       init(factory);
074    }
075
076    private void init(ModelClassFactory factory) {
077       try {
078                                              this.add(ID.class, true, 1, 1, new Object[]{ getMessage(), new Integer(166) }, "RX Component Type");
079                                  this.add(CWE.class, true, 1, 0, new Object[]{ getMessage() }, "Component Code");
080                                  this.add(NM.class, true, 1, 0, new Object[]{ getMessage() }, "Component Amount");
081                                  this.add(CWE.class, true, 1, 0, new Object[]{ getMessage() }, "Component Units");
082                                  this.add(NM.class, false, 1, 0, new Object[]{ getMessage() }, "Component Strength");
083                                  this.add(CWE.class, false, 1, 0, new Object[]{ getMessage() }, "Component Strength Units");
084                                  this.add(CWE.class, false, 0, 0, new Object[]{ getMessage() }, "Supplementary Code");
085                                  this.add(NM.class, false, 1, 0, new Object[]{ getMessage() }, "Component Drug Strength Volume");
086                                  this.add(CWE.class, false, 1, 0, new Object[]{ getMessage() }, "Component Drug Strength Volume Units");
087                                  this.add(NM.class, false, 1, 0, new Object[]{ getMessage() }, "Dispense Amount");
088                                  this.add(CWE.class, false, 1, 0, new Object[]{ getMessage() }, "Dispense Units");
089       } catch(HL7Exception e) {
090          log.error("Unexpected error creating RXC - this is probably a bug in the source code generator.", e);
091       }
092    }
093
094
095
096    /**
097     * Returns
098     * RXC-1: "RX Component Type" - creates it if necessary
099     */
100    public ID getRXComponentType() { 
101                ID retVal = this.getTypedField(1, 0);
102                return retVal;
103    }
104    
105    /**
106     * Returns
107     * RXC-1: "RX Component Type" - creates it if necessary
108     */
109    public ID getRxc1_RXComponentType() { 
110                ID retVal = this.getTypedField(1, 0);
111                return retVal;
112    }
113
114
115
116    /**
117     * Returns
118     * RXC-2: "Component Code" - creates it if necessary
119     */
120    public CWE getComponentCode() { 
121                CWE retVal = this.getTypedField(2, 0);
122                return retVal;
123    }
124    
125    /**
126     * Returns
127     * RXC-2: "Component Code" - creates it if necessary
128     */
129    public CWE getRxc2_ComponentCode() { 
130                CWE retVal = this.getTypedField(2, 0);
131                return retVal;
132    }
133
134
135
136    /**
137     * Returns
138     * RXC-3: "Component Amount" - creates it if necessary
139     */
140    public NM getComponentAmount() { 
141                NM retVal = this.getTypedField(3, 0);
142                return retVal;
143    }
144    
145    /**
146     * Returns
147     * RXC-3: "Component Amount" - creates it if necessary
148     */
149    public NM getRxc3_ComponentAmount() { 
150                NM retVal = this.getTypedField(3, 0);
151                return retVal;
152    }
153
154
155
156    /**
157     * Returns
158     * RXC-4: "Component Units" - creates it if necessary
159     */
160    public CWE getComponentUnits() { 
161                CWE retVal = this.getTypedField(4, 0);
162                return retVal;
163    }
164    
165    /**
166     * Returns
167     * RXC-4: "Component Units" - creates it if necessary
168     */
169    public CWE getRxc4_ComponentUnits() { 
170                CWE retVal = this.getTypedField(4, 0);
171                return retVal;
172    }
173
174
175
176    /**
177     * Returns
178     * RXC-5: "Component Strength" - creates it if necessary
179     */
180    public NM getComponentStrength() { 
181                NM retVal = this.getTypedField(5, 0);
182                return retVal;
183    }
184    
185    /**
186     * Returns
187     * RXC-5: "Component Strength" - creates it if necessary
188     */
189    public NM getRxc5_ComponentStrength() { 
190                NM retVal = this.getTypedField(5, 0);
191                return retVal;
192    }
193
194
195
196    /**
197     * Returns
198     * RXC-6: "Component Strength Units" - creates it if necessary
199     */
200    public CWE getComponentStrengthUnits() { 
201                CWE retVal = this.getTypedField(6, 0);
202                return retVal;
203    }
204    
205    /**
206     * Returns
207     * RXC-6: "Component Strength Units" - creates it if necessary
208     */
209    public CWE getRxc6_ComponentStrengthUnits() { 
210                CWE retVal = this.getTypedField(6, 0);
211                return retVal;
212    }
213
214
215    /**
216     * Returns all repetitions of Supplementary Code (RXC-7).
217     */
218    public CWE[] getSupplementaryCode() {
219        CWE[] retVal = this.getTypedField(7, new CWE[0]);
220        return retVal;
221    }
222
223
224    /**
225     * Returns all repetitions of Supplementary Code (RXC-7).
226     */
227    public CWE[] getRxc7_SupplementaryCode() {
228        CWE[] retVal = this.getTypedField(7, new CWE[0]);
229        return retVal;
230    }
231
232
233    /**
234     * Returns a count of the current number of repetitions of Supplementary Code (RXC-7).
235     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
236     * it will return zero.
237     */
238    public int getSupplementaryCodeReps() {
239        return this.getReps(7);
240    }
241
242
243    /**
244     * Returns a specific repetition of
245     * RXC-7: "Supplementary Code" - creates it if necessary
246     *
247     * @param rep The repetition index (0-indexed)
248     */
249    public CWE getSupplementaryCode(int rep) { 
250                CWE retVal = this.getTypedField(7, rep);
251                return retVal;
252    }
253
254    /**
255     * Returns a specific repetition of
256     * RXC-7: "Supplementary Code" - creates it if necessary
257     *
258     * @param rep The repetition index (0-indexed)
259     */
260    public CWE getRxc7_SupplementaryCode(int rep) { 
261                CWE retVal = this.getTypedField(7, rep);
262                return retVal;
263    }
264
265    /**
266     * Returns a count of the current number of repetitions of Supplementary Code (RXC-7).
267     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
268     * it will return zero.
269     */
270    public int getRxc7_SupplementaryCodeReps() {
271        return this.getReps(7);
272    }
273
274
275    /**
276     * Inserts a repetition of
277     * RXC-7: "Supplementary Code" at a specific index
278     *
279     * @param rep The repetition index (0-indexed)
280     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
281     */
282    public CWE insertSupplementaryCode(int rep) throws HL7Exception { 
283        return (CWE) super.insertRepetition(7, rep);
284    }
285
286
287    /**
288     * Inserts a repetition of
289     * RXC-7: "Supplementary Code" at a specific index
290     *
291     * @param rep The repetition index (0-indexed)
292     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
293     */
294    public CWE insertRxc7_SupplementaryCode(int rep) throws HL7Exception { 
295        return (CWE) super.insertRepetition(7, rep);
296    }
297
298
299    /**
300     * Removes a repetition of
301     * RXC-7: "Supplementary Code" at a specific index
302     *
303     * @param rep The repetition index (0-indexed)
304     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
305     */
306    public CWE removeSupplementaryCode(int rep) throws HL7Exception { 
307        return (CWE) super.removeRepetition(7, rep);
308    }
309
310
311    /**
312     * Removes a repetition of
313     * RXC-7: "Supplementary Code" at a specific index
314     *
315     * @param rep The repetition index (0-indexed)
316     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
317     */
318    public CWE removeRxc7_SupplementaryCode(int rep) throws HL7Exception { 
319        return (CWE) super.removeRepetition(7, rep);
320    }
321
322
323
324
325    /**
326     * Returns
327     * RXC-8: "Component Drug Strength Volume" - creates it if necessary
328     */
329    public NM getComponentDrugStrengthVolume() { 
330                NM retVal = this.getTypedField(8, 0);
331                return retVal;
332    }
333    
334    /**
335     * Returns
336     * RXC-8: "Component Drug Strength Volume" - creates it if necessary
337     */
338    public NM getRxc8_ComponentDrugStrengthVolume() { 
339                NM retVal = this.getTypedField(8, 0);
340                return retVal;
341    }
342
343
344
345    /**
346     * Returns
347     * RXC-9: "Component Drug Strength Volume Units" - creates it if necessary
348     */
349    public CWE getComponentDrugStrengthVolumeUnits() { 
350                CWE retVal = this.getTypedField(9, 0);
351                return retVal;
352    }
353    
354    /**
355     * Returns
356     * RXC-9: "Component Drug Strength Volume Units" - creates it if necessary
357     */
358    public CWE getRxc9_ComponentDrugStrengthVolumeUnits() { 
359                CWE retVal = this.getTypedField(9, 0);
360                return retVal;
361    }
362
363
364
365    /**
366     * Returns
367     * RXC-10: "Dispense Amount" - creates it if necessary
368     */
369    public NM getDispenseAmount() { 
370                NM retVal = this.getTypedField(10, 0);
371                return retVal;
372    }
373    
374    /**
375     * Returns
376     * RXC-10: "Dispense Amount" - creates it if necessary
377     */
378    public NM getRxc10_DispenseAmount() { 
379                NM retVal = this.getTypedField(10, 0);
380                return retVal;
381    }
382
383
384
385    /**
386     * Returns
387     * RXC-11: "Dispense Units" - creates it if necessary
388     */
389    public CWE getDispenseUnits() { 
390                CWE retVal = this.getTypedField(11, 0);
391                return retVal;
392    }
393    
394    /**
395     * Returns
396     * RXC-11: "Dispense Units" - creates it if necessary
397     */
398    public CWE getRxc11_DispenseUnits() { 
399                CWE retVal = this.getTypedField(11, 0);
400                return retVal;
401    }
402
403
404
405
406
407    /** {@inheritDoc} */   
408    protected Type createNewTypeWithoutReflection(int field) {
409       switch (field) {
410          case 0: return new ID(getMessage(), new Integer( 166 ));
411          case 1: return new CWE(getMessage());
412          case 2: return new NM(getMessage());
413          case 3: return new CWE(getMessage());
414          case 4: return new NM(getMessage());
415          case 5: return new CWE(getMessage());
416          case 6: return new CWE(getMessage());
417          case 7: return new NM(getMessage());
418          case 8: return new CWE(getMessage());
419          case 9: return new NM(getMessage());
420          case 10: return new CWE(getMessage());
421          default: return null;
422       }
423   }
424
425
426}
427