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