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