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