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.v27.segment; 035 036// import ca.uhn.hl7v2.model.v27.group.*; 037import ca.uhn.hl7v2.model.v27.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 MFI message segment (Master File Identification). 050 * This segment has the following fields:</p> 051 * <ul> 052 * <li>MFI-1: Master File Identifier (CWE) <b> </b> 053 * <li>MFI-2: Master File Application Identifier (HD) <b>optional repeating</b> 054 * <li>MFI-3: File-Level Event Code (ID) <b> </b> 055 * <li>MFI-4: Entered Date/Time (DTM) <b>optional </b> 056 * <li>MFI-5: Effective Date/Time (DTM) <b>optional </b> 057 * <li>MFI-6: Response Level Code (ID) <b> </b> 058 * </ul> 059 */ 060@SuppressWarnings("unused") 061public class MFI extends AbstractSegment { 062 063 /** 064 * Creates a new MFI segment 065 */ 066 public MFI(Group parent, ModelClassFactory factory) { 067 super(parent, factory); 068 init(factory); 069 } 070 071 private void init(ModelClassFactory factory) { 072 try { 073 this.add(CWE.class, true, 1, 0, new Object[]{ getMessage() }, "Master File Identifier"); 074 this.add(HD.class, false, 0, 0, new Object[]{ getMessage() }, "Master File Application Identifier"); 075 this.add(ID.class, true, 1, 3, new Object[]{ getMessage(), new Integer(178) }, "File-Level Event Code"); 076 this.add(DTM.class, false, 1, 0, new Object[]{ getMessage() }, "Entered Date/Time"); 077 this.add(DTM.class, false, 1, 0, new Object[]{ getMessage() }, "Effective Date/Time"); 078 this.add(ID.class, true, 1, 2, new Object[]{ getMessage(), new Integer(179) }, "Response Level Code"); 079 } catch(HL7Exception e) { 080 log.error("Unexpected error creating MFI - this is probably a bug in the source code generator.", e); 081 } 082 } 083 084 085 086 /** 087 * Returns 088 * MFI-1: "Master File Identifier" - creates it if necessary 089 */ 090 public CWE getMasterFileIdentifier() { 091 CWE retVal = this.getTypedField(1, 0); 092 return retVal; 093 } 094 095 /** 096 * Returns 097 * MFI-1: "Master File Identifier" - creates it if necessary 098 */ 099 public CWE getMfi1_MasterFileIdentifier() { 100 CWE retVal = this.getTypedField(1, 0); 101 return retVal; 102 } 103 104 105 /** 106 * Returns all repetitions of Master File Application Identifier (MFI-2). 107 */ 108 public HD[] getMasterFileApplicationIdentifier() { 109 HD[] retVal = this.getTypedField(2, new HD[0]); 110 return retVal; 111 } 112 113 114 /** 115 * Returns all repetitions of Master File Application Identifier (MFI-2). 116 */ 117 public HD[] getMfi2_MasterFileApplicationIdentifier() { 118 HD[] retVal = this.getTypedField(2, new HD[0]); 119 return retVal; 120 } 121 122 123 /** 124 * Returns a count of the current number of repetitions of Master File Application Identifier (MFI-2). 125 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 126 * it will return zero. 127 */ 128 public int getMasterFileApplicationIdentifierReps() { 129 return this.getReps(2); 130 } 131 132 133 /** 134 * Returns a specific repetition of 135 * MFI-2: "Master File Application Identifier" - creates it if necessary 136 * 137 * @param rep The repetition index (0-indexed) 138 */ 139 public HD getMasterFileApplicationIdentifier(int rep) { 140 HD retVal = this.getTypedField(2, rep); 141 return retVal; 142 } 143 144 /** 145 * Returns a specific repetition of 146 * MFI-2: "Master File Application Identifier" - creates it if necessary 147 * 148 * @param rep The repetition index (0-indexed) 149 */ 150 public HD getMfi2_MasterFileApplicationIdentifier(int rep) { 151 HD retVal = this.getTypedField(2, rep); 152 return retVal; 153 } 154 155 /** 156 * Returns a count of the current number of repetitions of Master File Application Identifier (MFI-2). 157 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 158 * it will return zero. 159 */ 160 public int getMfi2_MasterFileApplicationIdentifierReps() { 161 return this.getReps(2); 162 } 163 164 165 /** 166 * Inserts a repetition of 167 * MFI-2: "Master File Application Identifier" at a specific index 168 * 169 * @param rep The repetition index (0-indexed) 170 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 171 */ 172 public HD insertMasterFileApplicationIdentifier(int rep) throws HL7Exception { 173 return (HD) super.insertRepetition(2, rep); 174 } 175 176 177 /** 178 * Inserts a repetition of 179 * MFI-2: "Master File Application Identifier" at a specific index 180 * 181 * @param rep The repetition index (0-indexed) 182 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 183 */ 184 public HD insertMfi2_MasterFileApplicationIdentifier(int rep) throws HL7Exception { 185 return (HD) super.insertRepetition(2, rep); 186 } 187 188 189 /** 190 * Removes a repetition of 191 * MFI-2: "Master File Application Identifier" at a specific index 192 * 193 * @param rep The repetition index (0-indexed) 194 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 195 */ 196 public HD removeMasterFileApplicationIdentifier(int rep) throws HL7Exception { 197 return (HD) super.removeRepetition(2, rep); 198 } 199 200 201 /** 202 * Removes a repetition of 203 * MFI-2: "Master File Application Identifier" at a specific index 204 * 205 * @param rep The repetition index (0-indexed) 206 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 207 */ 208 public HD removeMfi2_MasterFileApplicationIdentifier(int rep) throws HL7Exception { 209 return (HD) super.removeRepetition(2, rep); 210 } 211 212 213 214 215 /** 216 * Returns 217 * MFI-3: "File-Level Event Code" - creates it if necessary 218 */ 219 public ID getFileLevelEventCode() { 220 ID retVal = this.getTypedField(3, 0); 221 return retVal; 222 } 223 224 /** 225 * Returns 226 * MFI-3: "File-Level Event Code" - creates it if necessary 227 */ 228 public ID getMfi3_FileLevelEventCode() { 229 ID retVal = this.getTypedField(3, 0); 230 return retVal; 231 } 232 233 234 235 /** 236 * Returns 237 * MFI-4: "Entered Date/Time" - creates it if necessary 238 */ 239 public DTM getEnteredDateTime() { 240 DTM retVal = this.getTypedField(4, 0); 241 return retVal; 242 } 243 244 /** 245 * Returns 246 * MFI-4: "Entered Date/Time" - creates it if necessary 247 */ 248 public DTM getMfi4_EnteredDateTime() { 249 DTM retVal = this.getTypedField(4, 0); 250 return retVal; 251 } 252 253 254 255 /** 256 * Returns 257 * MFI-5: "Effective Date/Time" - creates it if necessary 258 */ 259 public DTM getEffectiveDateTime() { 260 DTM retVal = this.getTypedField(5, 0); 261 return retVal; 262 } 263 264 /** 265 * Returns 266 * MFI-5: "Effective Date/Time" - creates it if necessary 267 */ 268 public DTM getMfi5_EffectiveDateTime() { 269 DTM retVal = this.getTypedField(5, 0); 270 return retVal; 271 } 272 273 274 275 /** 276 * Returns 277 * MFI-6: "Response Level Code" - creates it if necessary 278 */ 279 public ID getResponseLevelCode() { 280 ID retVal = this.getTypedField(6, 0); 281 return retVal; 282 } 283 284 /** 285 * Returns 286 * MFI-6: "Response Level Code" - creates it if necessary 287 */ 288 public ID getMfi6_ResponseLevelCode() { 289 ID retVal = this.getTypedField(6, 0); 290 return retVal; 291 } 292 293 294 295 296 297 /** {@inheritDoc} */ 298 protected Type createNewTypeWithoutReflection(int field) { 299 switch (field) { 300 case 0: return new CWE(getMessage()); 301 case 1: return new HD(getMessage()); 302 case 2: return new ID(getMessage(), new Integer( 178 )); 303 case 3: return new DTM(getMessage()); 304 case 4: return new DTM(getMessage()); 305 case 5: return new ID(getMessage(), new Integer( 179 )); 306 default: return null; 307 } 308 } 309 310 311} 312