View Javadoc
1   /*
2    * This class is an auto-generated source file for a HAPI
3    * HL7 v2.x standard structure class.
4    *
5    * For more information, visit: http://hl7api.sourceforge.net/
6    * 
7    * The contents of this file are subject to the Mozilla Public License Version 1.1 
8    * (the "License"); you may not use this file except in compliance with the License. 
9    * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
10   * Software distributed under the License is distributed on an "AS IS" basis, 
11   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
12   * specific language governing rights and limitations under the License. 
13   * 
14   * The Original Code is "[file_name]".  Description: 
15   * "[one_line_description]" 
16   * 
17   * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
18   * 2012.  All Rights Reserved. 
19   * 
20   * Contributor(s): ______________________________________. 
21   * 
22   * Alternatively, the contents of this file may be used under the terms of the 
23   * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
24   * applicable instead of those above.  If you wish to allow use of your version of this 
25   * file only under the terms of the GPL and not to allow others to use your version 
26   * of this file under the MPL, indicate your decision by deleting  the provisions above 
27   * and replace  them with the notice and other provisions required by the GPL License.  
28   * If you do not delete the provisions above, a recipient may use your version of 
29   * this file under either the MPL or the GPL. 
30   * 
31   */
32  
33  
34  package ca.uhn.hl7v2.model.v251.segment;
35  
36  // import ca.uhn.hl7v2.model.v251.group.*;
37  import ca.uhn.hl7v2.model.v251.datatype.*;
38  import ca.uhn.hl7v2.HL7Exception;
39  import ca.uhn.hl7v2.parser.ModelClassFactory;
40  import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
41  import ca.uhn.hl7v2.model.AbstractMessage;
42  import ca.uhn.hl7v2.model.Group;
43  import ca.uhn.hl7v2.model.Type;
44  import ca.uhn.hl7v2.model.AbstractSegment;
45  import ca.uhn.hl7v2.model.Varies;
46  
47  
48  /**
49   *<p>Represents an HL7 RXC message segment (Pharmacy/Treatment Component Order). 
50   * This segment has the following fields:</p>
51   * <ul>
52       * <li>RXC-1: RX Component Type (ID) <b> </b>
53       * <li>RXC-2: Component Code (CE) <b> </b>
54       * <li>RXC-3: Component Amount (NM) <b> </b>
55       * <li>RXC-4: Component Units (CE) <b> </b>
56       * <li>RXC-5: Component Strength (NM) <b>optional </b>
57       * <li>RXC-6: Component Strength Units (CE) <b>optional </b>
58       * <li>RXC-7: Supplementary Code (CE) <b>optional repeating</b>
59       * <li>RXC-8: Component Drug Strength Volume (NM) <b>optional </b>
60       * <li>RXC-9: Component Drug Strength Volume Units (CWE) <b>optional </b>
61   * </ul>
62   */
63  @SuppressWarnings("unused")
64  public class RXC extends AbstractSegment {
65  
66      /** 
67       * Creates a new RXC segment
68       */
69      public RXC(Group parent, ModelClassFactory factory) {
70         super(parent, factory);
71         init(factory);
72      }
73  
74      private void init(ModelClassFactory factory) {
75         try {
76                                                this.add(ID.class, true, 1, 1, new Object[]{ getMessage(), new Integer(166) }, "RX Component Type");
77                                    this.add(CE.class, true, 1, 250, new Object[]{ getMessage() }, "Component Code");
78                                    this.add(NM.class, true, 1, 20, new Object[]{ getMessage() }, "Component Amount");
79                                    this.add(CE.class, true, 1, 250, new Object[]{ getMessage() }, "Component Units");
80                                    this.add(NM.class, false, 1, 20, new Object[]{ getMessage() }, "Component Strength");
81                                    this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Component Strength Units");
82                                    this.add(CE.class, false, 0, 250, new Object[]{ getMessage() }, "Supplementary Code");
83                                    this.add(NM.class, false, 1, 5, new Object[]{ getMessage() }, "Component Drug Strength Volume");
84                                    this.add(CWE.class, false, 1, 250, new Object[]{ getMessage() }, "Component Drug Strength Volume Units");
85         } catch(HL7Exception e) {
86            log.error("Unexpected error creating RXC - this is probably a bug in the source code generator.", e);
87         }
88      }
89  
90  
91  
92      /**
93       * Returns
94       * RXC-1: "RX Component Type" - creates it if necessary
95       */
96      public ID getRXComponentType() { 
97  		ID retVal = this.getTypedField(1, 0);
98  		return retVal;
99      }
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