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