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.v22.segment; 035 036// import ca.uhn.hl7v2.model.v22.group.*; 037import ca.uhn.hl7v2.model.v22.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 ODT message segment (DIET TRAY INSTRUCTION). 049 * This segment has the following fields:</p> 050 * <ul> 051 * <li>ODT-1: Tray Type (CE) <b> </b> 052 * <li>ODT-2: Service Period (CE) <b>optional repeating</b> 053 * <li>ODT-3: Text Instruction (ST) <b>optional repeating</b> 054 * </ul> 055 */ 056@SuppressWarnings("unused") 057public class ODT extends AbstractSegment { 058 059 /** 060 * Creates a new ODT segment 061 */ 062 public ODT(Group parent, ModelClassFactory factory) { 063 super(parent, factory); 064 init(factory); 065 } 066 067 private void init(ModelClassFactory factory) { 068 try { 069 this.add(CE.class, true, 1, 60, new Object[]{ getMessage() }, "Tray Type"); 070 this.add(CE.class, false, 10, 60, new Object[]{ getMessage() }, "Service Period"); 071 this.add(ST.class, false, 2, 80, new Object[]{ getMessage() }, "Text Instruction"); 072 } catch(HL7Exception e) { 073 log.error("Unexpected error creating ODT - this is probably a bug in the source code generator.", e); 074 } 075 } 076 077 078 079 /** 080 * Returns 081 * ODT-1: "Tray Type" - creates it if necessary 082 */ 083 public CE getTrayType() { 084 CE retVal = this.getTypedField(1, 0); 085 return retVal; 086 } 087 088 /** 089 * Returns 090 * ODT-1: "Tray Type" - creates it if necessary 091 */ 092 public CE getOdt1_TrayType() { 093 CE retVal = this.getTypedField(1, 0); 094 return retVal; 095 } 096 097 098 /** 099 * Returns all repetitions of Service Period (ODT-2). 100 */ 101 public CE[] getServicePeriod() { 102 CE[] retVal = this.getTypedField(2, new CE[0]); 103 return retVal; 104 } 105 106 107 /** 108 * Returns all repetitions of Service Period (ODT-2). 109 */ 110 public CE[] getOdt2_ServicePeriod() { 111 CE[] retVal = this.getTypedField(2, new CE[0]); 112 return retVal; 113 } 114 115 116 /** 117 * Returns a count of the current number of repetitions of Service Period (ODT-2). 118 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 119 * it will return zero. 120 */ 121 public int getServicePeriodReps() { 122 return this.getReps(2); 123 } 124 125 126 /** 127 * Returns a specific repetition of 128 * ODT-2: "Service Period" - creates it if necessary 129 * 130 * @param rep The repetition index (0-indexed) 131 */ 132 public CE getServicePeriod(int rep) { 133 CE retVal = this.getTypedField(2, rep); 134 return retVal; 135 } 136 137 /** 138 * Returns a specific repetition of 139 * ODT-2: "Service Period" - creates it if necessary 140 * 141 * @param rep The repetition index (0-indexed) 142 */ 143 public CE getOdt2_ServicePeriod(int rep) { 144 CE retVal = this.getTypedField(2, rep); 145 return retVal; 146 } 147 148 /** 149 * Returns a count of the current number of repetitions of Service Period (ODT-2). 150 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 151 * it will return zero. 152 */ 153 public int getOdt2_ServicePeriodReps() { 154 return this.getReps(2); 155 } 156 157 158 /** 159 * Inserts a repetition of 160 * ODT-2: "Service Period" at a specific index 161 * 162 * @param rep The repetition index (0-indexed) 163 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 164 */ 165 public CE insertServicePeriod(int rep) throws HL7Exception { 166 return (CE) super.insertRepetition(2, rep); 167 } 168 169 170 /** 171 * Inserts a repetition of 172 * ODT-2: "Service Period" at a specific index 173 * 174 * @param rep The repetition index (0-indexed) 175 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 176 */ 177 public CE insertOdt2_ServicePeriod(int rep) throws HL7Exception { 178 return (CE) super.insertRepetition(2, rep); 179 } 180 181 182 /** 183 * Removes a repetition of 184 * ODT-2: "Service Period" at a specific index 185 * 186 * @param rep The repetition index (0-indexed) 187 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 188 */ 189 public CE removeServicePeriod(int rep) throws HL7Exception { 190 return (CE) super.removeRepetition(2, rep); 191 } 192 193 194 /** 195 * Removes a repetition of 196 * ODT-2: "Service Period" at a specific index 197 * 198 * @param rep The repetition index (0-indexed) 199 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 200 */ 201 public CE removeOdt2_ServicePeriod(int rep) throws HL7Exception { 202 return (CE) super.removeRepetition(2, rep); 203 } 204 205 206 207 /** 208 * Returns all repetitions of Text Instruction (ODT-3). 209 */ 210 public ST[] getTextInstruction() { 211 ST[] retVal = this.getTypedField(3, new ST[0]); 212 return retVal; 213 } 214 215 216 /** 217 * Returns all repetitions of Text Instruction (ODT-3). 218 */ 219 public ST[] getOdt3_TextInstruction() { 220 ST[] retVal = this.getTypedField(3, new ST[0]); 221 return retVal; 222 } 223 224 225 /** 226 * Returns a count of the current number of repetitions of Text Instruction (ODT-3). 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 getTextInstructionReps() { 231 return this.getReps(3); 232 } 233 234 235 /** 236 * Returns a specific repetition of 237 * ODT-3: "Text Instruction" - creates it if necessary 238 * 239 * @param rep The repetition index (0-indexed) 240 */ 241 public ST getTextInstruction(int rep) { 242 ST retVal = this.getTypedField(3, rep); 243 return retVal; 244 } 245 246 /** 247 * Returns a specific repetition of 248 * ODT-3: "Text Instruction" - creates it if necessary 249 * 250 * @param rep The repetition index (0-indexed) 251 */ 252 public ST getOdt3_TextInstruction(int rep) { 253 ST retVal = this.getTypedField(3, rep); 254 return retVal; 255 } 256 257 /** 258 * Returns a count of the current number of repetitions of Text Instruction (ODT-3). 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 getOdt3_TextInstructionReps() { 263 return this.getReps(3); 264 } 265 266 267 /** 268 * Inserts a repetition of 269 * ODT-3: "Text Instruction" 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 ST insertTextInstruction(int rep) throws HL7Exception { 275 return (ST) super.insertRepetition(3, rep); 276 } 277 278 279 /** 280 * Inserts a repetition of 281 * ODT-3: "Text Instruction" 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 ST insertOdt3_TextInstruction(int rep) throws HL7Exception { 287 return (ST) super.insertRepetition(3, rep); 288 } 289 290 291 /** 292 * Removes a repetition of 293 * ODT-3: "Text Instruction" 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 ST removeTextInstruction(int rep) throws HL7Exception { 299 return (ST) super.removeRepetition(3, rep); 300 } 301 302 303 /** 304 * Removes a repetition of 305 * ODT-3: "Text Instruction" 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 ST removeOdt3_TextInstruction(int rep) throws HL7Exception { 311 return (ST) super.removeRepetition(3, rep); 312 } 313 314 315 316 317 318 319 /** {@inheritDoc} */ 320 protected Type createNewTypeWithoutReflection(int field) { 321 switch (field) { 322 case 0: return new CE(getMessage()); 323 case 1: return new CE(getMessage()); 324 case 2: return new ST(getMessage()); 325 default: return null; 326 } 327 } 328 329 330} 331